This prevented the user from dragging the items in wxTreeCtrl, which is
something that's supposed to be possible.
To allow selection by dragging, we'd need to extend wx API with a method
indicating that dragging is not used in this particular control.
Closes https://github.com/wxWidgets/wxWidgets/pull/1458
Avoid setting state to DragSelectingState unless dragging items in
wxTreeCtrl is explicitly allowed, as this this causes bad behaviour
downstream with subsequent selections when the client does anything in
the event handler beyond simply not allowing the event.
Basically, we can't be guaranteed of the mouse state on return from the
event handler, so dropping into drag selection mode is potentially
inappropriate (or just plain bad).
Closes https://github.com/wxWidgets/wxWidgets/pull/1523
In wx API, calling wxTreeCtrl::SelectItem() is supposed to generate an
event.
Also use Qt selection model to support single-selection mode.
Closes https://github.com/wxWidgets/wxWidgets/pull/1453
Center the items vertically, as this looks much better, and is also more
consistent with the appearance in the generic version, which was
previously used.
Closes https://github.com/wxWidgets/wxWidgets/pull/1378
Return false if the item is expanded but scrolled outside of the
viewport, to conform to the function documentation and the behaviour in
the other ports.
Closes https://github.com/wxWidgets/wxWidgets/pull/1380
This makes the code slightly simpler, as there is just one function
instead of two, and also changes the meaning of the value stored in the
cookie parameter as a side effect: previously, it was the index of the
last retrieved item, while now it's the index of the next item to
retrieve.
The difference is not huge, but the latter is more usual and, more
importantly, avoids a stack overflow due to infinite recursion in the
treectrl sample, which assumed that cookie is never null after a
successful call to GetFirstChild(). The code in the sample is arguably
incorrect, as the cookie is supposed to be opaque, but it's still better
to avoid crashing, especially because similar code is almost certainly
present in user code if it was copied from the sample.
Make QTreeWidgetItems editable and add SelectedClicked as an edit trigger.
Simplify closing the editor as QAbstractItemView already connects to its delegate closeEditor signal.
Ensure that wxTreeItemData is deleted.
Use a QT delegate to create editor and perform custom model update.
Connect to the closeEditor signal to send out end label edit events and decide whether to accept changes.