[Kst] branches/work/kst/portto4/kst/src
Adam Treat
treat at kde.org
Wed Oct 3 01:16:41 CEST 2007
SVN commit 720311 by treat:
* Don't allow an empty selection for x and y vectors.
M +6 -0 libkstapp/curvedialog.cpp
M +20 -6 widgets/vectorselector.cpp
M +2 -3 widgets/vectorselector.h
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #720310:720311
@@ -33,6 +33,12 @@
setupUi(this);
setTabTitle(tr("Curve"));
+
+ _xError->setAllowEmptySelection(true);
+ _yError->setAllowEmptySelection(true);
+
+ _xMinusError->setAllowEmptySelection(true);
+ _yMinusError->setAllowEmptySelection(true);
}
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #720310:720311
@@ -17,7 +17,7 @@
namespace Kst {
VectorSelector::VectorSelector(QWidget *parent)
- : QWidget(parent), _allowEmptySelection(true) {
+ : QWidget(parent), _allowEmptySelection(false) {
setupUi(this);
@@ -54,6 +54,25 @@
}
+bool VectorSelector::allowEmptySelection() const {
+ return _allowEmptySelection;
+}
+
+
+void VectorSelector::setAllowEmptySelection(bool allowEmptySelection) {
+ _allowEmptySelection = allowEmptySelection;
+
+ int i = _vector->findText(tr("<None>"));
+ if (i != -1)
+ _vector->removeItem(i);
+
+ if (_allowEmptySelection) {
+ _vector->insertItem(0, tr("<None>"), qVariantFromValue(0));
+ _vector->setCurrentIndex(0);
+ }
+}
+
+
void VectorSelector::newVector() {
DialogLauncher::self()->showVectorDialog();
fillVectors();
@@ -87,11 +106,6 @@
qSort(list);
- if (allowEmptySelection()) {
- list.prepend(tr("<None>"));
- vectors.insert(tr("<None>"), KstVectorPtr());
- }
-
KstVectorPtr current = selectedVector();
_vector->clear();
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.h #720310:720311
@@ -30,9 +30,8 @@
KstVectorPtr selectedVector() const;
void setSelectedVector(KstVectorPtr selectedVector);
- bool allowEmptySelection() const { return _allowEmptySelection; }
- void setAllowEmptySelection(bool allowEmptySelection)
- { _allowEmptySelection = allowEmptySelection; }
+ bool allowEmptySelection() const;
+ void setAllowEmptySelection(bool allowEmptySelection);
Q_SIGNALS:
void selectionChanged();
More information about the Kst
mailing list