Results 1 to 8 of 8

Thread: check box and signal

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: check box and signal

    Is it possible to change checked window's contens (caption and icon) regarding to this button check state? I mean, how do I rewrite non virtual slot to do this?
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    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: check box and signal

    Quote Originally Posted by MarkoSan View Post
    Is it possible to change checked window's contens (caption and icon) regarding to this button check state? I mean, how do I rewrite non virtual slot to do this?
    Could you elaborate a bit? What is a checked window? What non-virtual slot?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: check box and signal

    Ok, here we go:

    The checked button term is used in qt QPushButton documentation and it refers to a button, which supports toggle button. And here is my problem, since i do not know how to make a code that will:

    1) in button state ON set a predefined text and icon
    2) in button state OFF set a different predefined text and icon
    Qt 5.3 Opensource & Creator 3.1.2

  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: check box and signal

    Construct a QIcon with two pixmaps, one for each state. To update button text, you can simply connect to toggled(bool) signal and set the button text in the corresponding slot, or you can reimplement for example QAbstractButton::checkStateSet() and change the button text there.
    J-P Nurmi

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.