Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Stylesheet of QGroupBox does not work properly

Stylesheet of QGroupBox does not work properly

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 715 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deleted485
    wrote on last edited by
    #1

    Hello,
    I have some widgets (a 2x2 table and 2 labels) inside a QGroupBox. Everything works as expected. See Picture:
    bild_ohne_stylesheet.png
    But then I want to change the color of the border. I use

    groupbox.setStyleSheet("QGroupBox {border: 1px solid black;}")
    

    Which has the wanted effect of changing the color, but it also seems to mess up some margins or paddings. See picture:
    bild_mit_stylesheet.png

    So how do i change the border color/size/radius without touching the other parameters?
    And how do i change the title size without touching anything else?
    Or what are the parameters i need to change with that, to make it look like the first picture?

    Thanks in advance

    JonBJ 1 Reply Last reply
    0
    • D deleted485

      Hello,
      I have some widgets (a 2x2 table and 2 labels) inside a QGroupBox. Everything works as expected. See Picture:
      bild_ohne_stylesheet.png
      But then I want to change the color of the border. I use

      groupbox.setStyleSheet("QGroupBox {border: 1px solid black;}")
      

      Which has the wanted effect of changing the color, but it also seems to mess up some margins or paddings. See picture:
      bild_mit_stylesheet.png

      So how do i change the border color/size/radius without touching the other parameters?
      And how do i change the title size without touching anything else?
      Or what are the parameters i need to change with that, to make it look like the first picture?

      Thanks in advance

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Moesen said in Stylesheet of QGroupBox does not work properly:

      But then I want to change the color of the border.

      Then why not use border-color: black so as not to alter anything else like the border size?

      Also, you may get different effects (desirable or not) via groupbox.setStyleSheet("border-color: black;") without the QGroupBox?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved