Results 1 to 4 of 4

Thread: Default stylesheet of QGroupBox

  1. #1
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Default stylesheet of QGroupBox

    Hello,

    I have a QGroupBox with two QComboBoxes and three QPushButtons.

    If no selection is made in either one of the checkboxes I want the border of the groupbox to be red. So I used stylesheets.

    But not knowing the default stylesheet of the QGroupBox I can not get it the same size / margins / padding.

    Has anyone an idea how to get the correct stylesheet code?

    Qt Code:
    1. m_groupBox->setStyleSheet(QString::fromUtf8("QGroupBox { border: 1px solid red; border-radius: 5px; margin-top: 7px; margin-bottom: 7px; padding: 0px} QGroupBox::title {top:-7 ex;left: 10px; subcontrol-origin: border}"));
    To copy to clipboard, switch view to plain text mode 

    Regards,

    Marcel
    Attached Images Attached Images

  2. #2
    Join Date
    Nov 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Default stylesheet of QGroupBox

    I'm having the same question. How to get the default stylesheet of a widget? styleSheet() always returns empty string if was not set in application before.

    I particularly have problem with styling QCheckbox. I tried to change size of the indicator of a checkbox by
    my_checkbox->setStyleSheet("QCheckBox::indicator {width: 30px; height: 30px;}");

    I compile my app with Qt 4.3. In PC the result is like expected. But when my same application runs with same lib compiled for ARM, only the rectagle box changes size, the indicator mark still remains its default size (when no setStyleSheet called) and stays at the top left corner of the box. Has anybody experienced with this?

    My one hope is to get the default stylesheet of the checkbox, then see what to change in there ...

    Help would be very much appreciated!

  3. #3
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: Default stylesheet of QGroupBox

    I contacted QT/Nokia en got an answer:

    When the application is started normally it has no stylesheet; All elements are drawn by Windows/Mac etc and not by QT. By using stylesheets QT starts to paint the elements. I got an almost working red border of the groupbox that can switch back to normal but there is a small layout issue.

    It would be very convenient if there was a simple application to create stylesheets for applications.

    It would be more convenient if QT/Nokia would supply default stylesheets for whole applications. Thus for example the basic Windows 7 theme in a stylesheet.

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

    Default Re: Default stylesheet of QGroupBox

    Quote Originally Posted by mstegehu View Post
    It would be very convenient if there was a simple application to create stylesheets for applications.
    Designer has stylesheet editing support.

    It would be more convenient if QT/Nokia would supply default stylesheets for whole applications. Thus for example the basic Windows 7 theme in a stylesheet.
    You can't emulate the exact look of native widgets without just substituting the background of a widget with an image so this is not possible, you are expecting too much.
    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. Replies: 7
    Last Post: 12th January 2011, 22:01
  2. QGroupBox stylesheet
    By GuS in forum Qt Programming
    Replies: 2
    Last Post: 16th December 2010, 06:26
  3. Tab order ignored in QGroupBox
    By adskol in forum Newbie
    Replies: 2
    Last Post: 5th April 2010, 05:42
  4. QGroupBox
    By Devoraz in forum Newbie
    Replies: 1
    Last Post: 30th July 2009, 04:49
  5. QGroupBox
    By merry in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2007, 13:11

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.