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. How to modify font for title of QGroupBox?
Forum Updated to NodeBB v4.3 + New Features

How to modify font for title of QGroupBox?

Scheduled Pinned Locked Moved Solved Qt for Python
5 Posts 2 Posters 463 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    afernandezody
    wrote on last edited by afernandezody
    #1

    Hello,
    I have defined a QGroupBox

            progress_box = QGroupBox("PROGRESS")
            progress_box.setFont(QFont('Verdana', 16))
            progress_box.format("color:brown; font-weight:600;")
    

    This changes the font format for everything in the group but the target is to modify only the title. When I tried changing the second line to:

            progress_box.title.setFont(QFont('Verdana', 16))
    

    got an error message. I listed the methods associated to QGroupBox.title but didn't find what I was looking for.
    Is there any easy way to modify the title of a QGroupBox without touching anything else?
    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, QGroupBox does not have a format method. Are you thinking about style sheets ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        AFAIK, QGroupBox does not have a format method. Are you thinking about style sheets ?

        A Offline
        A Offline
        afernandezody
        wrote on last edited by
        #3

        @SGaist
        Just for clarification, the 'format' method was listed when I tried dir(progress_box.title) so it'd be associated with title not with QGroupBox per se. Anyway, I could use a stylesheet but my question would how to apply it only to the title and not to everything else in the QGroupBox.

        SGaistS 1 Reply Last reply
        0
        • A afernandezody

          @SGaist
          Just for clarification, the 'format' method was listed when I tried dir(progress_box.title) so it'd be associated with title not with QGroupBox per se. Anyway, I could use a stylesheet but my question would how to apply it only to the title and not to everything else in the QGroupBox.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The title property contains a string. It has nothing to do with the visual aspect of the QGroupBox.

          The link in my previous post shows how to modify a QGroupBox object with a dedicated stylesheet.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply
          1
          • A afernandezody has marked this topic as solved on
          • SGaistS SGaist

            The title property contains a string. It has nothing to do with the visual aspect of the QGroupBox.

            The link in my previous post shows how to modify a QGroupBox object with a dedicated stylesheet.

            A Offline
            A Offline
            afernandezody
            wrote on last edited by
            #5

            @SGaist
            Got it. Thanks!

            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