Problems with Open-Source Downloads read and

Color and Icon

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

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

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

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

    [EDIT: fixed @-chars, Volker]

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

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

  • [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?

  • 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

  • Have you really read the doc for the "QPalette": ?

    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


    The roles are also described in the "documentation":

    For changing the button border 3-d effects, use

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

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

Log in to reply