开发者

Qt custom look and feel?

开发者 https://www.devze.com 2023-02-17 14:59 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消