本文整理匯總了Python中PySide2.QtCore.QObject方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QObject方法的具體用法?Python QtCore.QObject怎麽用?Python QtCore.QObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtCore
的用法示例。
在下文中一共展示了QtCore.QObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testAdresses
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def testAdresses(self):
q = QtCore.QObject()
ptr = wrapper.getCppPointer(q)
print("CppPointer to an instance of PySide.QtCore.QObject = 0x%016X" % ptr[0])
# None of the following is expected to raise an
# OverflowError on 64-bit systems
# largest 32-bit address
wrapper.wrapInstance(0xFFFFFFFF, QtCore.QObject)
# a regular, slightly smaller 32-bit address
wrapper.wrapInstance(0xFFFFFFF, QtCore.QObject)
# an actual 64-bit address (> 4 GB, the first non 32-bit address)
wrapper.wrapInstance(0x100000000, QtCore.QObject)
# largest 64-bit address
wrapper.wrapInstance(0xFFFFFFFFFFFFFFFF, QtCore.QObject)
示例2: __init__
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def __init__(self, name: str, itemType: FileSystemItemType, parent: QObject = None):
if itemType == FileSystemItemType.Drive:
iconType = QFileIconProvider.IconType.Drive
elif itemType == FileSystemItemType.Directory:
iconType = QFileIconProvider.IconType.Folder
else:
iconType = QFileIconProvider.IconType.File
icon = FileSystemItem._iconCache.get(iconType, None)
if icon is None:
icon = QFileIconProvider().icon(iconType)
FileSystemItem._iconCache[iconType] = icon
super().__init__(icon, name, parent)
self.itemType = itemType
示例3: notify
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def notify(self, receiver: QObject, event: QEvent) -> bool:
"""
Args:
receiver: Object to recieve event
event: Event
Returns: bool
"""
if isinstance(event, QCloseEvent) and receiver in (self.blender_widget, self._blender_window):
event.ignore()
self.store_window_geometry()
self.should_close = True
return False
return super().notify(receiver, event)
示例4: _onMediaStatusChanged
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def _onMediaStatusChanged(self, status):
if status == QtMultimedia.QMediaPlayer.MediaStatus.LoadedMedia:
QtCore.QObject.disconnect(
self.content,
QtCore.SIGNAL("mediaStatusChanged()"),
self.content._mediaStatusChangedSlot
)
QtCore.QObject.disconnect(
self.content,
QtCore.SIGNAL("error()"),
self.content._errorSlot
)
e = Event(LoaderEvent.COMPLETE)
e.target = self.content
self.dispatchEvent(e)
示例5: get_layout
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def get_layout(layout):
""" return a layout wraped as QObject """
ptr = omui.MQtUtil.findLayout(layout)
return shiboken2.wrapInstance(long(ptr), QWidget) #.layout()
示例6: _pyside2_as_qt_object
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [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)
示例7: _pyside_as_qt_object
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [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)
示例8: __init__
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def __init__(self, root: Directory, parent: QObject = None):
"""
:param root: root of all directories. Directories in root will be displayed with drive icons.
:param parent: parent object.
"""
super().__init__(parent)
self.root = root
self.breadcrumbLabel = QLabel()
self.titleLabel = QLabel()
self.titleLabel.setStyleSheet("font-weight: bold")
self.titleSeparator: QFrame = QFrame()
self.titleSeparator.setFrameShape(QFrame.HLine)
self.listWidget = QListWidget()
self.listWidget.setSortingEnabled(True)
self.listWidget.setContextMenuPolicy(Qt.CustomContextMenu)
self.listWidget.customContextMenuRequested.connect(self.onCustomContextMenu)
self.verticalLayout = QVBoxLayout()
self.verticalLayout.addWidget(self.breadcrumbLabel)
self.verticalLayout.addWidget(self.listWidget)
self.setLayout(self.verticalLayout)
self.listWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)
self.currentPath: Path = Path("/")
self.currentDirectory: Directory = root
self.listCurrentDirectory()
self.currentDirectory.addObserver(self)
示例9: __init__
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def __init__(self, remotePath: str, targetPath: str, isMultipleDownload: bool, parent: QObject):
super().__init__(parent, Qt.CustomizeWindowHint | Qt.WindowTitleHint)
self.titleLabel = QLabel(f"Downloading {remotePath} to {targetPath}")
self.progressBar = QProgressBar()
self.progressBar.setMinimum(0)
self.progressBar.setMaximum(0)
self.actualProgress = 0
self.actualMaximum = 0
self.isComplete = False
self.isMultipleDownload = isMultipleDownload
self.downloadCount = 0
self.downloadTotal = 0
self.progressLabel = QLabel(f"{self.downloadCount} / {self.downloadTotal} files downloaded")
self.progressSizeLabel = QLabel("0 bytes")
self.widgetLayout = QVBoxLayout()
self.widgetLayout.addWidget(self.titleLabel)
self.widgetLayout.addWidget(self.progressLabel)
self.widgetLayout.addWidget(self.progressBar)
self.widgetLayout.addWidget(self.progressSizeLabel)
self.closeButton = QPushButton("Continue download in background")
self.closeButton.clicked.connect(self.hide)
self.widgetLayout.addWidget(self.closeButton)
self.setLayout(self.widgetLayout)
示例10: mui_to_qt
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def mui_to_qt(self, mui_name):
if hostMode != "maya":
return
ptr = mui.MQtUtil.findControl(mui_name)
if ptr is None:
ptr = mui.MQtUtil.findLayout(mui_name)
if ptr is None:
ptr = mui.MQtUtil.findMenuItem(mui_name)
if ptr is not None:
if qtMode in (0,2):
# ==== for pyside ====
return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
elif qtMode in (1,3):
# ==== for PyQt====
return sip.wrapinstance(long(ptr), QtCore.QObject)
示例11: _on_focus_object_changed
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def _on_focus_object_changed(self, focus_object: QObject):
"""
Args:
focus_object: Object to track focus event
"""
pass
示例12: _on_focus_object_changed
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def _on_focus_object_changed(self, focus_object: QObject):
"""
Args:
QObject focus_object: Object to track focus change
"""
if focus_object is self.blender_widget:
win32gui.SetFocus(self._hwnd)
示例13: _on_focus_object_changed
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def _on_focus_object_changed(self, focus_object: QObject):
"""
Args:
focus_object: Object to track focus event
"""
if focus_object is self.blender_widget:
self._ns_window.makeKey()
示例14: test_load_ui_returntype
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def test_load_ui_returntype():
"""load_ui returns an instance of QObject"""
import sys
from Qt import QtWidgets, QtCore, QtCompat
app = QtWidgets.QApplication(sys.argv)
obj = QtCompat.loadUi(self.ui_qwidget)
assert isinstance(obj, QtCore.QObject)
app.exit()
示例15: test_isValid
# 需要導入模塊: from PySide2 import QtCore [as 別名]
# 或者: from PySide2.QtCore import QObject [as 別名]
def test_isValid():
""".isValid and .delete work in all bindings"""
from Qt import QtCompat, QtCore
obj = QtCore.QObject()
assert QtCompat.isValid(obj)
QtCompat.delete(obj)
assert not QtCompat.isValid(obj)