Solved How to change the display of the button when pressed?
-
Hi.
How to change the display of the button when pressed?
Initially set the button style:ui->register_Button->setStyleSheet(QString::fromUtf8("background-color: rgb(43, 104, 255); color:white; border: 3px solid white; padding: 5px; border-radius: 10px;"));
When pressed on the signal, the pressed () set the change button
ui->register_Button->setStyleSheet(QString::fromUtf8("background-color: rgb(0, 209, 202); color:white; border: 3px solid white; padding: 5px; border-radius: 10px;"));
How to return the button to its original state after moving the mouse to another place or after the button is triggered?
-
QPushButton comes with a pressed state for your stylesheet ->
ui->register_Button->setStyleSheet("QPushButton{background-color: rgb(43, 104, 255); color:white; border: 3px solid white; padding: 5px; border-radius: 10px;} QPushButton:pressed{background-color: rgb(0, 209, 202); color:white; border: 3px solid white; padding: 5px; border-radius: 10px;}");