Python PySide.QtCore 模块,pyqtProperty() 实例源码
我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用PySide.QtCore.pyqtProperty()。
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(PyQt5, "__binding__", PyQt5.__name__)
_add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, n)))
_add(PyQt5,
"setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
def pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, uic
remap(QtCore, "Signal", QtCore.pyqtSignal)
remap(QtCore, "Slot", QtCore.pyqtSlot)
remap(QtCore, "Property", QtCore.pyqtProperty)
add(PyQt5, "__wrapper_version__", __version__)
add(PyQt5, "__binding__", "PyQt5")
add(PyQt5, "__binding_version__", QtCore.PYQT_VERSION_STR)
add(PyQt5, "__qt_version__", QtCore.QT_VERSION_STR, safe=False)
add(PyQt5, "__added__", __added__)
add(PyQt5, "__remapped__", __remapped__)
add(PyQt5, "__modified__", __modified__)
add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
return PyQt5
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(QtCompat, "__binding__", PyQt5.__name__)
_add(QtCompat, "__binding_version__", PyQt5.QtCore.PYQT_VERSION_STR)
_add(QtCompat, "__qt_version__", PyQt5.QtCore.QT_VERSION_STR)
_add(QtCompat, "load_ui", lambda fname: uic.loadUi(fname))
_add(QtCompat, "translate", QtCore.QCoreApplication.translate)
_add(QtCompat, "setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(PyQt5, "__binding__", PyQt5.__name__)
_add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, n)))
_add(PyQt5,
"setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
def _pyqt5():
import PyQt5.Qt
from PyQt5 import QtCore, QtWidgets, uic
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_add(PyQt5, "__binding__", PyQt5.__name__)
_add(PyQt5, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt5, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, n)))
_add(PyQt5,
"setSectionResizeMode",
QtWidgets.QHeaderView.setSectionResizeMode)
_maintain_backwards_compatibility(PyQt5)
return PyQt5
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt , therefore might not be available
pass
_add(PyQt4, "QtCompat", self)
_add(PyQt4, "__binding__", PyQt4.__name__)
_add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt4, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PyQt4, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PyQt4)
return PyQt4
def pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
remap(PyQt4, "QtWidgets", QtGui)
remap(QtCore, "Signal", QtCore.pyqtSignal)
remap(QtCore, "Slot", QtCore.pyqtSlot)
remap(QtCore, "Property", QtCore.pyqtProperty)
remap(QtCore, "QItemSelection", QtGui.QItemSelection)
remap(QtCore, "QStringListModel", QtGui.QStringListModel)
remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt , therefore might not be available
pass
add(PyQt4, "__wrapper_version__", __version__)
add(PyQt4, "__binding__", "PyQt4")
add(PyQt4, "__binding_version__", QtCore.PYQT_VERSION_STR)
add(PyQt4, "__qt_version__", QtCore.QT_VERSION_STR)
add(PyQt4, "__added__", __added__)
add(PyQt4, "__remapped__", __remapped__)
add(PyQt4, "__modified__", __modified__)
add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname))
return PyQt4
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
"QtWebkit is optional in Qt , therefore might not be available"
_add(QtCompat, "__binding__", PyQt4.__name__)
_add(QtCompat, "__binding_version__", PyQt4.QtCore.PYQT_VERSION_STR)
_add(QtCompat, "__qt_version__", PyQt4.QtCore.QT_VERSION_STR)
_add(QtCompat, "load_ui", lambda fname: uic.loadUi(fname))
_add(QtCompat, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
# PySide2 differs from Qt4 in that Qt4 has one extra argument
# which is always `None`. The lambda arguments represents the PySide2
# interface, whereas the arguments passed to `.translate` represent
# those expected of a Qt4 binding.
_add(QtCompat, "translate",
lambda context, sourceText, disambiguation, n:
QtCore.QCoreApplication.translate(context,
sourceText,
disambiguation,
QtCore.QCoreApplication.CodecForTr,
n))
_maintain_backwards_compatibility(PyQt4)
return PyQt4
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt , therefore might not be available
pass
_add(PyQt4, "QtCompat", self)
_add(PyQt4, "__binding__", PyQt4.__name__)
_add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt4, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PyQt4, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PyQt4)
return PyQt4
def _pyqt4():
# Attempt to set sip API v2 (must be done prior to importing PyQt4)
import sip
try:
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
sip.setapi("QDate", 2)
sip.setapi("QDateTime", 2)
sip.setapi("QTextStream", 2)
sip.setapi("QTime", 2)
sip.setapi("QUrl", 2)
except AttributeError:
raise ImportError
# PyQt4 < v4.6
except ValueError:
# API version already set to v1
raise ImportError
import PyQt4.Qt
from PyQt4 import QtCore, QtGui, uic
_remap(PyQt4, "QtWidgets", QtGui)
_remap(QtCore, "Signal", QtCore.pyqtSignal)
_remap(QtCore, "Slot", QtCore.pyqtSlot)
_remap(QtCore, "Property", QtCore.pyqtProperty)
_remap(QtCore, "QItemSelection", QtGui.QItemSelection)
_remap(QtCore, "QStringListModel", QtGui.QStringListModel)
_remap(QtCore, "QItemSelectionModel", QtGui.QItemSelectionModel)
_remap(QtCore, "QSortFilterProxyModel", QtGui.QSortFilterProxyModel)
_remap(QtCore, "QAbstractProxyModel", QtGui.QAbstractProxyModel)
try:
from PyQt4 import QtWebKit
_remap(PyQt4, "QtWebKitWidgets", QtWebKit)
except ImportError:
# QtWebkit is optional in Qt , therefore might not be available
pass
_add(PyQt4, "QtCompat", self)
_add(PyQt4, "__binding__", PyQt4.__name__)
_add(PyQt4, "load_ui", lambda fname: uic.loadUi(fname))
_add(PyQt4, "translate", lambda context, sourceText, disambiguation, n: (
QtCore.QCoreApplication(context, sourceText,
disambiguation, None, n)))
_add(PyQt4, "setSectionResizeMode", QtGui.QHeaderView.setResizeMode)
_maintain_backwards_compatibility(PyQt4)
return PyQt4