summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-07-03 12:02:48 +0200
committerNorwegian Rock Cat <qt-info@nokia.com>2009-07-03 12:02:48 +0200
commit26fba3ca3300639024a0c39acb70d3b34ff61bf1 (patch)
tree0cb99cbbfe35a6d3a4bc8d73668550b27ec574d4 /src
parent1bcca1045a88973fc49eae44463fa837335cab8a (diff)
Correct reset when changing from SelectAll to SelectOne.
This call almost did the right thing, but I was a bit over protective on checking if the item was selected. So, instead just turn it off and turn it back on and get the thing correct.
Diffstat (limited to 'src')
-rw-r--r--src/qtsegmentcontrol.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qtsegmentcontrol.cpp b/src/qtsegmentcontrol.cpp
index 5370b18..617f54a 100644
--- a/src/qtsegmentcontrol.cpp
+++ b/src/qtsegmentcontrol.cpp
@@ -266,8 +266,12 @@ void QtSegmentControl::setSelectionBehavior(SelectionBehavior behavior)
return;
d->selectionBehavior = behavior;
if (behavior == SelectOne) {
- // This call will do the right thing.
- setSegmentSelected(d->lastSelected, true);
+ // Setting a new selection will clear all
+ // the old ones, so just re-select the last
+ // selected item.
+ int saveLastSelection = d->lastSelected;
+ setSegmentSelected(saveLastSelection, false);
+ setSegmentSelected(saveLastSelection, true);
} else if (behavior == SelectNone) {
d->lastSelected = -1;
const int segmentCount = d->segments.count();