Simple click detection on QTextBroxser
Hello,
I've a very simple QDialog that holds only a QTextBrowser, in order to simulate the bubbles of my TrayIcon (Cause the showMessage() function of the QSystemTrayIcon shows nothing on Win2000 ;)).
I would like to detect when the user click the QTextBrowser, but I've seen no signals to listen.
I'm not sure this is possible... :confused:
Have you got an idea ?
Thanks :)
Re: Simple click detection on QTextBroxser
Hello,
QTextBrowser inherits QTextEdit, QTextEdit inherits QScrollView, QScrollView inherits from QFrame, QFrame inherits QWidget. All those class have usefull signals you can use:
- From QTextEdit, there is a signal named clicked from, another signal named doubleClicked.
- Also, if you dont want to use signal, you can implement QTextBrowser to your own class and inside use contentsMouseDoubleClickEvent(), contentsMouseMoveEvent(), contentsMousePressEvent(), contentsMouseReleaseEvent(). In your custom class you can overide those methods.
Hope this will help ^^
Pierre.
Re: Simple click detection on QTextBroxser
Thanks Pierre :)
I want to use my own class implementation, in effectly.
But, when I have a look to this page, Trolltech doesn't tell about the "clicked" signal :eek:
I'll try, and I'll seethe result :)
Re: Simple click detection on QTextBroxser
Hello again Nyphel (I guess we're both french ^^),
When you are at this page you told me, click on the "List of all members, including inherited members" link. It will lead there.
There you can see all events related to the object you're implementing, and one of them is mousePressEvent, another helpfull is mouseReleaseEvent. i believe with some workaround, you can use them to achieve what you're doing ^^ I'm not sure on how mouseReleaseEvent will behave, but probably as soon as the user releases his mouse button, the event is triggered. What you will have to see is, if the event is triggered if the mouse is still over the widget.
Pierre.
Re: Simple click detection on QTextBroxser
Oh yes... Thanks :)
That's seems to be exactly what I need !
And... I'm french too ^_^