Qt自定义外观? [英] Qt custom look and feel?

查看:121
本文介绍了Qt自定义外观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以强制我的Qt应用程序使用不同的外观,就像在KDE中一样吗?

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

推荐答案

您始终可以使用QApplication :: setStyle更改小部件的样式. Qt4中有一些预定义的选项可用.

You can always change styles of widgets using QApplication::setStyle. There are a few predefined options available in Qt4.

在main.cpp中执行类似的操作

In main.cpp do something like this

#include <QPlastiqueStyle>

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

    QApplication::setStyle(new QPlastiqueStyle());
}

这样,您的应用程序在不同的操作系统上看起来总是一样的. 在我看来,Plastique在WindowsXP/2000下看起来比默认的QWindowsXPStyle更好. Cleanlooks也很不错.

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.

还有其他选择:

#include <QPlastiqueStyle>
#include <QCleanlooksStyle>
#include <QWindowsXPStyle>
#include <QWindowsVistaStyle>
#include <QMotifStyle>
#include <QCDEStyle>

我希望这会有所帮助.

这篇关于Qt自定义外观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆