Does this work?
#include <QApplication>
#include <QFrame>
#include <QWidget>
#include <QLayout>
int main(int argc, char **argv){
p.
setColor(QPalette::Button, Qt
::green);
f->setPalette(p);
f->setAutoFillBackground(true);
l->addWidget(f);
wgt.show();
wgt.resize(300, 200);
return app.exec();
}
#include <QApplication>
#include <QFrame>
#include <QWidget>
#include <QLayout>
int main(int argc, char **argv){
QApplication app(argc, argv);
QWidget wgt;
QHBoxLayout *l = new QHBoxLayout(&wgt);
QFrame *f = new QFrame;
QPalette p = f->palette();
p.setColor(QPalette::Window, Qt::red);
p.setColor(QPalette::Base, Qt::blue);
p.setColor(QPalette::Button, Qt::green);
f->setPalette(p);
f->setAutoFillBackground(true);
l->addWidget(f);
wgt.show();
wgt.resize(300, 200);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Which style do you use for your applications? I checked the above code with Plastique and Cleanlooks and they both worked fine (red frame background).
Bookmarks