Qt custom look and feel?
can I force my Qt application to use different开发者_如何学Python look and feel just like it is done in KDE ?
You can always change styles of widgets using QApplication::setStyle. There are a few predefined options available in Qt4.
In main.cpp do something like this
#include <QPlastiqueStyle>
int main(int argc, char *argv[])
{
[...]
QApplication::setStyle(new QPlastiqueStyle());
}
This way your application will alwyas look the same on different OS. In my opinion Plastique looks better under windowsXP/2000 then default QWindowsXPStyle. Cleanlooks is quite nice too.
There are other options:
#include <QPlastiqueStyle>
#include <QCleanlooksStyle>
#include <QWindowsXPStyle>
#include <QWindowsVistaStyle>
#include <QMotifStyle>
#include <QCDEStyle>
I hope this helps.
You can use CSS to style widgets https://doc.qt.io/qt-5/stylesheet.html
精彩评论