Skip to content

Commit b305f2b

Browse files
authored
Merge pull request #159 from abstractfactory/fix158
Fix #158
2 parents ea2eae8 + c563a98 commit b305f2b

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Qt.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
self.__modified__ = list() # Existing members modified in some way
7070

7171
# Below members are set dynamically on import relative the original binding.
72-
self.__version__ = "0.6.4"
72+
self.__version__ = "0.6.5"
7373
self.__qt_version__ = "0.0.0"
7474
self.__binding__ = "None"
7575
self.__binding_version__ = "0.0.0"
@@ -189,6 +189,7 @@ def _pyqt4():
189189

190190
import PyQt4.Qt
191191
from PyQt4 import QtCore, QtGui, uic
192+
192193

193194
_remap(PyQt4, "QtWidgets", QtGui)
194195
_remap(QtCore, "Signal", QtCore.pyqtSignal)
@@ -403,7 +404,11 @@ def init():
403404
__name__: binding,
404405

405406
# Fix #133, `from Qt.QtWidgets import QPushButton`
406-
__name__ + ".QtWidgets": binding.QtWidgets
407+
__name__ + ".QtWidgets": binding.QtWidgets,
408+
409+
# Fix #158 `import Qt.QtCore;Qt.QtCore.Signal`
410+
__name__ + ".QtCore": binding.QtCore,
411+
__name__ + ".QtGui": binding.QtGui,
407412

408413
})
409414

tests.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,17 +307,28 @@ def test_import_from_qtwidgets():
307307
assert QPushButton.__name__ == "QPushButton", QPushButton
308308

309309

310+
def test_i158_qtcore_direct_import():
311+
"""import Qt.QtCore works on all bindings
312+
313+
This addresses issue #158
314+
315+
"""
316+
317+
import Qt.QtCore
318+
assert hasattr(Qt.QtCore, "Signal")
319+
320+
310321
def test_translate_arguments():
311322
"""Arguments of QtCompat.translate are correct
312-
323+
313324
QtCompat.translate is a shim over the PySide, PyQt4 and PyQt5
314325
equivalent with an interface like the one found in PySide2.
315-
326+
316327
Reference: https://doc.qt.io/qt-5/qcoreapplication.html#translate
317328
"""
318-
329+
319330
import Qt
320-
331+
321332
# This will run on each binding
322333
result = Qt.QtCompat.translate("CustomDialog", # context
323334
"Status", # sourceText

0 commit comments

Comments
 (0)