int main(int argc, char *argv[])
{
//Set up the QLCDNumber
lcdNumber->display(123);
//A palette with crazy colors to help see what's going on
//Setting the background to Qt::transpatent here didn't seem to help
QPalette palette
= lcdNumber
->palette
();
lcdNumber->setPalette(palette);
//The following code should supress the background?
//Also tried setAutoFillBackground instead of Qt::WA_OpaquePaintEvent
//lcdNumber->setAutoFillBackground(true);
lcdNumber->setAttribute(Qt::WA_OpaquePaintEvent, true);
lcdNumber->setAttribute(Qt::WA_NoBackground, true);
lcdNumber->setAttribute(Qt::WA_NoSystemBackground, true);
//Show the widget
lcdNumber->show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//Set up the QLCDNumber
QLCDNumber* lcdNumber = new QLCDNumber(3,0);
lcdNumber->display(123);
lcdNumber->setSegmentStyle(QLCDNumber::Flat);
//A palette with crazy colors to help see what's going on
//Setting the background to Qt::transpatent here didn't seem to help
QPalette palette = lcdNumber->palette();
palette.setColor(QPalette::Active, QPalette::WindowText, Qt::green);
palette.setColor(QPalette::Active, QPalette::Window, Qt::red);
palette.setColor(QPalette::Inactive, QPalette::WindowText, Qt::blue);
palette.setColor(QPalette::Inactive, QPalette::Window, Qt::yellow);
lcdNumber->setPalette(palette);
//The following code should supress the background?
//Also tried setAutoFillBackground instead of Qt::WA_OpaquePaintEvent
//lcdNumber->setAutoFillBackground(true);
lcdNumber->setAttribute(Qt::WA_OpaquePaintEvent, true);
lcdNumber->setAttribute(Qt::WA_NoBackground, true);
lcdNumber->setAttribute(Qt::WA_NoSystemBackground, true);
//Show the widget
lcdNumber->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks