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


Python PySide2.QtCore方法代碼示例

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


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

示例1: qt_import

# 需要導入模塊: import PySide2 [as 別名]
# 或者: from PySide2 import QtCore [as 別名]
def qt_import(shi=False, cui=False):
    """
    import pyside/pyQt

    Returns:
        multi: QtGui, QtCore, QtWidgets, wrapInstance

    """
    lookup = ["PySide2", "PySide", "PyQt4"]

    preferredBinding = os.environ.get("MGEAR_PYTHON_QT_BINDING", None)
    if preferredBinding is not None and preferredBinding in lookup:
        lookup.remove(preferredBinding)
        lookup.insert(0, preferredBinding)

    for binding in lookup:
        try:
            return _qt_import(binding, shi, cui)
        except Exception:
            pass

    raise _qt_import("ThisBindingSurelyDoesNotExist", False, False) 
開發者ID:mgear-dev,項目名稱:mgear_core,代碼行數:24,代碼來源:pyqt.py

示例2: _qt_import

# 需要導入模塊: import PySide2 [as 別名]
# 或者: from PySide2 import QtCore [as 別名]
def _qt_import(binding, shi=False, cui=False):
    QtGui = None
    QtCore = None
    QtWidgets = None
    wrapInstance = None

    if binding == "PySide2":
        from PySide2 import QtGui, QtCore, QtWidgets
        import shiboken2 as shiboken
        from shiboken2 import wrapInstance
        from pyside2uic import compileUi

    elif binding == "PySide":
        from PySide import QtGui, QtCore
        import PySide.QtGui as QtWidgets
        import shiboken
        from shiboken import wrapInstance
        from pysideuic import compileUi

    elif binding == "PyQt4":
        from PyQt4 import QtGui
        from PyQt4 import QtCore
        import PyQt4.QtGui as QtWidgets
        from sip import wrapinstance as wrapInstance
        from PyQt4.uic import compileUi
        print("Warning: 'shiboken' is not supported in 'PyQt4' Qt binding")
        shiboken = None

    else:
        raise Exception("Unsupported python Qt binding '%s'" % binding)

    rv = [QtGui, QtCore, QtWidgets, wrapInstance]
    if shi:
        rv.append(shiboken)
    if cui:
        rv.append(compileUi)
    return rv 
開發者ID:mgear-dev,項目名稱:mgear_core,代碼行數:39,代碼來源:pyqt.py

示例3: _pyside2_as_qt_object

# 需要導入模塊: import PySide2 [as 別名]
# 或者: from PySide2 import QtCore [as 別名]
def _pyside2_as_qt_object(widget):
    from PySide2.QtCore import QObject
    from PySide2.QtWidgets import QWidget
    from PySide2 import QtWidgets
    from shiboken2 import wrapInstance
    if hasattr(widget, '__qt_object__'):
        return widget.__qt_object__
    ptr = _find_widget_ptr(widget)
    qobject = wrapInstance(long(ptr), QObject)
    meta = qobject.metaObject()
    _class = meta.className()
    _super = meta.superClass().className()
    qclass = getattr(QtWidgets, _class, getattr(QtWidgets, _super, QWidget))
    return wrapInstance(long(ptr), qclass) 
開發者ID:theodox,項目名稱:mGui,代碼行數:16,代碼來源:_compat.py

示例4: _pyside_as_qt_object

# 需要導入模塊: import PySide2 [as 別名]
# 或者: from PySide2 import QtCore [as 別名]
def _pyside_as_qt_object(widget):
    from PySide.QtCore import QObject
    from PySide.QtGui import QWidget
    from PySide import QtGui
    from shiboken import wrapInstance
    if hasattr(widget, '__qt_object__'):
        return widget.__qt_object__
    ptr = _find_widget_ptr(widget)
    qobject = wrapInstance(long(ptr), QObject)
    meta = qobject.metaObject()
    _class = meta.className()
    _super = meta.superClass().className()
    qclass = getattr(QtGui, _class, getattr(QtGui, _super, QWidget))
    return wrapInstance(long(ptr), qclass) 
開發者ID:theodox,項目名稱:mGui,代碼行數:16,代碼來源:_compat.py

示例5: check_versions

# 需要導入模塊: import PySide2 [as 別名]
# 或者: from PySide2 import QtCore [as 別名]
def check_versions():
    print("[qt.py] CEF Python {ver}".format(ver=cef.__version__))
    print("[qt.py] Python {ver} {arch}".format(
        ver=platform.python_version(), arch=platform.architecture()[0]))
    print("[qt.py] PySide2 {v1} (qt {v2})".format(v1=PySide2.__version__,
                                                  v2=QtCore.__version__))
    # CEF Python version requirement
    assert cef.__version__ >= "55.4", "CEF Python v55.4+ required to run this" 
開發者ID:RimoChan,項目名稱:Librian,代碼行數:10,代碼來源:qtcef.py

示例6: __init__

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

        self._conf = Configuration((CONF_DIR / 'SciHubEVA.conf').resolve().as_posix())
        self._qt_quick_controls2_conf = Configuration(
            (CONF_DIR / 'qtquickcontrols2.conf').resolve().as_posix(), space_around_delimiters=False)

        self._engine = QQmlApplicationEngine()
        self._engine.rootContext().setContextProperty('PYTHON_VERSION', '.'.join(str(v) for v in sys.version_info[:3]))
        self._engine.rootContext().setContextProperty('QT_VERSION', PySide2.QtCore.qVersion())
        self._engine.load('qrc:/ui/App.qml')
        self._window = self._engine.rootObjects()[0]

        self._theme = self._window.property('theme')
        self._connect()

        self._scihub_preferences = PreferencesDialog(self, self._conf, self._qt_quick_controls2_conf)
        self._scihub_captcha = CaptchaDialog(self, log=self.log)
        self._captcha_query = None

        self._input = None
        save_to_dir = self._conf.get('common', 'save_to_dir')
        if not save_to_dir or save_to_dir.strip() == '':
            self._save_to_dir = None
        else:
            self._save_to_dir = save_to_dir
            self.loadSaveToDir.emit(save_to_dir)

        self._query_list = None
        self._query_list_length = 0

        self._captcha_img_file_path = None

        self._logger = logging.getLogger('SciHubEVA')
        self._logger.setLevel(logging.DEBUG)

        formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
        log_file_name_prefix = str(get_log_directory() / 'SciHubEVA.log')
        handler = TimedRotatingFileHandler(filename=log_file_name_prefix, when='D')
        handler.setFormatter(formatter)
        handler.setLevel(logging.DEBUG)

        self._logger.addHandler(handler)

        self._h2t = html2text.HTML2Text()
        self._h2t.ignore_links = True 
開發者ID:leovan,項目名稱:SciHubEVA,代碼行數:48,代碼來源:scihubeva_dialog.py


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