| Summary: | Can create empty entry in Differentiate Curves Selected list | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
| Component: | general | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Andrew Walker
2006-06-13 19:49:53 UTC
SVN commit 551110 by arwalker:
BUG:129101 Do not assume a listbox has a selected entry. Do not equate the current item with being selected.
M +33 -13 kstcurvedifferentiate_i.cpp
--- trunk/extragear/graphics/kst/src/libkstapp/kstcurvedifferentiate_i.cpp #551109:551110
@@ -81,6 +81,7 @@
}
+
void KstCurveDifferentiateI::updateCurveDifferentiate() {
updateButtons();
}
@@ -92,11 +93,25 @@
raise();
}
+
void KstCurveDifferentiateI::updateButtons() {
- _remove->setEnabled(selectedListBox->currentItem() >= 0);
- _add->setEnabled(availableListBox->currentItem() >= 0);
+ int i = selectedListBox->currentItem();
+ if (i >= 0 && selectedListBox->isSelected(i)) {
+ _remove->setEnabled(true);
+ } else {
+ _remove->setEnabled(false);
+ }
+
+ i = availableListBox->currentItem();
+ if (i >= 0 && availableListBox->isSelected(i)) {
+ _add->setEnabled(true);
+ } else {
+ _add->setEnabled(false);
+ }
+
_up->setEnabled(selectedListBox->currentItem() > 0);
- _down->setEnabled(selectedListBox->currentItem() < (int)selectedListBox->count() - 1);
+ _down->setEnabled(selectedListBox->currentItem() >= 0 &&
+ selectedListBox->currentItem() < (int)selectedListBox->count() - 1);
}
@@ -170,6 +185,7 @@
}
}
+
void KstCurveDifferentiateI::getOptions( ) {
_lineColorOrder = selectedListBox->index(selectedListBox->findItem(i18n("Line Color"), ExactMatch));
_pointStyleOrder = selectedListBox->index(selectedListBox->findItem(i18n("Point Style"), ExactMatch));
@@ -213,22 +229,26 @@
void KstCurveDifferentiateI::upButtonClicked() {
// move item up
int i = selectedListBox->currentItem();
- QString text = selectedListBox->currentText();
- selectedListBox->removeItem(i);
- selectedListBox->insertItem(text, i-1);
- selectedListBox->setSelected(i-1, true);
- updateButtons();
+ if (i != -1) {
+ QString text = selectedListBox->currentText();
+ selectedListBox->removeItem(i);
+ selectedListBox->insertItem(text, i-1);
+ selectedListBox->setSelected(i-1, true);
+ updateButtons();
+ }
}
void KstCurveDifferentiateI::downButtonClicked() {
// move item down
int i = selectedListBox->currentItem();
- QString text = selectedListBox->currentText();
- selectedListBox->removeItem(i);
- selectedListBox->insertItem(text, i+1);
- selectedListBox->setSelected(i+1, true);
- updateButtons();
+ if (i != -1) {
+ QString text = selectedListBox->currentText();
+ selectedListBox->removeItem(i);
+ selectedListBox->insertItem(text, i+1);
+ selectedListBox->setSelected(i+1, true);
+ updateButtons();
+ }
}
|