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);
    brush.color().name(QColor::HexArgb);
    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.