Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Color and Icon
Qt 6.12 LTS is out! See what's new in the release blog

Color and Icon

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 7.1k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi Everybody...Am here for a help regarding color and icon set-up for the widgets.
    Let me know if someone know how to change the color,shape and font of the main window and its child window?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      For the first two: search Assistant for "palette" and "font" properties (hint: there is a tab called "index"). You will see from QMainWidget's API docs which one is the parent widget.

      The shape is always a rectangle.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        You might use a mask on the widget to influence the shape.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @Volker: I read those documents but not clear.
          @Andre: How could I proceed with a mask?

          [EDIT: fixed @-chars, Volker]

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            You can set colors in the palette and the fonts in font.

            If you do not understand something, then please ask more precisely.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              [quote author="Revu" date="1298634031"]@Andre: How could I proceed with a mask?[/quote]

              What part of the documentation (you did read the documentation on it, didn't you?) isn't clear to you?

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                Sorry for the trouble.
                I read about Palette.I tried to change the background color of the pushbutton.
                How to change the background color of the frame and the color of the fonts on the button?

                Thank You

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #8

                  Have you really read the doc for the "QPalette":http://doc.qt.nokia.com/4.7/qpalette.html ?

                  @
                  QPushButton* p = ...

                  QPalette pal = p->palette();
                  QColor myTextColor = Qt::red;
                  QColor myButtonBackground = Qt::green;
                  
                  pal.setColor(QPalette::ButtonText, myTextColor); // set the text color of a button
                  pal.setColor(QPalette::Button, myButtonBackground); // set the text color of a button
                  
                  p->setPalette(pal);
                  

                  @

                  The roles are also described in the "documentation":http://doc.qt.nokia.com/4.7/qpalette.html#ColorRole-enum

                  For changing the button border 3-d effects, use

                  • QPalette::Light
                  • QPalette::Midlight
                  • QPalette::Dark
                  • QPalette::Mid
                  • QPalette::Shadow

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    @Geroif:
                    Yes I had read and changed the color of the button.Anyway thank you for that piece of code.

                    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
                    • Unsolved