[Kst] branches/work/kst/portto4/kst/src/libkstapp

Barth Netterfield netterfield at astro.utoronto.ca
Tue Nov 2 17:10:24 CET 2010


SVN commit 1192341 by netterfield:

CCBUG: 252289
Set a minimum size for the list widget.  This is a semi-hack, since it sets the width in
characters, not pixels, so it will survive font size changes.  Ideally we would know the 
size of the longest entry, and set it to that.  But, at this point of construction, we 
don't, so... use 15 which is 2 longer than the longest entry I could find.



 M  +2 -1      dialog.ui  
 M  +9 -0      viewitemdialog.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/dialog.ui #1192340:1192341
@@ -9,7 +9,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>421</width>
+    <width>462</width>
     <height>299</height>
    </rect>
   </property>
@@ -52,6 +52,7 @@
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
+       <zorder>_splitter</zorder>
       </widget>
      </item>
      <item row="1" column="0">
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #1192340:1192341
@@ -37,6 +37,15 @@
 
   setWindowTitle(tr("Edit View Item"));
 
+  // semi-hack: set the width of the list widget to 15 characters, which is enough
+  // to say "X-Axis Markers" in english.  This is better than setting it to a fixed
+  // number of pixels, as it scales with font size or screen resolution, but
+  // it won't necessairly survive translations, or someone adding a option like
+  // "Do something super important", which has more than 15 characters.
+  // We have to do it here, before the layout is set, and we don't yet know how
+  // what is going into the listWidget.
+  _listWidget->setMinimumWidth(_listWidget->fontMetrics().averageCharWidth()*15);
+
   QWidget *extension = extensionWidget();
 
   QVBoxLayout *extensionLayout = new QVBoxLayout(extension);


More information about the Kst mailing list