Results 1 to 12 of 12

Thread: how to resize the square of a qcheckbox?

  1. #1
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default how to resize the square of a qcheckbox?

    i want my app to have a few checkboxes with a size of 12x12... but i cannot manage to get the check box to go under 16x16...

    how can you do that?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    Reimplement QStyle::pixelMetric() for QStyle::PM_IndicatorWidth and QStyle::PM_IndicatorHeight.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: how to resize the square of a qcheckbox?

    yes this works,

    but i do not want all my checkboxes all over my application to be resized i just want them to be resized just inside a couple of dialogs...

    what should i do in this case?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    Apply your style only on those checkboxes you want modified. Or subclass QCheckBox and draw the indicators yourself, of course.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: how to resize the square of a qcheckbox?

    so my question is how do you restrict a style to a checkbox or else, i have no clue how to do that.. i have it to work for the whole app

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: how to resize the square of a qcheckbox?

    i am still fighting with that... as a style applied to a widget i do not get it to resize like whenthe style is global... i have no clue why... also it is a pretty heavy implementation even if it works

    i am trying also as a style sheet which is the way i would much more prefer (!) with indicator-height : 12 px, just within qt-designer, but it does not resize either, is there anything else i can try or i need to add

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    What does not resize?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: how to resize the square of a qcheckbox?

    the little square of the checkbox, or if it is a radio button , the circle of the radio button.. they seem not to be able to change size at all

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    Can you prepare a minimal compilable example reproducing the problem? I mean the one when using QWidget::setStyle() doesn't yield the desired effect.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Aug 2009
    Posts
    81
    Platforms
    MacOS X Windows

    Default Re: how to resize the square of a qcheckbox?

    to a QCheckbox, i use designer... right click, style sheet, i add...

    QCheckBox::indicator {
    width: 10px;
    height: 10px;
    }

    this does not resize the checkbox square in Mac Aqua style, it works in Plastique mode

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: how to resize the square of a qcheckbox?

    I meant using QWidget::setStyle()... Most stylesheets in general won't work with Aqua style.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Disable resize events
    By myrky in forum Qt Programming
    Replies: 7
    Last Post: 26th June 2009, 12:49
  2. Replies: 2
    Last Post: 22nd January 2008, 16:10
  3. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 07:00
  4. Replies: 8
    Last Post: 2nd August 2006, 16:19
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00:32

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.