[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/office/kmymoney/kmymoney2/widgets
From:       Cristian OneČ› <onet.cristian () gmail ! com>
Date:       2009-09-26 13:03:47
Message-ID: 1253970227.277534.27041.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1028272 by conet:

Fixed the transaction form problem with the following actions:
In paintRegisterCell draw the text only if not in edit mode (to get rid of the \
overlapping labels). When entering edit mode hide the original tabbar and insert the \
edit tabbar in the layout when setting up the form. When leaving edit mode set the \
original tabbar visible again.


 M  +15 -10    transaction.cpp  


--- trunk/playground/office/kmymoney/kmymoney2/widgets/transaction.cpp \
#1028271:1028272 @@ -20,10 +20,10 @@
 
 #include <QString>
 #include <QPainter>
-#include <qwidget.h>
-//Added by qt3to4:
+#include <QWidget>
 #include <QList>
 #include <QPixmap>
+#include <QBoxLayout>
 
 // ----------------------------------------------------------------------------
 // KDE Includes
@@ -570,13 +570,8 @@
     painter->fillRect(textRect, _cg.base());
   }
 
-  // make sure, we clear the cell
-  // in case of an editable field and edit mode, we just clear the field
-  if(txt.isEmpty() || (editField && m_inEdit))
-    painter->drawText(textRect, align, " ");
-  else
+  if (!m_inEdit)
     painter->drawText(textRect, align, txt);
-
 }
 
 void Transaction::setupPalette(const QPalette& palette, QMap<QString, QWidget*>& \
editWidgets) @@ -722,6 +717,11 @@
 void Transaction::startEditMode(void)
 {
   m_inEdit = true;
+
+  // hide the original tabbar since the edit tabbar will be added
+  KMyMoneyTransactionForm::TransactionForm* form = \
dynamic_cast<KMyMoneyTransactionForm::TransactionForm*>(m_form); +  \
form->tabBar()->setVisible(false); +
   // only update the number of lines displayed if we edit inside the register
   if(m_inRegisterEdit)
     setNumRowsRegister(numRowsRegister(true));
@@ -729,6 +729,10 @@
 
 void Transaction::leaveEditMode(void)
 {
+  // show the original tabbar since the edit tabbar was removed
+  KMyMoneyTransactionForm::TransactionForm* form = \
dynamic_cast<KMyMoneyTransactionForm::TransactionForm*>(m_form); +  \
form->tabBar()->setVisible(true); +
   m_inEdit = false;
   m_inRegisterEdit = false;
   setFocus(hasFocus(), true);
@@ -1247,11 +1251,12 @@
       payee->setHint(QString());
   }
 
-  // drop the tabbar on top of the original
   KMyMoneyTransactionForm::TransactionForm* form = \
dynamic_cast<KMyMoneyTransactionForm::TransactionForm*>(m_form);  TabBar* w = \
dynamic_cast<TabBar*>(editWidgets["tabbar"]);  if(w) {
-    w->reparent(form->tabBar(), QPoint(0, 0), true);
+    // insert the tabbar in the boxlayout so it will take the place of the original \
tabbar which was hidden +    QBoxLayout* boxLayout = \
dynamic_cast<QBoxLayout*>(form->tabBar()->parentWidget()->layout()); +    \
boxLayout->insertWidget(0, w);  }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic