Results 1 to 20 of 24

Thread: QPushButton Checked Change

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default QPushButton Checked Change

    Hi there,

    I'm using QPushButton like a checkbox , so is there any event about Checked state changed in QPushButton thanks for your help.

  2. #2
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 13 Times in 12 Posts

    Default Re: QPushButton Checked Change

    QPushButton::ischecked() function

  3. #3
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPushButton Checked Change

    isChecked() returns checked state of QPushButton. I wanna catch event everytime changed state of qpushbutton like checkboxs stateChanged(int ) event. thanks ...

  4. #4
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    24
    Thanked 6 Times in 6 Posts

    Default Re: QPushButton Checked Change

    Hm... was looking through documentation found something called QWidget::changeEvent...

  5. #5
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPushButton Checked Change

    thx Archa4 but it's not for checked stateChanged ...

  6. #6
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 14 Times in 14 Posts

    Default Re: QPushButton Checked Change


  7. #7
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPushButton Checked Change

    Thanks Rhayader , I just override void QAbstractButton::toggled ( bool checked ) [signal] but it doesn't work, btw my buttons in QButtonGroup , but as document said it works in QButtonGroup but doesn't work as i said ...

  8. #8
    Join Date
    Aug 2009
    Location
    Greece
    Posts
    69
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 14 Times in 14 Posts

    Default Re: QPushButton Checked Change

    You don't need to override the signal. It's a signal. Connect it to a Slot.

  9. #9
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 13 Times in 12 Posts

    Default Re: QPushButton Checked Change

    http://www.qtcentre.org/faq.php?faq=qt_signalslot........... I think this will help you

  10. #10
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPushButton Checked Change

    i need to override for check something then i emit signal. samething actually (;, still doesn't work btw ...

    edit : I typed mistakely slot there ! so this is my mistake many people confused then
    Last edited by nightroad; 21st March 2011 at 11:05.

  11. #11
    Join Date
    Nov 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: QPushButton Checked Change

    You don't emit a slot.

    Connect the toggled signal to a slot and then check what you have to check ?

  12. #12
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    10
    Thanked 13 Times in 12 Posts

    Default Re: QPushButton Checked Change

    Then include your codes in the another function and call Q_Emit, it will trigger it

  13. #13
    Join Date
    Sep 2010
    Posts
    46
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: QPushButton Checked Change

    @ wysota i typed something wrong
    Quote Originally Posted by nightroad View Post
    i need to override for check something then i emit signal. samething actually (;, still doesn't work btw ...

    edit : I typed mistakely slot there ! so this is my mistake many people confused then

Similar Threads

  1. Change Opacity of QPushButton
    By DiamonDogX in forum Qt Programming
    Replies: 3
    Last Post: 5th November 2010, 13:09
  2. How to show QPushButton as flat when it is checked
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2010, 11:07
  3. Change text in QPushButton?
    By bizmopeen in forum Newbie
    Replies: 4
    Last Post: 10th February 2010, 23:25
  4. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 08:14
  5. How to change color of a QPushButton?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2008, 14:22

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.