[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Tue Jun 16 22:06:56 CEST 2009
SVN commit 982791 by fenton:
Apply layout changes to ChangeDataSampleDialog.
M +80 -23 changedatasampledialog.cpp
M +14 -4 changedatasampledialog.h
M +130 -68 changedatasampledialog.ui
--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.cpp #982790:982791
@@ -32,18 +32,24 @@
qFatal("ERROR: can't construct a ChangeDataSampleDialog without the object store");
}
- connect(_clear, SIGNAL(clicked()), _curveList, SLOT(clearSelection()));
- connect(_selectAll, SIGNAL(clicked()), this, SLOT(selectAll()));
- //connect(_curveList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(updateDefaults(QListWidgetItem*)));
- connect(_curveList, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
+ connect(_add, SIGNAL(clicked()), this, SLOT(addButtonClicked()));
+ connect(_remove, SIGNAL(clicked()), this, SLOT(removeButtonClicked()));
+ connect(_removeAll, SIGNAL(clicked()), this, SLOT(removeAll()));
+ connect(_addAll, SIGNAL(clicked()), this, SLOT(addAll()));
+ connect(_vectorList, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(availableDoubleClicked(QListWidgetItem *)));
+ connect(_selectedVectorList, SIGNAL(itemDoubleClicked ( QListWidgetItem * )), this, SLOT(selectedDoubleClicked(QListWidgetItem *)));
+
+ connect(_vectorList, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
+ connect(_selectedVectorList, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
+
connect(_dataRange, SIGNAL(modified()), this, SLOT(modified()));
connect(_buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
connect(_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(OKClicked()));
connect(_buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
- initialzeEntries();
+ initializeEntries();
updateButtons();
}
@@ -58,9 +64,51 @@
}
+void ChangeDataSampleDialog::removeButtonClicked() {
+ foreach (QListWidgetItem* item, _selectedVectorList->selectedItems()) {
+ _vectorList->addItem(_selectedVectorList->takeItem(_selectedVectorList->row(item)));
+ }
+
+ _vectorList->clearSelection();
+ updateButtons();
+}
+
+
+void ChangeDataSampleDialog::selectedDoubleClicked(QListWidgetItem * item) {
+ if (item) {
+ _vectorList->addItem(_selectedVectorList->takeItem(_selectedVectorList->row(item)));
+ _vectorList->clearSelection();
+ updateButtons();
+ }
+}
+
+
+void ChangeDataSampleDialog::addButtonClicked() {
+ foreach (QListWidgetItem* item, _vectorList->selectedItems()) {
+ _selectedVectorList->addItem(_vectorList->takeItem(_vectorList->row(item)));
+ }
+ _selectedVectorList->clearSelection();
+ updateButtons();
+}
+
+
+void ChangeDataSampleDialog::availableDoubleClicked(QListWidgetItem * item) {
+ if (item) {
+ _selectedVectorList->addItem(_vectorList->takeItem(_vectorList->row(item)));
+ _selectedVectorList->clearSelection();
+ updateButtons();
+ }
+}
+
+
void ChangeDataSampleDialog::updateButtons() {
- bool ok = (_curveList->selectedItems().count() > 0);
- _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(ok);
+ bool valid = _selectedVectorList->count() > 0;
+ _buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
+ _buttonBox->button(QDialogButtonBox::Apply)->setEnabled(valid);
+ _add->setEnabled(_vectorList->selectedItems().count() > 0);
+ _addAll->setEnabled(_vectorList->count() > 0);
+ _remove->setEnabled(_selectedVectorList->selectedItems().count() > 0);
+ _removeAll->setEnabled(_selectedVectorList->count() > 0);
}
@@ -70,39 +118,47 @@
void ChangeDataSampleDialog::updateCurveListDialog() {
- _curveList->clear();
+ _vectorList->clear();
+ _selectedVectorList->clear();
DataVectorList dataVectors = _store->getObjects<DataVector>();
- _curveList->blockSignals(true);
+ _vectorList->blockSignals(true);
for (DataVectorList::ConstIterator i = dataVectors.begin(); i != dataVectors.end(); ++i) {
DataVectorPtr vector = *i;
vector->readLock();
QListWidgetItem *wi = new QListWidgetItem(vector->Name());
wi->setToolTip(vector->descriptionTip());
vector->unlock();
- _curveList->addItem(wi);
+ _vectorList->addItem(wi);
}
- _curveList->blockSignals(false);
- _curveList->selectAll();
+ _vectorList->blockSignals(false);
}
-void ChangeDataSampleDialog::selectAll() {
- _curveList->selectAll();
+void ChangeDataSampleDialog::addAll() {
+ _vectorList->selectAll();
+ addButtonClicked();
}
-void ChangeDataSampleDialog::initialzeEntries() {
- _dataRange->setCountFromEnd(_dialogDefaults->value("vector/countFromEnd",false).toBool());
- _dataRange->setStart(_dialogDefaults->value("vector/start", 0).toInt());
- _dataRange->setReadToEnd(_dialogDefaults->value("vector/readToEnd",true).toBool());
- _dataRange->setRange(_dialogDefaults->value("vector/range", 1).toInt());
- _dataRange->setSkip(_dialogDefaults->value("vector/skip", 0).toInt());
- _dataRange->setDoSkip(_dialogDefaults->value("vector/doSkip", false).toBool());
- _dataRange->setDoFilter(_dialogDefaults->value("vector/doAve",false).toBool());
+void ChangeDataSampleDialog::removeAll() {
+ _selectedVectorList->selectAll();
+ removeButtonClicked();
}
+
+void ChangeDataSampleDialog::initializeEntries() {
+ _dataRange->setCountFromEnd(_dialogDefaults->value("vector/countFromEnd",false).toBool());
+ _dataRange->setStart(_dialogDefaults->value("vector/start", 0).toInt());
+ _dataRange->setReadToEnd(_dialogDefaults->value("vector/readToEnd",true).toBool());
+ _dataRange->setRange(_dialogDefaults->value("vector/range", 1).toInt());
+ _dataRange->setSkip(_dialogDefaults->value("vector/skip", 0).toInt());
+ _dataRange->setDoSkip(_dialogDefaults->value("vector/doSkip", false).toBool());
+ _dataRange->setDoFilter(_dialogDefaults->value("vector/doAve",false).toBool());
+}
+
+
void ChangeDataSampleDialog::updateDefaults(QListWidgetItem* item) {
if (!item) {
return;
@@ -131,7 +187,8 @@
void ChangeDataSampleDialog::apply() {
- QList<QListWidgetItem*> selectedItems = _curveList->selectedItems();
+ _selectedVectorList->selectAll();
+ QList<QListWidgetItem*> selectedItems = _selectedVectorList->selectedItems();
for (int i = 0; i < selectedItems.size(); ++i) {
if (DataVectorPtr vector = kst_cast<DataVector>(_store->retrieveObject(selectedItems.at(i)->text()))) {
vector->writeLock();
--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.h #982790:982791
@@ -32,14 +32,24 @@
void exec();
private slots:
+ void addButtonClicked();
+ void removeButtonClicked();
+ void addAll();
+ void removeAll();
+
+ void availableDoubleClicked(QListWidgetItem * item);
+ void selectedDoubleClicked(QListWidgetItem * item);
+
+ void modified();
+ void updateButtons();
+
+ void initializeEntries();
void updateDefaults(QListWidgetItem* item);
- void selectAll();
+
void OKClicked();
void apply();
- void updateButtons();
- void modified();
- void initialzeEntries();
+
private:
void updateCurveListDialog();
--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.ui #982790:982791
@@ -1,90 +1,153 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>ChangeDataSampleDialog</class>
- <widget class="QDialog" name="ChangeDataSampleDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="ChangeDataSampleDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>502</width>
- <height>295</height>
+ <width>590</width>
+ <height>419</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Change Data Samples</string>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>11</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" colspan="2" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="text" >
- <string>Vectors to change:</string>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="buttonGroup1">
+ <property name="title">
+ <string>Vector Selection</string>
</property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QListWidget" name="_vectorList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis">
+ <string>The source file for the vectors selected in this list will be changed.</string>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_addAll">
+ <property name="whatsThis">
+ <string>Select all vectors in the list.</string>
+ </property>
+ <property name="text">
+ <string>Add A&ll</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_add">
+ <property name="whatsThis">
+ <string>Select all vectors in the list.</string>
+ </property>
+ <property name="text">
+ <string>&Add</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_remove">
+ <property name="whatsThis">
+ <string>Unselect all vectors in the list.</string>
+ </property>
+ <property name="text">
+ <string>&Remove</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="_removeAll">
+ <property name="whatsThis">
+ <string>Unselect all vectors in the list.</string>
+ </property>
+ <property name="text">
+ <string>R&emove All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>80</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QListWidget" name="_selectedVectorList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis">
+ <string>The source file for the vectors selected in this list will be changed.</string>
+ </property>
+ <property name="selectionMode">
+ <enum>QAbstractItemView::ExtendedSelection</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
- <item row="1" column="1" >
- <layout class="QVBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QPushButton" name="_clear" >
- <property name="whatsThis" >
- <string>Unselect all vectors in the list.</string>
- </property>
- <property name="text" >
- <string>C&lear</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="_selectAll" >
- <property name="whatsThis" >
- <string>Select all vectors in the list.</string>
- </property>
- <property name="text" >
- <string>S&elect All</string>
- </property>
- </widget>
- </item>
- </layout>
+ <item>
+ <widget class="Kst::DataRange" name="_dataRange" native="true"/>
</item>
- <item row="1" column="0" >
- <widget class="QListWidget" name="_curveList" >
- <property name="whatsThis" >
- <string>The sample ranges for the vectors selected in this list will be changed.</string>
- </property>
- <property name="selectionMode" >
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2" >
- <widget class="Kst::DataRange" native="1" name="_dataRange" />
- </item>
- <item row="3" column="0" colspan="2" >
- <widget class="QDialogButtonBox" name="_buttonBox" >
- <property name="orientation" >
+ <item>
+ <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>
</item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
@@ -94,7 +157,6 @@
</customwidget>
</customwidgets>
<tabstops>
- <tabstop>_curveList</tabstop>
<tabstop>_dataRange</tabstop>
</tabstops>
<resources/>
More information about the Kst
mailing list