Results 1 to 4 of 4

Thread: How to get mouse events(mouse release) on a pushbutton

  1. #1
    Join Date
    Jul 2011
    Posts
    81
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default How to get mouse events(mouse release) on a pushbutton

    How can i get mouse press & mouse release events on a qpush button.
    I can get mouse press event of a button by writing its slot. How can i get the mouse release event?? pls help



    My purpose is to provide a new cursor image to the cursor when a button is clicked.
    I have done it using its slot and restored back the default icon using a timer.


    the problem is when i press the mouse button for a long time without release the image will restore on the time out of timer.

    I tryed mouse press & mouse release event but it doesnot works for the pushbuttons but works on frames.

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get mouse events(mouse release) on a pushbutton

    QAbstractButton:ressed() and QAbstractButton::release() signals.
    Qt Code:
    1. connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(pressed()));
    2. connect(ui->pushButton, SIGNAL(released()), this, SLOT(released()));
    To copy to clipboard, switch view to plain text mode 
    have slots ...
    Qt Code:
    1. void MainWindow::pressed(){
    2. qDebug()<<"hi pressed";
    3. }
    4.  
    5. void MainWindow::released(){
    6. qDebug()<<"hi released";
    7. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2011
    Posts
    81
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Re: How to get mouse events(mouse release) on a pushbutton

    k fine.
    It works... is mouse events can be used

  4. #4
    Join Date
    Sep 2011
    Posts
    45
    Thanks
    17
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to get mouse events(mouse release) on a pushbutton

    Did you try to use an event filter for those purposes?
    Link

Similar Threads

  1. Mouse events
    By Maluko_Da_Tola in forum Newbie
    Replies: 3
    Last Post: 25th August 2010, 07:55
  2. QContextMenuEvent appear on mouse release
    By bucksey in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2009, 02:09
  3. Mouse Events
    By daviddoria in forum Qt Programming
    Replies: 6
    Last Post: 13th May 2008, 12:55
  4. mouse events
    By xyzt in forum Newbie
    Replies: 3
    Last Post: 23rd March 2008, 12:14
  5. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 07:13

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.