Results 1 to 6 of 6

Thread: Capture all button clicked from a widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Capture all button clicked from a widget

    For every created button do :
    Qt Code:
    1. QPushButton *b1 = new QPushButton( "A", this );
    2. connect( b1, SIGNAL(clicked()), sm, SLOT(map()) );
    3. connect( b1,SIGNAL(released()),&m_timer ,SLOT(start()));
    To copy to clipboard, switch view to plain text mode 
    where m_timer is a QTimer hiding the keyboard after 50 seconds.

  2. #2
    Join Date
    Sep 2011
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Capture all button clicked from a widget

    Lesiok, following your advice I've solved the problem with a elegant code form,I guess there will be better but...

    Qt Code:
    1. foreach(QPushButton *obj, this->findChildren<QPushButton *>())
    2. {
    3. qDebug()<<"obj -> "<<obj->objectName();
    4. connect(obj,SIGNAL(clicked()),&tmr,SLOT(start()));
    5. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QtableView clicked() left or right button?
    By qlands in forum Qt Programming
    Replies: 5
    Last Post: 27th August 2011, 09:54
  2. How can find which button is clicked.
    By Niamita in forum Qt Programming
    Replies: 5
    Last Post: 27th June 2011, 14:35
  3. Replies: 4
    Last Post: 29th April 2011, 09:42
  4. How to get the clicked button handle?
    By Gokulnathvc in forum Newbie
    Replies: 1
    Last Post: 27th April 2011, 08:06
  5. How to capture right clicked dates in a QCalendarWidget?
    By balazsbela in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2010, 13:36

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.