Qt - Stylesheet for custom button on mouse hovered

2019-03-19 08:49发布

I would like to have an invisible button, but when the user hovers the mouse on it, I would like to have a light blue color, and when he clicks it, I would like to have a darker blue.

After I did some research, I figured out I can use the stylesheets feature, but im new on Qt and I don't have any experience on Qt, so I would prefer to ask and learn.

1条回答
SAY GOODBYE
2楼-- · 2019-03-19 09:18
yourBtn->setStyleSheet("QPushButton{background:url(:/Resources/pause_nor.png);border:0px;}"
    "QPushButton:hover{background:url(:/Resources/pause_over.png);border:0px}"
    "QPushButton:pressed{background:url(:/Resources/pause_over.png); position: relative;top: 1px; left: 1px;}");
查看更多
登录 后发表回答