diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-18 16:45:35 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-05-18 16:45:35 +0200 |
| commit | 3f8c8702ea295f39357e7c66f46e5138f56bcc9f (patch) | |
| tree | 9ca65a7f94d544ba4b36f239c4a48852ad8a7b09 /sources/pyside2/tests/QtWidgets/qstyle_test.py | |
| parent | 5fce76074c01e52a22151133a1e3a2cf71cfe535 (diff) | |
| parent | df1a619d65d8e5db91f3c8db46b00872b461e334 (diff) | |
Merge remote-tracking branch 'origin/5.9' into 5.11
Change-Id: I20cf741f5b07426ad5113eb8c52f144102c331ce
Diffstat (limited to 'sources/pyside2/tests/QtWidgets/qstyle_test.py')
| -rw-r--r-- | sources/pyside2/tests/QtWidgets/qstyle_test.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sources/pyside2/tests/QtWidgets/qstyle_test.py b/sources/pyside2/tests/QtWidgets/qstyle_test.py index 38b457a82..eb2a73d29 100644 --- a/sources/pyside2/tests/QtWidgets/qstyle_test.py +++ b/sources/pyside2/tests/QtWidgets/qstyle_test.py @@ -29,7 +29,20 @@ import unittest from helper import UsesQApplication -from PySide2.QtWidgets import QWidget, QLabel, QFontComboBox, QStyleFactory +from PySide2.QtGui import QWindow +from PySide2.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle, + QStyleFactory, QWidget) + +class ProxyStyle(QProxyStyle): + + def __init__(self, style): + QProxyStyle.__init__(self, style) + self.polished = 0 + + def polish(self, widget): + self.polished = self.polished + 1 + super(ProxyStyle, self).polish(widget) + class SetStyleTest(UsesQApplication): '''Tests setting the same QStyle for all objects in a UI hierarchy.''' @@ -54,6 +67,17 @@ class SetStyleTest(UsesQApplication): style = QStyleFactory.create(QStyleFactory.keys()[0]) setStyleHelper(container, style) + def testSetProxyStyle(self): + label = QLabel("QtWidgets/ProxyStyle test") + baseStyle = QStyleFactory.create(QApplication.instance().style().objectName()) + self.assertTrue(baseStyle) + proxyStyle = ProxyStyle(baseStyle) + label.setStyle(proxyStyle) + label.show() + while not label.windowHandle().isExposed(): + QApplication.instance().processEvents() + self.assertTrue(proxyStyle.polished > 0) + if __name__ == '__main__': unittest.main() |
