How to add red color icon to Status of Mainwindow
-
How to add red color icon to Status of Mainwindow
if (condition)
add red color icon to status bar
ele
add green color icon to status barcan someone help me to write code for it
-
@Qt-Enthusiast
You can use a QLabel with stylesheet or red pixmap and use
http://doc.qt.io/qt-5/qstatusbar.html#addWidget -
how to edit it to Green color
-
I do not have eqrc
-
@Qt-Enthusiast
You mean change from red to green? -
yes and how to create the icon small circile when I do not qrc
-
@Qt-Enthusiast
you get get red box with
QPixmap pix(32,32);
pix.fill(Qt::red);
ui->label->setPixmap(pix);and if u hold on to the label pinter u can at any time create new
and set the pixmap again. -
Hi,
To change to green.red without resource.
```
label->setFixedSize(20,20); // Make a square label, radius is half of this sizeif (yes) { label->setStyleSheet("background-color: green; border-radius: 10px;"); // Change radius according to ur label size } else { label->setStyleSheet("background-color: red; border-radius: 10px;"); }