Qt custom look and feel?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 14:18:48

问题


can I force my Qt application to use different look and feel just like it is done in KDE ?


回答1:


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.




回答2:


You can use CSS to style widgets https://doc.qt.io/qt-5/stylesheet.html



来源:https://stackoverflow.com/questions/5358751/qt-custom-look-and-feel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!