[SOLVED] Editing QGroupBox border



  • At the moment I'm using QFrame to enclose some of my widgets. I want to change it to QGroupBox. However, I don't see any border control options here like in QFrame (frameShape and frameShadow). How do I change border options for QGroupBox?


  • Lifetime Qt Champion

    Hi,

    You have to use Qt's style sheet for that. See here for an example.

    Hope it helps



  • Yeah, I've just discovered style sheets, but I can't seem to get them to work. It shows in Qt Creator but once app is compiled no style sheet changes are applied.

    This is just a test:

    #MainWindow {
    background: yellow;
    }
    
    #centralWidget {
    border: 3px solid gray;
    border-radius: 40px;
    background: yellow;
    }
    

    In Qt creator in the top right corner I go to MainWindow, right click on it, use change stylesheet. A window pops up, I write code in it, hit "apply". Shows in Qt creator, doesn't show when I compile.


  • Lifetime Qt Champion

    Do you mean that your widgets don't use the style sheet ?



  • Yes, I see my style sheet changes only in Qt creator design mode, but once application is compiled I do not see any changes.



  • I've fixed it. I've included a separate .qss file instead of working with style sheets from design mode. Using designer in Qt creator to implement style sheets seems to be extremely buggy to the point that I had to restore my form file from previous build.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.