File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -239,10 +239,18 @@ def init():
239239 )
240240
241241 for binding in bindings :
242- log ("Trying %s" % binding .__name__ [ 1 :] , verbose )
242+ log ("Trying %s" % binding .__name__ , verbose )
243243
244244 try :
245- sys .modules [__name__ ] = binding ()
245+ binding = binding ()
246+
247+ sys .modules .update ({
248+ __name__ : binding ,
249+
250+ # Fix #133, `from Qt.QtWidgets import QPushButton`
251+ __name__ + ".QtWidgets" : binding .QtWidgets
252+ })
253+
246254 return
247255
248256 except ImportError as e :
Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ def test_vendoring():
159159 ) == 0
160160
161161
162+ def test_import_from_qtwidgets ():
163+ """Fix #133, `from Qt.QtWidgets import XXX` works"""
164+ from Qt .QtWidgets import QPushButton
165+ assert QPushButton .__name__ == "QPushButton" , QPushButton
166+
167+
162168if binding ("PyQt4" ):
163169 def test_preferred_pyqt4 ():
164170 """QT_PREFERRED_BINDING = PyQt4 properly forces the binding"""
You can’t perform that action at this time.
0 commit comments