Originally Posted by
jlgerber
Eh? I am talking about the frame itself. It is a QGroupBox (creates a frame and label around other widgets).
OK, so we are talking about the frame in sense of a line, not in sense of QFrame.
Originally Posted by
jlgerber
And the problem isnt that i cannot see it; the problem is that it does not respond to changes in the application palette, like every other widget in the program.
Consider this program:
#include <QApplication>
#include <QGroupBox>
#include <QLayout>
#include <QPalette>
#include <QPushButton>
{
Q_OBJECT
public:
{
connect( b, SIGNAL( clicked() ), this, SLOT( changePalette() ) );
l->addWidget( b );
setLayout( l );
}
private slots:
void changePalette()
{
update();
}
};
int main( int argc, char **argv )
{
Test t;
t.show();
return app.exec();
}
#include "main.moc"
#include <QApplication>
#include <QGroupBox>
#include <QLayout>
#include <QPalette>
#include <QPushButton>
class Test : public QGroupBox
{
Q_OBJECT
public:
Test() : QGroupBox( "test" )
{
QPushButton *b = new QPushButton( "change" );
connect( b, SIGNAL( clicked() ), this, SLOT( changePalette() ) );
QVBoxLayout *l = new QVBoxLayout();
l->addWidget( b );
setLayout( l );
}
private slots:
void changePalette()
{
QPalette p;
p.setColor( QPalette::Dark, Qt::red );
QApplication::setPalette( p );
update();
}
};
int main( int argc, char **argv )
{
QApplication app( argc, argv );
Test t;
t.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
I've attached two screenshots showing group box with original palette and the same group box after the QApplication palette was changed.
Note that some styles (in this case Plastique) sometimes ignore QPalette settings, so I had to use windows style.
Bookmarks