當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.Slot方法代碼示例

本文整理匯總了Python中PySide2.QtCore.Slot方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.Slot方法的具體用法?Python QtCore.Slot怎麽用?Python QtCore.Slot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PySide2.QtCore的用法示例。


在下文中一共展示了QtCore.Slot方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _setup_pyqt5

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def _setup_pyqt5():
    global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName

    if QT_API == QT_API_PYQT5:
        from PyQt5 import QtCore, QtGui, QtWidgets
        __version__ = QtCore.PYQT_VERSION_STR
        QtCore.Signal = QtCore.pyqtSignal
        QtCore.Slot = QtCore.pyqtSlot
        QtCore.Property = QtCore.pyqtProperty
    elif QT_API == QT_API_PYSIDE2:
        from PySide2 import QtCore, QtGui, QtWidgets, __version__
    else:
        raise ValueError("Unexpected value for the 'backend.qt5' rcparam")
    _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName

    def is_pyqt5():
        return True 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:19,代碼來源:qt_compat.py

示例2: data

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def data(self, index, role):
        """
        This function partly overrides the standard QFileSystemModel data
        function to return custom file and folder icons
        """

        fileInfo = self.getFileInfo(index)[4]

        if role == QtCore.Qt.DecorationRole:
            if fileInfo.isDir():
                return QtGui.QPixmap(ICONS_L + 'Folder.png')
            elif fileInfo.isFile():
                return QtGui.QPixmap(ICONS_L + 'airfoil.png')

        # return QtWidgets.QFileSystemModel.data(self, index, role)
        return super().data(index, role)

    # @QtCore.Slot(QtCore.QModelIndex) 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:20,代碼來源:FileSystem.py

示例3: import_pyqt5

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def import_pyqt5():
    """
    Import PyQt5

    ImportErrors rasied within this function are non-recoverable
    """

    from PyQt5 import QtCore, QtSvg, QtWidgets, QtGui, QtPrintSupport

    import sip

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

    # Join QtGui and QtWidgets for Qt4 compatibility.
    QtGuiCompat = types.ModuleType('QtGuiCompat')
    QtGuiCompat.__dict__.update(QtGui.__dict__)
    QtGuiCompat.__dict__.update(QtWidgets.__dict__)
    QtGuiCompat.__dict__.update(QtPrintSupport.__dict__)

    api = QT_API_PYQT5
    return QtCore, QtGuiCompat, QtSvg, api 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:25,代碼來源:qt_loaders.py

示例4: asyncSlot

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def asyncSlot(*args):
    """Make a Qt async slot run on asyncio loop."""
    def outer_decorator(fn):
        @Slot(*args)
        @functools.wraps(fn)
        def wrapper(*args, **kwargs):
            return asyncio.ensure_future(fn(*args, **kwargs))
        return wrapper
    return outer_decorator 
開發者ID:gmarull,項目名稱:asyncqt,代碼行數:11,代碼來源:__init__.py

示例5: import_pyqt4

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def import_pyqt4(version=2):
    """
    Import PyQt4

    Parameters
    ----------
    version : 1, 2, or None
      Which QString/QVariant API to use. Set to None to use the system
      default

    ImportErrors rasied within this function are non-recoverable
    """
    # The new-style string API (version=2) automatically
    # converts QStrings to Unicode Python strings. Also, automatically unpacks
    # QVariants to their underlying objects.
    import sip

    if version is not None:
        sip.setapi('QString', version)
        sip.setapi('QVariant', version)

    from PyQt4 import QtGui, QtCore, QtSvg

    if not check_version(QtCore.PYQT_VERSION_STR, '4.7'):
        raise ImportError("QtConsole requires PyQt4 >= 4.7, found %s" %
                          QtCore.PYQT_VERSION_STR)

    # Alias PyQt-specific functions for PySide compatibility.
    QtCore.Signal = QtCore.pyqtSignal
    QtCore.Slot = QtCore.pyqtSlot

    # query for the API version (in case version == None)
    version = sip.getapi('QString')
    api = QT_API_PYQTv1 if version == 1 else QT_API_PYQT
    return QtCore, QtGui, QtSvg, api 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:37,代碼來源:qt_loaders.py

示例6: onFileSelected

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def onFileSelected(self, index):

        fileInfo = self.getFileInfo(index)[4]
        if fileInfo.isDir():
            return
        name = self.getFileInfo(index)[0]
        logger.info('Airfoil {} selected'.format(name))

    # @QtCore.Slot(QtCore.QModelIndex) 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:11,代碼來源:FileSystem.py

示例7: button_clicked

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def button_clicked(self, number):
        @Slot()
        def button_clicked_num():
            self.ui.pin_lineedit.setText(self.ui.pin_lineedit.text() + str(number))
        return button_clicked_num 
開發者ID:bitcoin-core,項目名稱:HWI,代碼行數:7,代碼來源:gui.py

示例8: _setup_pyqt4

# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import Slot [as 別名]
def _setup_pyqt4():
    global QtCore, QtGui, QtWidgets, __version__, is_pyqt5, _getSaveFileName

    def _setup_pyqt4_internal(api):
        global QtCore, QtGui, QtWidgets, \
            __version__, is_pyqt5, _getSaveFileName
        # List of incompatible APIs:
        # http://pyqt.sourceforge.net/Docs/PyQt4/incompatible_apis.html
        _sip_apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime",
                     "QUrl", "QVariant"]
        try:
            import sip
        except ImportError:
            pass
        else:
            for _sip_api in _sip_apis:
                try:
                    sip.setapi(_sip_api, api)
                except ValueError:
                    pass
        from PyQt4 import QtCore, QtGui
        __version__ = QtCore.PYQT_VERSION_STR
        # PyQt 4.6 introduced getSaveFileNameAndFilter:
        # https://riverbankcomputing.com/news/pyqt-46
        if __version__ < LooseVersion("4.6"):
            raise ImportError("PyQt<4.6 is not supported")
        QtCore.Signal = QtCore.pyqtSignal
        QtCore.Slot = QtCore.pyqtSlot
        QtCore.Property = QtCore.pyqtProperty
        _getSaveFileName = QtGui.QFileDialog.getSaveFileNameAndFilter

    if QT_API == QT_API_PYQTv2:
        _setup_pyqt4_internal(api=2)
    elif QT_API == QT_API_PYSIDE:
        from PySide import QtCore, QtGui, __version__, __version_info__
        # PySide 1.0.3 fixed the following:
        # https://srinikom.github.io/pyside-bz-archive/809.html
        if __version_info__ < (1, 0, 3):
            raise ImportError("PySide<1.0.3 is not supported")
        _getSaveFileName = QtGui.QFileDialog.getSaveFileName
    elif QT_API == QT_API_PYQT:
        _setup_pyqt4_internal(api=1)
    else:
        raise ValueError("Unexpected value for the 'backend.qt4' rcparam")
    QtWidgets = QtGui

    def is_pyqt5():
        return False 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:50,代碼來源:qt_compat.py


注:本文中的PySide2.QtCore.Slot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。