Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt - Stylesheet for custom button on mouse hovered and clicked

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.

like image 359
Alex Spataru Avatar asked Sep 06 '12 03:09

Alex Spataru


1 Answers

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;}");
like image 190
Magical Avatar answered Jan 05 '23 02:01

Magical