界面外观和风格 ######################################## Qt风格 **************************************** 获取风格 ======================================== - 要获取系统中所有可用Qt风格,可以使用 ``QStyleFactory::keys`` 函数。 - 要获取应用程序使用的风格,可以使用 ``style()`` 函数。 例如在KDE下执行: .. code-block:: cpp qDebug()<pushButton->palette(); pale.setColor(QPalette::Active,QPalette::ButtonText, Qt::red); // 在有焦点时设置字体颜色为红色 pale.setColor(QPalette::Button, Qt::green); // 设置按钮背景为绿色 ui->pushButton->setPalette(pale); 效果如下: .. image:: assets/风格示例.png 自定义界面风格 ======================================== 要自定义风格,需要继承 .. seealso:: - \ ` Qt---自定义界面之QStyle `_ - \ ` 用QT创建新风格: QStyle `_ - \ `Styles and Style Aware Widgets `_ - \ `Qt之模型/视图(自定义风格) `_ 样式表 **************************************** - TODO