qtreactor
qtreactor copied to clipboard
Exception: Qt Static Configuration ?
When writing a PySide application with qt4reactor 1.6, always getting "Qt Static Configuration" exception.
import sys
from PySide import QtGui, QtCore
app = QtGui.QApplication(sys.argv)
from qtreactor import pyside4reactor
pysid4reactor.install()
And i've read into qtreactor_config.py and found this line
qt_preset = "PyQt4"
will always cause set_qt_name failed. Should it be
qt_preset = ""
?
This is an ugly resolution but help go around to solve pyside problem from qtreactor import qtreactor_config qtreactor_config._instance.qtname = 'PySide'
import qtreactor.pyside4reactor qtreactor.pyside4reactor.install()
recomend to make changes to qtreactor_config
qt_preset = "PyQT4"
class _config(object):
def __init__(self):
self.qtname = qt_preset
if self.qtname != "":
self.preset = True
_instance = None
def set_qt_preset(name=qt_preset):
global _instance
global qt_preset
if name not in ['PySide', 'PyQT4']:
raise Exception("Qt library not acceptable")
if _instance is not None:
raise Exception("Qt Static Configuration")
qt_preset = name
_instance = _config()
def set_qt_name(name):
if _instance is None:
set_qt_preset(name)
else:
raise Exception("Qt Static Configuration")
def get_qt_name():
return _instance.qtname
and then this should work without problem
from qtreactor import pyside4reactor
pyside4reactor.install()