[Qt-interest] Knowing when a QTreeWidgetItem label is about to be edited

Bob Hood bhood2 at comcast.net
Fri Feb 19 01:39:19 CET 2010


I have a setup where I have a tool-like window (no frame) that contains
a QTreeWidget.  The code that handles it causes it to hide when it loses
focus.

I've set the QTreeWidgetItem's within it to be editable.  Unfortunately,
when a label is double-clicked, and the in-place editing operation
begins, the window gets a focusOutEvent() and the window hides before
any editing can take place.  I have another window that functions in a
similar fashion where I can set a flag that a child of the window has
gained focus, and the window then does not hide.

I'm not seeing anything in the QTreeWidget or QTreeWidgetItem classes
that let me know that the edit operation is beginning (I know when it
has completed by itemChanged() signal) so that I can set internal flags
to maintain the focus of the main window.

Is this possible?  Or am I going to have to do my own QLineEdit over the
label just to be able to know when things are taking place?



More information about the Qt-interest-old mailing list