PDA

View Full Version : plastique style not the same like in the designer



raphaelf
23rd August 2006, 08:39
Hello everybody,

QT: 4.1.3
Compiler: MINGW
OS: Windows XP

With following code i was able to change my app Style to plastique. But the colors are not the same like the plastique prewiew in the designer..
My Fom is graw and in the preview from designer i get a beautiful bright blue :o

Its possible to compile my app and get this beautiful colors like in the preview??


#include <QApplication>
#include "mainwindow.h"


int main(int argc, char *argv[])
{


QApplication app(argc, argv);
app.setStyle("plastique");
MainWindow m;

m.show();
return app.exec();
}

sector
23rd August 2006, 09:46
Hi,

my configuration:

Qt 4.2.0-tp1
mingw
win2000

I don't know how to help you but my plastique preview in designer and compiled app looks the same (see attached screenshot).

raphaelf
23rd August 2006, 10:22
Hi,
I can see diferences. Have a look in my pics:

sector
23rd August 2006, 10:51
You can achieve the color of form like this (in constructor):



myApp::myApp() {
...
// if .ui form like in my case
// setupUi(this);

QPalette myPalette;
myPalette = this->palette();
myPalette.setColor(QPalette::Background,QColor(239 , 239, 239));
this->setPalette(myPalette);
}

raphaelf
23rd August 2006, 11:07
hi,
i know how to change the colors :cool:
..But i just wanna know why the diference between preview and .exe file ;)

jacek
23rd August 2006, 11:21
Try:
app.setStyle( "plastique" );
app.setPalette( app.style()->standardPalette() );

raphaelf
23rd August 2006, 13:40
Hi Jacek,
It works perfect!! :p