Important: Please read the Qt Code of Conduct -

QAction hover background

  • I have a QWidgetAction to which i have my custom widget added. I need to set background color to this widget when hovered. The background color should be similar to a QMenu/ QAction when hovered (Dependent on platform).

    This is what i have tried :
    QBrush brush = mycustomWidget->palette().brush(QPalette::Active, QPalette::Highlight);
    this->setStyleSheet(QString("MyCustomWidget:hover{background-color: %1;}").arg(highlightColor));

    But this highlight color is similar in both Windows 7 and Win 10. While the hover color of QMenu/QAction changes in Win7 and Win10.

    Thanks in advance

Log in to reply