作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 PyQt 编写 Qt5 应用程序。
我想了解如何更改整个应用程序的样式。
旧的 Qt4 调用如下:
app = QApplication(sys.argv)
app.setStyle(QStyleFactory.create('Cleanlooks'))
和建议的方法
here什么也没做。
最佳答案
可能是 Cleanlooks
在您的系统上不再可用。来自 QStyleFactory.keys()
您可以询问系统上的可用样式。在 Ubuntu 16.04 和 pyqt5 上,我只得到:
['Windows', 'GTK+', 'Fusion']
qmake
,就我而言
/opt/Qt/5.7/gcc_64/bin/qmake
git clone https://code.qt.io/qt/qtstyleplugins.git
并安装它:
cd qtstyleplugins
/opt/Qt/5.7/gcc_64/bin/qmake # the qmake from the fresh installation
make
make install
/opt/Qt/5.7/gcc_64/plugins/
中有一个文件夹“styles”包含其他样式。
python3 configure.py
由
--qmake
提供 QT5-Installation 中的 qmake -option 并在输出中查找缺少的依赖项。
['bb10dark', 'bb10bright', 'cleanlooks', 'cde', 'motif', 'plastique', 'Windows', 'Fusion']
RuntimeError: the sip module implements API v11.0 to v11.2 but the PyQt5.QtCore module requires API v11.3
sudo apt-get purge python3-sip
安装 sip 前
as described here
关于pyqt - 如何在 PyQt5 中更改样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39201227/
我是一名优秀的程序员,十分优秀!