OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_dataop.cpp versions 1.3 and 1.4
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_dataop.cpp 1.3 -> 1.4

--- as_dataop.cpp        2002/11/22 19:49:19     1.3
+++ as_dataop.cpp        2002/11/22 21:14:27     1.4
@@ -29,10 +29,14 @@
 void Titraqform::loadData(QTextStream &Tstream)
 {
     bool bValid = true; // Used to warn on invalid accounting data
+    int i = 0;          // Iterator used in loop and also as a count
+
+    // Optimize viewing by repainting cells only once after processing
+    m_pMaintable->setUpdatesEnabled(false);
 
     // Set the table text by linewise reading from the input stream
     // and parsing date, time, account, and other columns out of it
-    for (int i = 0; !Tstream.atEnd(); i++) {
+    while (!Tstream.atEnd()) {
         QString Date, Account, Amount, Remark;      // Fields of a valid AS file
 
         QString Temp;                               // Used for linewise editing
@@ -66,8 +70,13 @@
         Remark = Asline.read(); // Copy the remark field
         if (Remark != NULL)
             m_pMaintable->setText(i, 5, Remark);
+
+        i++; // The big increment
     }
 
+    m_pMaintable->setUpdatesEnabled(true);  // Repaint all
+    m_pMaintable->setNumRows(i);    // Trim unneeded rows
+    m_pMaintable->repaint();        // Force repaint
     m_pRemark->setText(trUtf8("Loaded text goes here"));
     m_pRemark->setEdited(false);    // Reset widget
 

CVSTrac 2.0.1