So basically, I have a QToolButton filled with a large icon of a playing card, and I want to overlay a QProgressBar over it.
Unfortunately I for the life of me, can not figure out how to make the QProgressbar Semi Transparent. I tried setstylesheet, but it doesnt have the proper constructors(?did I use that term right?), and I also tried this code:
#include <QApplication>
#include <QProgressBar>
int main(int argc, char *argv[])
{
palette.setColor(widget->backgroundRole(), Qt::green);
widget->setAutoFillBackground(true);
widget->setPalette(palette);
palette1.setColor(progress->backgroundRole(), Qt::transparent);
progress->setAutoFillBackground(true);
progress->setPalette(palette1);
widget->show();
return a.exec();
}
#include <QApplication>
#include <QProgressBar>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *widget = new QWidget();
QProgressBar *progress = new QProgressBar(widget);
QPalette palette(widget->palette());
palette.setColor(widget->backgroundRole(), Qt::green);
widget->setAutoFillBackground(true);
widget->setPalette(palette);
QPalette palette1(progress->palette());
palette1.setColor(progress->backgroundRole(), Qt::transparent);
progress->setAutoFillBackground(true);
progress->setPalette(palette1);
widget->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
as someone in #qt said they got it working... I can get it to work on certain objects, but not QProgressbar.
Any ideas?
Bookmarks