Results 1 to 3 of 3

Thread: How to emit mouse press event in QPushButton

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to emit mouse press event in QPushButton

    Hi,

    I want to send pressed() event to an object of subclass of QPushButton. How can I do that. I see 'emit' keyword to emit signals, but I am not sure how to user that.
    Can someone please explain me.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to emit mouse press event in QPushButton

    Are you talking about events, or signals?
    signals are emitted with emit, events is a bit more complicated issue, which usually you don't need.
    Have a look at this:
    http://doc.qt.nokia.com/latest/signalsandslots.html
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    dpatel (31st December 2010)

  4. #3
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to emit mouse press event in QPushButton

    Quote Originally Posted by dpatel View Post
    Hi,

    I want to send pressed() event to an object of subclass of QPushButton. How can I do that. I see 'emit' keyword to emit signals, but I am not sure how to user that.
    Can someone please explain me.

    Thanks
    I think what you might want is to call "click()" on the button, if what you're trying to do is "press" the button from another class or something.
    This rude guy who doesn't want you to answer his questions.

    Note: An "expert" here is just someone that's posted a lot.

    "The fact of where you do the encapsulation is meaningless." - Qt Certified Developer and forum moderator

  5. The following user says thank you to nroberts for this useful post:

    Cupidvogel (14th February 2016)

Similar Threads

  1. QGraphicsview and mouse press event
    By eva2002 in forum Qt Programming
    Replies: 6
    Last Post: 26th January 2010, 05:04
  2. Mouse hovering or press event not working?
    By qtzcute in forum Newbie
    Replies: 11
    Last Post: 15th July 2009, 10:53
  3. Mouse press event in a QGraphicsScene
    By Lykurg in forum Qt Programming
    Replies: 3
    Last Post: 19th June 2009, 10:28
  4. Mouse press event detection
    By A.H.M. Mahfuzur Rahman in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2009, 13:08
  5. Checking for key press on mouse event
    By Cruz in forum Newbie
    Replies: 1
    Last Post: 24th January 2009, 18:18

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.