georgie
1st May 2006, 01:55
ok - I am struggling a bit with my styles......
I want to have a uniform style for the whole application, and then I want to be able to make a couple of the key widgets stand out by changing them to a second style....
basically what I do is
int main(int argc, char*[] argv)
{
QApplication app(argc, argv);
app.QApplication::setStyle(new TopLayoutStyle);
.....
MyTabWidget* topRight = new MyTabWidget();
MyQPalette* palette = topRight->getPalette();
palette->changeColour();
topRight->QWidget::setPalette(bottomColours);
.......
}
MyQPalette::changeColour()
{
QColor greenShadow(98, 161, 98);
QColor green(112, 181, 112);
QColor greenLight(116, 195, 116);
QColor greenMid(95,135,95);
QColor greenForeground(167, 210, 183, 63);
QColor greenDark(80, 140, 80);
QColor midYellow(255, 235, 0);
this->setBrush(QPalette::BrightText,greenForeground);
this->setBrush(QPalette::Base, green);
this->setBrush(QPalette::Highlight, greenForeground);
this->setBrush(QPalette::Background, green);
this->setBrush(QPalette::Light, greenLight);
this->setBrush(QPalette::Mid, greenMid);
this->setBrush(QPalette::Dark, greenDark);
this->setBrush(QPalette::Button, green);
this->setBrush(QPalette::Window, green);
}
now for the most part this is cool, all the buttons/outlines etc change on the tabs widget which I want to stand out....only prob is that the background does not change colour even though everything else does
i've attached a screen shot
I can't work out why the background of the tab widget appears to be filled with the background of the application instead of its own background unhappy
(and yes, I know the screen layout is pretty crappy at the moment - i'm still just experimenting and getting my custom widgets to look right)
thanks guys
I want to have a uniform style for the whole application, and then I want to be able to make a couple of the key widgets stand out by changing them to a second style....
basically what I do is
int main(int argc, char*[] argv)
{
QApplication app(argc, argv);
app.QApplication::setStyle(new TopLayoutStyle);
.....
MyTabWidget* topRight = new MyTabWidget();
MyQPalette* palette = topRight->getPalette();
palette->changeColour();
topRight->QWidget::setPalette(bottomColours);
.......
}
MyQPalette::changeColour()
{
QColor greenShadow(98, 161, 98);
QColor green(112, 181, 112);
QColor greenLight(116, 195, 116);
QColor greenMid(95,135,95);
QColor greenForeground(167, 210, 183, 63);
QColor greenDark(80, 140, 80);
QColor midYellow(255, 235, 0);
this->setBrush(QPalette::BrightText,greenForeground);
this->setBrush(QPalette::Base, green);
this->setBrush(QPalette::Highlight, greenForeground);
this->setBrush(QPalette::Background, green);
this->setBrush(QPalette::Light, greenLight);
this->setBrush(QPalette::Mid, greenMid);
this->setBrush(QPalette::Dark, greenDark);
this->setBrush(QPalette::Button, green);
this->setBrush(QPalette::Window, green);
}
now for the most part this is cool, all the buttons/outlines etc change on the tabs widget which I want to stand out....only prob is that the background does not change colour even though everything else does
i've attached a screen shot
I can't work out why the background of the tab widget appears to be filled with the background of the application instead of its own background unhappy
(and yes, I know the screen layout is pretty crappy at the moment - i'm still just experimenting and getting my custom widgets to look right)
thanks guys