Results 1 to 6 of 6

Thread: How can i get QAction or QPushButton name

  1. #1
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How can i get QAction or QPushButton name

    I have a QDialog ,and I add three QWidget to the QDialog,
    and I add some QPushButton and QAction to the QWidget,
    now I want to get the name of QPushButton where the mouse curser is.
    I used childeAt(event->pos()) at mouseMoveEvent(),But i just get the QWidget name ,i can't get the name of the QPushwButton.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can i get QAction or QPushButton name

    Cast the childAt widget into QPushButton and see if u get the proper name.
    What are u trying to achieve by the way, and can u share some code of what u have tried ?

  3. #3
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How can i get QAction or QPushButton name

    Thank you !
    I want to know the button name and set the button setChecked(true) whick is under the pos()

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can i get QAction or QPushButton name

    Doesn't the button handle press/release events out of the box? It toggles between checked and unchecked if you make it checkable... Why do you want the dialog to handle that?
    J-P Nurmi

  5. #5
    Join Date
    Apr 2008
    Posts
    41
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How can i get QAction or QPushButton name

    I want the button is setChecked(true) when the button under the mouse,
    and setChecked(false) when the mouse out side the button.

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can i get QAction or QPushButton name

    And what do u want to do when the button is checked ??
    You may better look at QWidget::enterEvent and QWidget::leaveEvent

Similar Threads

  1. Adding Image to QPushButton
    By Seema Rao in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2011, 09:06
  2. uic3 QAction problem
    By batileon in forum Qt Programming
    Replies: 0
    Last Post: 16th June 2008, 10:35
  3. Changing QPushButton text colour with mouseMoveEvent
    By Misenko in forum Qt Programming
    Replies: 1
    Last Post: 10th June 2008, 16:53
  4. QPushButton QMenu QAction
    By hgedek in forum Newbie
    Replies: 2
    Last Post: 1st November 2007, 12:29
  5. Replies: 1
    Last Post: 18th March 2006, 16:37

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.