aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <ctismer@gmail.com>2016-05-11 20:02:31 +0200
committerAlex Blasche <alexander.blasche@theqtcompany.com>2016-05-12 06:18:13 +0000
commit3b0cf7c2274a46b33e21d35acdda6cfe38ea9343 (patch)
treec67ef6171f25df8bbb563c1e2edf97996248c4df
parentc8608f268f6461c421055ff3df1fd72d616cb646 (diff)
Fix a problem with the font attribute
The transition from Qt4 to Qt5 introduced the QtWidgets module. By simply replacing the QtGui module, things like QFont were lost. Instead, both QtGui and QtWidgets needed to be supported. [ChangeLog][pyside2uic][PYSIDE-316] Fixed failing pyside-uic when parsing font properties. Task-number: PYSIDE-316 Change-Id: I377c0332d56ea4266e9363cfdb1746d5bf2c2b06 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--pyside2uic/Compiler/qobjectcreator.py16
-rw-r--r--pyside2uic/objcreator.py3
2 files changed, 17 insertions, 2 deletions
diff --git a/pyside2uic/Compiler/qobjectcreator.py b/pyside2uic/Compiler/qobjectcreator.py
index fd1b685..296ac36 100644
--- a/pyside2uic/Compiler/qobjectcreator.py
+++ b/pyside2uic/Compiler/qobjectcreator.py
@@ -29,13 +29,24 @@ except NameError:
from sets import Set as set
from pyside2uic.Compiler.indenter import write_code
-from pyside2uic.Compiler.qtproxies import QtWidgets, Literal, strict_getattr
+from pyside2uic.Compiler.qtproxies import (QtWidgets, QtGui, Literal,
+ strict_getattr)
logger = logging.getLogger(__name__)
DEBUG = logger.debug
+class _QtGuiWrapper(object):
+ def search(clsname):
+ try:
+ return strict_getattr(QtGui, clsname)
+ except AttributeError:
+ return None
+
+ search = staticmethod(search)
+
+
class _QtWidgetsWrapper(object):
def search(clsname):
try:
@@ -124,6 +135,9 @@ class CompilerCreatorPolicy(object):
def __init__(self):
self._modules = []
+ def createQtGuiWrapper(self):
+ return _QtGuiWrapper
+
def createQtWidgetsWrapper(self):
return _QtWidgetsWrapper
diff --git a/pyside2uic/objcreator.py b/pyside2uic/objcreator.py
index deed44f..1721c8f 100644
--- a/pyside2uic/objcreator.py
+++ b/pyside2uic/objcreator.py
@@ -47,7 +47,8 @@ class QObjectCreator(object):
self._cpolicy = creatorPolicy
self._cwFilters = []
- self._modules = [self._cpolicy.createQtWidgetsWrapper()]
+ self._modules = [self._cpolicy.createQtWidgetsWrapper(),
+ self._cpolicy.createQtGuiWrapper()]
# Get the optional plugins.
for plugindir in widgetPluginPath: