Skip to content
QtWS25 Call for Papers
  • Understanding QPalette

    Solved General and Desktop
    7
    0 Votes
    7 Posts
    942 Views
    Axel SpoerlA

    @tim-hilt Can you describe verbally which palette should be changed? The application palette? A specific widget’s palette? Something else? We’ll find it out!

  • 0 Votes
    3 Posts
    1k Views
    G

    @Gojir4 said in Styling the QMdiArea using the the fusion style and QPalette (dark theme):

    darkPalette.setColor(QPalette::Disabled, QPalette::Shadow, QColor(r, g, b));

    (Edited)
    tried, but it didn't work. I suspect that underneath it's a QLabel with a raised text but I don't know how to set the color of those using QPalette

  • 0 Votes
    2 Posts
    2k Views
    A

    It is not clear what you want to do.

    If you have a few buttons with different background color and connected signal clicked to slo6t lets day onClick();

    and within such slot you want to find color of the button background which was clicked,
    first thing you need to find - which button was clicked.

    There are a few ways to find it.
    Simplest (not the best) is to call sender() within a slot.
    Cast ( use qobject_cast) to a QPushButton* ( or whatever your buttons are ),
    check its background if it is null.

    Why this way is not the best? It makes an assumption that slot is only called as a result of button click,
    which can't be guaranteed.

    It is better to use QSignalMapper.