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

List:       kde-commits
Subject:    KDE/kdevelop/languages/cpp/debugger
From:       Vladimir Prus <ghost () cs ! msu ! su>
Date:       2005-07-11 6:34:28
Message-ID: 1121063668.939092.28343.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 433549 by vprus:

Properly resize first column of variables view.

The existing code tries to set var name column width to be half the total
width, but does not succeed. The width is set in VariableWidget::setEnabled,
which is called in thise context.

   #0  GDBDebugger::VariableWidget::setEnabled (this=0x817a5a8, bEnabled=true) at variablewidget.cpp:127
   ...
   #3  0xb742013d in KDockWidget::setWidget () from /usr/lib/libkdeui.so.4
   #4  0xb7dbdff5 in KMdiToolViewAccessor::KMdiToolViewAccessor () from /usr/lib/libkmdi.so.1
   #5  0xb7dabe47 in KMdiMainFrm::addToolWindow () from /usr/lib/libkmdi.so.1

Here, the width of variable view is still the same as was at creation time
(640 for me) and after KMDI sets the the real width of the vartree, the column
width becomes was too large.

This commit resizes the column on the first showEvent.

CC: kdevelop-devel@kdevelop.org





 M  +14 -6     variablewidget.cpp  
 M  +4 -4      variablewidget.h  


--- trunk/KDE/kdevelop/languages/cpp/debugger/variablewidget.cpp #433548:433549
@@ -68,7 +68,7 @@
 {
 
 VariableWidget::VariableWidget(QWidget *parent, const char *name)
-    : QWidget(parent, name)
+    : QWidget(parent, name), firstShow_(true)
 {
     varTree_ = new VariableTree(this);
 
@@ -120,13 +120,21 @@
 
 // **************************************************************************
 
-void VariableWidget::setEnabled(bool bEnabled)
+// When the variables view is shown the first time, 
+// set the width of 'variable name' column to half the total
+// width.
+// Ideally, KMDI should emit 'initial size set' signal, but
+// it does not, so we rely on the fact that size is already
+// set when the widget is first shown.
+void VariableWidget::showEvent(QShowEvent *)
 {
-    QWidget::setEnabled(bEnabled);
-    if (bEnabled && parentWidget()) {
-        varTree_->setColumnWidth(0, parentWidget()->width()/2);
-  }
+    if (firstShow_)
+    {
+        firstShow_ = false;
+        varTree_->setColumnWidth(0, width()/2);
+    }
 }
+
 // **************************************************************************
 
 void VariableWidget::slotAddWatchVariable()
--- trunk/KDE/kdevelop/languages/cpp/debugger/variablewidget.h #433548:433549
@@ -51,11 +51,10 @@
     VariableTree *varTree() const
     { return varTree_; }
 
-    virtual void setEnabled(bool b);
+protected: // QWidget overrides
+    void showEvent(QShowEvent *);
+    void focusInEvent(QFocusEvent *e);
 
-protected:
-    virtual void focusInEvent(QFocusEvent *e);
-
 public slots:
     void slotAddWatchVariable();
     void slotAddWatchVariable(const QString &ident);
@@ -68,6 +67,7 @@
     friend class VariableTree;
 
     KHistoryCombo *watchVarEditor_;
+    bool firstShow_;
 };
 
 /***************************************************************************/
[prev in list] [next in list] [prev in thread] [next in thread] 

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