Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QPushButton setForeGroundRole



  • I have a push button that I want the test rendered in the Link colour.

    So I did:

    ui->testCosmetic->setForegroundRole(QPalette::Link);
    

    but the text colour stubbornly remained grey. Is this a bug or am I doing this wrong?

    David



  • @Perdrix
    The styles don't have to call foregroundRole() to determine the text color role, so setForegroundRole may not always be effective.
    From the doc:

    Note that styles are free to choose any color from the palette. You can modify the palette or set a style sheet if you don't achieve the result you want with setForegroundRole().


Log in to reply