[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Wed Jun 3 16:35:55 CEST 2009
SVN commit 977178 by fenton:
Fix Dialog ListWidget growing indefinitely.
M +17 -1 dialog.cpp
M +2 -0 dialog.h
M +74 -67 dialog.ui
--- branches/work/kst/portto4/kst/src/libkstapp/dialog.cpp #977177:977178
@@ -31,6 +31,8 @@
connect(_buttonBox, SIGNAL(clicked(QAbstractButton *)),
this, SLOT(buttonClicked(QAbstractButton *)));
+ setAttribute(Qt::WA_DeleteOnClose);
+
resize(minimumSizeHint());
}
@@ -46,7 +48,7 @@
_listWidget->addItem(item);
_stackedWidget->addWidget(page);
_itemHash.insert(item, page);
- int itemWidth = _listWidget->visualItemRect(item).width() + 5;
+ int itemWidth = _listWidget->visualItemRect(item).width() + 4;
if (_listWidget->width() < itemWidth) {
_listWidget->setMinimumSize(itemWidth, _listWidget->size().height());
}
@@ -62,9 +64,23 @@
_listWidget->takeItem(_listWidget->row(item));
_stackedWidget->removeWidget(page);
}
+ resetListWidget();
}
+void Dialog::resetListWidget() {
+ int extraSize = _listWidget->width() - 100;
+ _listWidget->setMaximumWidth(100);
+ _listWidget->setMinimumWidth(100);
+ if (extraSize > 0 ) {
+ QList <int> splitterSize;
+ splitterSize << 100;
+ splitterSize << _splitter->sizes()[1] + extraSize;
+ _splitter->setSizes(splitterSize);
+ }
+}
+
+
DialogPage* Dialog::getDialogPage(const QString& pageName) {
QList<QListWidgetItem*> items = _listWidget->findItems(pageName, Qt::MatchExactly);
if (!items.empty()) {
--- branches/work/kst/portto4/kst/src/libkstapp/dialog.h #977177:977178
@@ -60,6 +60,8 @@
void modified();
private:
+ void resetListWidget();
+
QHash<QListWidgetItem*, DialogPage*> _itemHash;
bool _allowApply;
};
--- branches/work/kst/portto4/kst/src/libkstapp/dialog.ui #977177:977178
@@ -1,7 +1,11 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>Dialog</class>
- <widget class="QDialog" name="Dialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="Dialog">
+ <property name="windowModality">
+ <enum>Qt::NonModal</enum>
+ </property>
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@@ -9,126 +13,129 @@
<height>299</height>
</rect>
</property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Dialog</string>
</property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QGridLayout" >
- <property name="spacing" >
+ <property name="modal">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <layout class="QGridLayout">
+ <property name="spacing">
<number>0</number>
</property>
- <item row="0" column="0" colspan="3" >
- <widget class="QWidget" native="1" name="_topCustom" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+ <item row="0" column="0" colspan="3">
+ <widget class="QWidget" name="_topCustom" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item rowspan="3" row="0" column="3" >
- <widget class="QWidget" native="1" name="_extensionWidget" >
- <property name="enabled" >
+ <item row="0" column="3" rowspan="3">
+ <widget class="QWidget" name="_extensionWidget" native="true">
+ <property name="enabled">
<bool>true</bool>
</property>
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QWidget" native="1" name="_leftCustom" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+ <item row="1" column="0">
+ <widget class="QWidget" name="_leftCustom" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QSplitter" name="_splitter" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <item row="1" column="2">
+ <widget class="QWidget" name="_rightCustom" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QWidget" name="_bottomCustom" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSplitter" name="_splitter">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
- <property name="layoutDirection" >
+ <property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="childrenCollapsible" >
+ <property name="childrenCollapsible">
<bool>false</bool>
</property>
- <widget class="QListWidget" name="_listWidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+ <widget class="QListWidget" name="_listWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="resizeMode" >
+ <property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
- <property name="uniformItemSizes" >
+ <property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
- <widget class="QStackedWidget" name="_stackedWidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <widget class="QStackedWidget" name="_stackedWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
- <property name="currentIndex" >
+ <property name="currentIndex">
<number>-1</number>
</property>
</widget>
</widget>
</item>
- <item row="1" column="2" >
- <widget class="QWidget" native="1" name="_rightCustom" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="3" >
- <widget class="QWidget" native="1" name="_bottomCustom" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QDialogButtonBox" name="_buttonBox" >
- <property name="orientation" >
+ <item row="1" column="0">
+ <widget class="QDialogButtonBox" name="_buttonBox">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="standardButtons" >
+ <property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
@@ -143,11 +150,11 @@
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@@ -159,11 +166,11 @@
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
More information about the Kst
mailing list