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

Mike Fenton mike at staikos.net
Wed Jan 28 22:28:47 CET 2009


SVN commit 917973 by fenton:

Adjust Dialog ListView to automatically adjust to the size of the text independent of font sizing.


 M  +3 -4      dialog.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/dialog.cpp #917972:917973
@@ -46,10 +46,9 @@
   _listWidget->addItem(item);
   _stackedWidget->addWidget(page);
   _itemHash.insert(item, page);
-  if (_listWidget->width() < item->text().length() * 7) {
-    int extra = (item->text().length() * 7) - _listWidget->width();
-    _listWidget->setMinimumSize(_listWidget->size().width() + extra, _listWidget->size().height());
-    resize(minimumSizeHint());
+  int itemWidth = _listWidget->visualItemRect(item).width() + 5;
+  if (_listWidget->width() < itemWidth) {
+    _listWidget->setMinimumSize(itemWidth, _listWidget->size().height());
   }
 }
 


More information about the Kst mailing list