⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Stylesheet :hover not working after frameless window drag&drop

  • Hi guys, I have a frameless window (with flags: Qt::FramelessWindowHint and Qt::WindowCloseButtonHint), and there are two buttons which are used as minimize button and close button.
    I set those two QPushButton stylesheet:

    QPushButton {
        border: none; outline: none;
        image: url(:/images/close_normal.png);
    QPushButton:hover {
        image: url(:/images/close_hover.png);
    QPushButton:pressed {
        image: url(:/images/close_pressed.png);

    When the window first pops up, everything worked fine, but after I move the window by dragging, the ':hover' style not working any more, and then I click the window, ':hover' worked fine again.
    So it's like the window's losing focus when I drag it, I don't know why this happening, any one could help?

    Platform: Archlinux KDE, Qt Version: 5.11.0

Log in to reply