TreeViewItem::setSelected notification


#1

When selecting a TreeViewItem, there is no way to prevent the event notification to be triggered. There are times when it is useful to inhibit such behaviour, because the TreeView selection is being updated programmatically to reflect some internal state of the application, and not because of user interaction.

The goal could be achieved by adding a boolean “sendNotification” argument to TreeViewItem::setSelected, with “true” as default value in order not to break existing code, which will prevent the “itemSelectionChanged” method to be called at the end of the function in case it is false.


#2

bump


#3

Yes… I’ve been meaning to go through all the methods which have a “don’t broadcast a change message” parameter, and change them to all use a standard enum instead of a bool, because there’s some inconsistency between them at the moment. I guess I don’t really want to add a bool for this method until I’ve done that.


#4

please please please start with this one adding the enum, then spread it to the other methods taking your time…


#5

FYI, I’ve just added this.


#6

celebrating in the streets


#7

I think that this could be applied to Button::setToggleState(…) too


#8

Yes, and a few other places. I’ll get round to them at some point.


#9

Another place where the choice not to send a notification should be added is the ScrollBar::setCurrentRange method


#10

noticed the change to ScrollBar, very much appreciated :slight_smile: waiting for the one to Button::setToggleState(…)

out of pure curiosity, how do you keep track of all the TODO things that arise from forum discussions? They spread over a wide range of topics and I’m sure it’s not easy to switch context so frequently, how do you cope with that?


#11

[quote=“yfede”]noticed the change to ScrollBar, very much appreciated :slight_smile: waiting for the one to Button::setToggleState(…)

out of pure curiosity, how do you keep track of all the TODO things that arise from forum discussions? They spread over a wide range of topics and I’m sure it’s not easy to switch context so frequently, how do you cope with that?[/quote]

Pretty sure he has a pornographic memory.


#12

if that’s true, I couldn’t have found a better use for the word myself :smiley:


#13

it could be useful if all the ScrollBar::setCurrentRange… methods that involve changing the current range were added the “send notification” argument, not just the one that takes a Range as its argument