TreeViewItem::setSelected notification

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.

bump

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.

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

FYI, I’ve just added this.

celebrating in the streets

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

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

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

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=“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.

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

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