Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. can i "stylesheet" the "QGroupBox" on windows to draw a darker outline?

can i "stylesheet" the "QGroupBox" on windows to draw a darker outline?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.7k 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
    davecotter
    wrote on last edited by
    #1

    it's so lite it's quite difficult to see:

    0_1561506576775_win.png

    JonBJ 1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #6

      that worked!

      1 Reply Last reply
      1
      • D davecotter

        it's so lite it's quite difficult to see:

        0_1561506576775_win.png

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

        @davecotter
        I don't know for sure, but https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qgroupbox shows e.g. QGroupBox {border: 2px solid gray;} so try playing with that?

        1 Reply Last reply
        5
        • Pradeep P NP Offline
          Pradeep P NP Offline
          Pradeep P N
          wrote on last edited by Pradeep P N
          #3

          Hi @davecotter

          Yes, Its possible.

          ui->groupBox->setStyleSheet("QGroupBox {"
                                      "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
                                      "border: 2px solid gray;"
                                      "border-radius: 5px;"
                                      "margin-top: 1ex;"
                                      "}");
          

          0_1561534523047_203d60c1-ecc9-479e-8762-4918ad7fd947-image.png

          All the best.

          Pradeep Nimbalkar.
          Upvote the answer(s) that helped you to solve the issue...
          Keep code clean.

          1 Reply Last reply
          5
          • D Offline
            D Offline
            davecotter
            wrote on last edited by
            #4

            using style sheet, i can't for the life of me get the "GroupBox" text to draw ABOVE the group box line, it's always INSIDE, obscuring the first thing inside the box.

            1 Reply Last reply
            0
            • Pradeep P NP Offline
              Pradeep P NP Offline
              Pradeep P N
              wrote on last edited by Pradeep P N
              #5

              Hi @davecotter

              Did you check the documentation link shared by @JonB

              Refer :

              • Customizing QGroupBox : QGroupBox::title { }

              Below is sample code & Output.

                  ui->groupBox->setStyleSheet("QGroupBox {"
                                              "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E0E0E0, stop: 1 #FFFFFF);"
                                              "border: 2px solid gray;"
                                              "border-radius: 5px;"
                                              "margin-top: 10ex;"
                                              "}"
                                              "QGroupBox::title {"
                                              "subcontrol-origin: margin;"
                                              "padding: 5 0px;"
                                              "}");
              

              0_1561694148595_6615e4f2-20f0-4ab0-bacf-b2998befd6e1-image.png

              All the best.

              Pradeep Nimbalkar.
              Upvote the answer(s) that helped you to solve the issue...
              Keep code clean.

              1 Reply Last reply
              5
              • D Offline
                D Offline
                davecotter
                wrote on last edited by
                #6

                that worked!

                1 Reply Last reply
                1

                • Login

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