QtTreePropertyBrowser / Getting mouse double click
-
Hi all,
I'm using a derived QtTreePropertyBrowser. After adding some property items I want to get a signal, when user does a double mouse click. However I do not get the event in mouseDoubleClickEvent in my derived QtMyTreePropertyBrowser. I've seen that the event goes into a QTreeView::mouseDoubleClickEvent. QTreeView is created in the constructor of QtTreePropertyBrowser. In QTreeView::mouse... I see that there is information about row and column of the item double clicked (QPersistentModelIndex) and there is also an emit doubleClicked(persistent), but I do not know how to get this event in my app.
Anybody here how can help?
Regards
-
Hi and welcome to devnet,
Which base version are you using for your class ?
What do you want to do with that double click event ? -
Hi SGaist,
thanks for answering. I did not expect to get an answer from a Champion. Thanks for the welcome.
I'm using the sample 'decoration', which is part of Qt source code. There exists a class QtTreePropertyBrowser, which I derived to get signals, and so on.
The property I want to create has got two functionalities. First is a value from 0...100. Second is on/off. A doubleclick should switch the state on/off, while the 0..100 value controls intensity of a light source.
With MFC on windows (sorry for that, but this is my current root...) I've created this kind of control already:
Probably I have to split up the functionality into subitems. However this seems to be less user friendly.
Regards
-
This is where the doubleclick hits:
I would also like to know what this emit doubleClick(persistent) does and where I can get it in my app. persistent is related to row/column and thus the item created. -
This is where the doubleclick hits:
I would also like to know what this emit doubleClick(persistent) does and where I can get it in my app. persistent is related to row/column and thus the item created.@excelitas_pco said in QtTreePropertyBrowser / Getting mouse double click:
I would also like to know what this emit doubleClick(persistent) does
It emits signal doubleClick(...).
You can connect a slot to it.
If you're not familiar with signals/slots then you really should read about them, else you will not be able to use Qt. -
@jsulm: Signal/Slot is known.
If you talk about this:
void mouseDoubleClickEvent(QMouseEvent* event) override;
It is not hit!The initial mouse double click hits QTreeView and not the widget I've derived from QtTreePropertyBrowser.
QtTreePropertyBrowser internally creates QTreeView. There's no access for me, as far as I can see.See callstack:
Regards
-
@jsulm: Signal/Slot is known.
If you talk about this:
void mouseDoubleClickEvent(QMouseEvent* event) override;
It is not hit!The initial mouse double click hits QTreeView and not the widget I've derived from QtTreePropertyBrowser.
QtTreePropertyBrowser internally creates QTreeView. There's no access for me, as far as I can see.See callstack:
Regards
Hi,
do you inherit from
QtTreePropertyBrowserPrivate
directly?
Might not be the best idea, since your widget depends on that specific Qt version as the internal Qt code may change just like that. Then your widget does not work anymore.The initial mouse double click hits QTreeView and not the widget I've derived from QtTreePropertyBrowser.
Events always start at the innermost child widget at that position and then go bottom-up to the topmost.
Probably theQTreeView
"eats"/accepts the event, so the propagation ends there.If your code was "inpired" by the Qt source you can fix that,
if you inherit the Qt private classes directly, you cannot.