![]() |
2010-09-08
, 05:28
|
Posts: 180 |
Thanked: 76 times |
Joined on May 2010
|
#2
|
The Following User Says Thank You to Diph For This Useful Post: | ||
![]() |
2010-09-08
, 09:05
|
|
Posts: 199 |
Thanked: 156 times |
Joined on May 2010
@ Holland
|
#3
|
![]() |
2010-09-08
, 10:45
|
Posts: 180 |
Thanked: 76 times |
Joined on May 2010
|
#4
|
The Following 2 Users Say Thank You to Diph For This Useful Post: | ||
![]() |
2010-09-08
, 12:35
|
|
Posts: 199 |
Thanked: 156 times |
Joined on May 2010
@ Holland
|
#5
|
I'm not sure what you are trying to do but can you use QListWidget::itemSelectionChanged signal and check which item is selected?
![]() |
2010-09-09
, 00:04
|
|
Posts: 199 |
Thanked: 156 times |
Joined on May 2010
@ Holland
|
#6
|
if(ui->fileList->currentItem()->isSelected() == false) ui->fileList->currentItem()->setSelected(true);
I'm having some trouble with the selecting behaviour of my QListWidget..
What I'd like it to achieve is to change the currentItem ONLY when an item is pressed, not when scrolling.
But it also changes the currentItem when scrolling, because I'm touching a different entry in the list.
The currentItemChanged slot has 2 arguments, "QListWidgetItem * current" and "QListWidgetItem * previous". Let's say I've got item A and B. Item A was selected by pressing, and it changed to B because of scrolling.
The problem is this:
I decided to change the currently selected item (B) to the previously selected item (A), so that it wouldn't change when scrolling. But then the slot is called again, because it changed.
And of course, then B is the previous, ands it changes to B again. This is an infinite loop.
Of course I've tried a fair amount of things with if-statements and stuff, and searched with Google, but no luck unfortunately.
Does anyone know a way to bypass this slot function?
Any help is much appreciated
Wallpaeper - Desktop background manager (in Extras!)
Config Reader - Export all Gconf to an HTML file + compare feature (Extras-testing)
Even though these programs are available for free, I would appreciate any donations