Results 1 to 5 of 5

Thread: Simple click detection on QTextBroxser

  1. #1
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default 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...

    Have you got an idea ?
    Thanks

  2. #2
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

    I'll try, and I'll seethe result

  4. #4
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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.

  5. #5
    Join Date
    Feb 2007
    Posts
    158
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Simple click detection on QTextBroxser

    Oh yes... Thanks
    That's seems to be exactly what I need !

    And... I'm french too ^_^

Similar Threads

  1. QGraphicsScene Click / Double Click
    By philentropist in forum Qt Programming
    Replies: 1
    Last Post: 9th February 2007, 04:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.