Results 1 to 17 of 17

Thread: qpushbutton setfocus signal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: qpushbutton setfocus signal

    Then it may be appropriate to use an event handler for that purpose. Reimplement keyPressEvent(QKeyEvent *)

    The C++ version would look like this (both buttons must be implemented as members):
    Qt Code:
    1. void keyPressEvent(QKeyEvent* event)
    2. {
    3. if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
    4. if (testButton->hasFocus()) testButton->animateClick();
    5. if (emitButton->hasFocus()) emitButton->animateClick();
    6. }
    7. QDialog::keyPressEvent(event);
    8. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by momesana; 23rd November 2007 at 11:26. Reason: adding code

Similar Threads

  1. Replies: 2
    Last Post: 17th May 2006, 21:01
  2. no such signal QListBox::currentChanged()
    By jopie bakker in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 15:17
  3. Mouseover event on QPushButton
    By Twey in forum Newbie
    Replies: 2
    Last Post: 13th January 2006, 18:45

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
  •  
Qt is a trademark of The Qt Company.