本文整理匯總了Python中PySide2.QtWidgets.QWidget方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QWidget方法的具體用法?Python QtWidgets.QWidget怎麽用?Python QtWidgets.QWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QWidget方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_nav_layout
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def get_nav_layout():
def find_first_frame_layout(layout):
""" recursivley get all child layout until we find the first framelayout """
children = cmds.layout(layout, ca=True, q=True)
for child in children:
if child.startswith('frameLayout'):
return child
else:
return find_first_frame_layout(child)
nav_layout = find_first_frame_layout('AttrEdsporeNodeFormLayout')
return wrapInstance(long(omui.MQtUtil.findControl(nav_layout)), QWidget)
示例2: setupUi
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def setupUi(self, OutputDock):
OutputDock.setObjectName("OutputDock")
OutputDock.resize(700, 397)
OutputDock.setFloating(False)
OutputDock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures)
self.dockWidgetContents = QtWidgets.QWidget()
self.dockWidgetContents.setObjectName("dockWidgetContents")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.dockWidgetContents)
self.horizontalLayout.setObjectName("horizontalLayout")
self.textEdit = QtWidgets.QTextEdit(self.dockWidgetContents)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName("textEdit")
self.horizontalLayout.addWidget(self.textEdit)
OutputDock.setWidget(self.dockWidgetContents)
self.retranslateUi(OutputDock)
QtCore.QMetaObject.connectSlotsByName(OutputDock)
示例3: __init__
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def __init__(self, parent: QWidget, node_set: NodeSet):
super(SystemTray, self).__init__(parent=parent)
self.node_set = node_set
self.set_red()
self.menu = Menu(node_set=node_set, system_tray=self)
self.setContextMenu(self.menu)
self.node_set.bitcoind_node.process.notification.connect(
self.show_message
)
self.node_set.lnd_node.process.notification.connect(
self.show_message
)
self.node_set.lnd_node.process.set_icon_color.connect(
self.set_icon
)
示例4: addWidget
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def addWidget(self,
widget: QWidget,
same_row: bool = False,
column: int = 1,
row_span: int = 1,
column_span: int = 1):
if same_row:
row = self.row_number - 1
else:
row = self.row_number
self.row_number += 1
super(QGridLayout, self).addWidget(widget,
row,
column,
row_span,
column_span)
示例5: addLayout
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def addLayout(self,
widget: QWidget,
same_row: bool = False,
column: int = 1,
row_span: int = 1,
column_span: int = 1):
if same_row:
row = self.row_number - 1
else:
row = self.row_number
self.row_number += 1
super(QGridLayout, self).addLayout(widget,
row,
column,
row_span,
column_span)
示例6: __init__
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def __init__(self, viewer: QRemoteDesktop, parent: QWidget = None):
"""
:param viewer: the RDP viewer widget
:param parent: the parent widget
"""
super().__init__(parent, Qt.WindowFlags())
self.widget = viewer
self.writeInCaps = False
self.text = QTextEdit()
self.text.setReadOnly(True)
self.text.setMinimumHeight(150)
self.log = logging.getLogger(LOGGER_NAMES.PLAYER)
self.tabLayout = QVBoxLayout()
self.scrollViewer = QScrollArea()
self.scrollViewer.setWidget(self.widget)
self.tabLayout.addWidget(self.scrollViewer, 10)
self.tabLayout.addWidget(self.text, 2)
self.setLayout(self.tabLayout)
示例7: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例8: quickMsg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例9: create_widget
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def create_widget(widget_class, name, parent, data, *args):
# It is imperative this function return *some* value because Shiboken will try to deref what we return
# If we return nothing (or throw) there will be a null pointer deref (and we won't even get to see why)
# So in the event of an error or a nothing, return an empty widget that at least stops the crash
try:
widget = widget_class(parent, name, data, *args)
if not widget:
raise Exception('expected widget, got None')
global debug_dockwidgets
found = False
for (bv, widgets) in debug_dockwidgets:
if bv == data:
widgets[name] = widget
found = True
if not found:
debug_dockwidgets.append((data, {
name: widget
}))
widget.destroyed.connect(lambda destroyed: destroy_widget(destroyed, widget, data, name))
return widget
except Exception as e:
traceback.print_exc(file=sys.stderr)
return QWidget(parent)
示例10: active_view_wdg
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def active_view_wdg():
""" return the active 3d view wrapped in a QWidget """
view = active_view()
active_view_widget = shiboken2.wrapInstance(long(view.widget()), QWidget)
return active_view_widget
示例11: maya_main_window
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def maya_main_window():
""" return maya's main window wrapped in a QWidget """
pointer_main_window = omui.MQtUtil.mainWindow()
if pointer_main_window:
return shiboken2.wrapInstance(long(pointer_main_window), QWidget)
示例12: get_layout
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def get_layout(layout):
""" return a layout wraped as QObject """
ptr = omui.MQtUtil.findLayout(layout)
return shiboken2.wrapInstance(long(ptr), QWidget) #.layout()
示例13: maya_main_window
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def maya_main_window():
"""Get Maya's main window
Returns:
QMainWindow: main window.
"""
main_window_ptr = omui.MQtUtil.mainWindow()
return QtCompat.wrapInstance(long(main_window_ptr), QtWidgets.QWidget)
示例14: get_main_window
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def get_main_window():
import maya.OpenMayaUI as omui
import shiboken2
main_window = omui.MQtUtil.mainWindow()
if main_window is not None:
return shiboken2.wrapInstance(long(main_window), QtWidgets.QWidget)
示例15: __init__
# 需要導入模塊: from PySide2 import QtWidgets [as 別名]
# 或者: from PySide2.QtWidgets import QWidget [as 別名]
def __init__(self, parent=None):
super(TabbedWindow, self).__init__(parent)
widget1 = QWidget()
self.widget2 = ButtonAndLabel()
widget3 = QWidget()
self.addTab(widget1, "Tab 1")
self.addTab(self.widget2, "Tab 2")
self.addTab(widget3, "Tab 3")