Results 1 to 5 of 5

Thread: Mutual position of the QRadioButton Indicator and text

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Mutual position of the QRadioButton Indicator and text

    Hello,

    Is it possible to style the QRadioButton (and maybe als the QCheckBox) so that the text can be on the left sight of the Indicator, or above it?

    Thx for your help.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Mutual position of the QRadioButton Indicator and text

    Yes, it is possible. One way which I could suggest right way is use QStyleSheet with somthing like this

    Qt Code:
    1. setStyleSheet(QString::fromUtf8("QCheckBox {\n"
    2. " width: 10px;\n"
    3. " spacing: -75px;\n"
    4. "}\n"
    5. "\n"
    6. "QCheckBox::indicator {\n"
    7. " subcontrol-origin: content;\n"
    8. " subcontrol-position: right top;\n"
    9. "}"));
    To copy to clipboard, switch view to plain text mode 

    " width: 10px;\n" - is required
    " spacing: -75px;\n" - does the magic, and "-75" should be dynamically calculated based on your text rending length on screen, (may you build this into the custom QCheckBox class)

Similar Threads

  1. change text color on QRadioButton
    By vonCZ in forum Newbie
    Replies: 4
    Last Post: 7th November 2012, 20:05
  2. Replies: 1
    Last Post: 12th April 2010, 10:44
  3. Button Text Position
    By Slewman in forum Qt Tools
    Replies: 1
    Last Post: 29th September 2009, 16:35
  4. mutual authentication
    By abeinoe in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2009, 06:22
  5. Position of text in a qlabel
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2008, 13:26

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.