[Kst] branches/work/kst/portto4/kst/src/libkstapp
Peter Kümmel
syntheticpp at gmx.net
Tue Jan 25 19:58:02 CET 2011
SVN commit 1217100 by kuemmel:
make string and scalar view updatable
M +10 -4 viewprimitivedialog.cpp
M +2 -2 viewprimitivedialog.h
M +16 -10 viewprimitivedialog.ui
--- branches/work/kst/portto4/kst/src/libkstapp/viewprimitivedialog.cpp #1217099:1217100
@@ -27,6 +27,7 @@
_model = 0;
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
+ connect(updateButton, SIGNAL(clicked()), this, SLOT(update()));
}
@@ -43,12 +44,17 @@
}
-void ViewPrimitiveDialog::refresh() {
+void ViewPrimitiveDialog::update() {
deleteModel();
_model = createModel(_doc->objectStore());
+ _tree->setModel(_model);
_tree->header()->setResizeMode(QHeaderView::ResizeToContents);
- _tree->setModel(_model);
+ QApplication::processEvents();
+ if(_tree->header() && _tree->header()->count() > 1) {
+ _tree->header()->setResizeMode(0, QHeaderView::Interactive);
+ _tree->header()->setResizeMode(1, QHeaderView::Interactive);
}
+}
@@ -56,7 +62,7 @@
ViewPrimitiveDialog(parent, doc)
{
setWindowTitle(tr("View String Values"));
- refresh();
+ update();
}
@@ -70,7 +76,7 @@
ViewPrimitiveDialog(parent, doc)
{
setWindowTitle(tr("View Scalar Values"));
- refresh();
+ update();
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewprimitivedialog.h #1217099:1217100
@@ -34,8 +34,8 @@
ViewPrimitiveDialog(QWidget *parent, Document *doc);
virtual ~ViewPrimitiveDialog();
- protected:
- void refresh();
+ protected Q_SLOTS:
+ void update();
private:
virtual QAbstractItemModel* createModel(ObjectStore *store) = 0;
--- branches/work/kst/portto4/kst/src/libkstapp/viewprimitivedialog.ui #1217099:1217100
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0" >
<class>ViewPrimitiveDialog</class>
<widget class="QDialog" name="ViewPrimitiveDialog" >
@@ -12,27 +13,32 @@
<property name="windowTitle" >
<string>Primitive View</string>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
<widget class="QTreeView" name="_tree" />
</item>
- <item row="1" column="0" >
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="updateButton">
+ <property name="text">
+ <string>Update</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
- <set>QDialogButtonBox::Close|QDialogButtonBox::NoButton</set>
+ <set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
+ </item>
+ </layout>
</widget>
<resources/>
<connections>
More information about the Kst
mailing list