You can achieve it by using style sheet file.
Create a file and name it mystyle.qss
To get custom header :
border: 0.5px solid #C2C7CB;
padding-left: 4px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #59AAFC,
stop: 0.2 #C2C7CB,
stop: 0.5 #DFDFDF,
stop: 0.7 #C2C7CB,
stop: 1.0 #287ACC );
}
QHeaderView::section {
border: 0.5px solid #C2C7CB;
padding-left: 4px;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #59AAFC,
stop: 0.2 #C2C7CB,
stop: 0.5 #DFDFDF,
stop: 0.7 #C2C7CB,
stop: 1.0 #287ACC );
}
To copy to clipboard, switch view to plain text mode
Set up the style for your app in the main function:
int main ( int argc, char* argv[])
{
QFile file(":/mystyle.qss");
if (file.
open(QFile::ReadOnly));
qApp->setStyleSheet(styleSheet);
// other code
return app.exec();
}
int main ( int argc, char* argv[])
{
QApplication app(argc,argv);
QFile file(":/mystyle.qss");
if (file.open(QFile::ReadOnly));
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
// other code
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Create a resource file (myresource.qrc) and include your style file:
<RCC>
<qresource >
<file>mystyle.qss</file>
</qresource>
</RCC>
<RCC>
<qresource >
<file>mystyle.qss</file>
</qresource>
</RCC>
To copy to clipboard, switch view to plain text mode
And finally add myresource.qrc in the application *.pro file:
RESOURCES = myresource.qrc
RESOURCES = myresource.qrc
To copy to clipboard, switch view to plain text mode
(In this example, the files created are relative to your app directory).
If you need to customize other widgets just add them to your qss file.
I encourage you to read about Qt resource and style sheet concepts.
Have a look at http://doc.trolltech.com/4.6/stylesh...stomizing.html to get more information.
Bookmarks