Qt - Stylesheet for custom button on mouse hovered and clicked

13,152
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;}");
Share:
13,152

Related videos on Youtube

Alex Spataru
Author by

Alex Spataru

Engineering student, among other things, he likes coffee, open-source and hardware prototyping.

Updated on September 27, 2022

Comments

  • Alex Spataru
    Alex Spataru over 1 year

    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.