本文整理汇总了Python中PyQt5.QtWidgets.QDockWidget.setWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QDockWidget.setWidget方法的具体用法?Python QDockWidget.setWidget怎么用?Python QDockWidget.setWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QDockWidget
的用法示例。
在下文中一共展示了QDockWidget.setWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTreeView
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createTreeView(self):
dockWidget = QDockWidget()
dockWidget.setAllowedAreas(Qt.LeftDockWidgetArea)
dockWidget.setFeatures(QDockWidget.NoDockWidgetFeatures)
dockWidget.setTitleBarWidget(QWidget())
self.treeView = QTreeView()
self.treeView.clicked.connect(self.treeItemClicked)
self.treeModel = TreeModel()
self.treeView.setModel(self.treeModel)
self.logo = QLabel()
logoPixmap = QPixmap(CMAKE_INSTALL_PREFIX + '/share/jderobot/resources/jderobot.png')
self.logo.setPixmap(logoPixmap)
self.upButton = QPushButton()
self.upButton.setText('Up')
self.upButton.clicked.connect(self.upButtonClicked)
leftContainer = QWidget()
leftLayout = QVBoxLayout()
leftLayout.addWidget(self.treeView)
leftLayout.addWidget(self.upButton)
leftLayout.addWidget(self.logo)
leftContainer.setLayout(leftLayout)
dockWidget.setWidget(leftContainer)
self.addDockWidget(Qt.LeftDockWidgetArea, dockWidget)
示例2: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createDockWindows(self):
dock = QDockWidget("Available Garments Types", self)
#dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.availableItems = QListWidget(dock)
self.availableItems.setMinimumWidth(350)
self.availableItems.setMaximumWidth(350)
#self.availableItems.addItems(("stuff"))
self.availableItems.itemClicked.connect(self.itemClicked_Click)
dock.setWidget(self.availableItems)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock.hide()
self.dock = QDockWidget("Available Garment Sizes", self)
self.orderItem = QTreeWidget(dock)
#self.orderItem.setMinimumWidth(350)
#self.orderItem.setMaximumWidth(350)
#self.orderItem.insertText(("more stuff"))
self.dock.setWidget(self.orderItem)
self.addDockWidget(Qt.RightDockWidgetArea, self.dock)
self.viewMenu.addAction(self.dock.toggleViewAction())
self.dock.hide()
#Create a tree widget for use when the t-shirt is clicked.
self.treeDock = QDockWidget("Order Items", self)
self.garmentTree = QTreeWidget(self.treeDock)
self.garmentTree.setObjectName('garmentTree')
self.garmentTree.itemClicked.connect(CSRWidgets.sumQuantity)
self.garmentTree.itemClicked.connect(lambda: CSRWidgets.updateNameDesign(self))
self.garmentTree.setMaximumWidth(480)
self.garmentTree.setMinimumWidth(480)
self.treeDock.hide()
示例3: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createDockWindows(self):
dock = QDockWidget("Folders", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
#Code to Create FileView Colums and FolderTree
self.FileView = QtWidgets.QColumnView()
self.FileView.setGeometry(QtCore.QRect(240, 10, 291, 281))
self.FolderTree = QtWidgets.QTreeView()
self.FolderTree.setGeometry(QtCore.QRect(10, 10, 221, 281))
FolderTree = self.FolderTree
#FolderTree.hidecolumn(1),... ?? to show only name column
#include FolderTree to a Dock at the left side
dock.setWidget(FolderTree)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
#set the model and rootpath for filling the FolderTree from self.ui
dirmodel = QFileSystemModel()
#set filter to show only folders
dirmodel.setFilter(QDir.NoDotAndDotDot | QDir.AllDirs)
dirmodel.setRootPath(rootpath)
#filemodel and filter for only files on right side
filemodel = QFileSystemModel()
filemodel.setFilter(QDir.NoDotAndDotDot | QDir.Files)
filemodel.setRootPath(rootpath)
FolderView = self.FolderTree
FolderView.setModel(dirmodel)
FolderView.setRootIndex(dirmodel.index(rootpath))
FileView = self.FileView
FileView.setModel(filemodel)
dock = QDockWidget("Files", self)
dock.setWidget(FileView)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
#important lines for the connection, which does not work
self.FolderTree.clicked['QModelIndex'].connect(self.setpathonclick)
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.propertyToId = QMap()
self.idToProperty = QMap()
self.idToExpanded = QMap()
editMenu = self.menuBar().addMenu(self.tr("Edit"))
newObjectMenu = editMenu.addMenu(self.tr("New Object"))
newRectangleAction = QAction(self.tr("Rectangle"), self)
newRectangleAction.triggered.connect(self.newRectangle)
newObjectMenu.addAction(newRectangleAction)
newLineAction = QAction(self.tr("Line"), self)
newLineAction.triggered.connect(self.newLine)
newObjectMenu.addAction(newLineAction)
newEllipseAction = QAction(self.tr("Ellipse"), self)
newEllipseAction.triggered.connect(self.newEllipse)
newObjectMenu.addAction(newEllipseAction)
newTextAction = QAction(self.tr("Text"), self)
newTextAction.triggered.connect(self.newText)
newObjectMenu.addAction(newTextAction)
self.deleteAction = QAction(self.tr("Delete Object"), self)
self.deleteAction.triggered.connect(self.deleteObject)
editMenu.addAction(self.deleteAction)
clearAction = QAction(self.tr("Clear All"), self)
clearAction.triggered.connect(self.clearAll)
editMenu.addAction(clearAction)
fillAction = QAction(self.tr("Fill View"), self)
fillAction.triggered.connect(self.fillView)
editMenu.addAction(fillAction)
self.variantManager = QtVariantPropertyManager(self)
self.variantManager.valueChangedSignal.connect(self.valueChanged)
variantFactory = QtVariantEditorFactory(self)
self.canvas = QtCanvas(800, 600)
self.canvasView = CanvasView(self.canvas, self)
self.setCentralWidget(self.canvasView)
dock = QDockWidget(self)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.propertyEditor = QtTreePropertyBrowser(dock)
self.propertyEditor.setFactoryForManager(self.variantManager, variantFactory)
dock.setWidget(self.propertyEditor)
self.currentItem = QtCanvasItem(None)
self.canvasView.itemClickedSignal.connect(self.itemClicked)
self.canvasView.itemMovedSignal.connect(self.itemMoved)
self.fillView()
self.itemClicked(QtCanvasItem(None))
示例5: createWidgets
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createWidgets(self):
"""Cette fonction permet la création de tous les widgets de la
mainWindow"""
#Création toolbar
toolBar = self.addToolBar("Tools")
#Création bar recherche
self.lineEditSearch = QLineEdit()
self.lineEditSearch.setPlaceholderText("Recherche")
self.lineEditSearch.setStyleSheet("background-color:white")
toolBar.addWidget(self.lineEditSearch)
self.lineEditSearch.setMaximumWidth(300)
#Création séparateur
toolBar.addSeparator()
#Création icon add contact
self.actionAdd = QAction("Ajouter (Ctrl+P)",self)
toolBar.addAction(self.actionAdd)
self.actionAdd.setShortcut("Ctrl+P")
self.actionAdd.setIcon(QIcon("Pictures/sign.png"))
#Création icon delete contact
self.actionDelete = QAction("supprimer (Ctrl+D)",self)
toolBar.addAction(self.actionDelete)
self.actionDelete.setShortcut("Ctrl+D")
self.actionDelete.setIcon(QIcon("Pictures/contacts.png"))
#Création icon quit
self.actionQuitter = QAction("Quitter (Ctrl+Q)",self)
toolBar.addAction(self.actionQuitter)
self.actionQuitter.setShortcut("Ctrl+Q")
self.actionQuitter.setIcon(QIcon("Pictures/arrows.png"))
#Création widget central
self.centralWidget = QWidget()
self.centralWidget.setStyleSheet("background-color:white")
self.setCentralWidget(self.centralWidget)
#Création dockWidget left
dockDisplay = QDockWidget("Répertoire")
dockDisplay.setStyleSheet("background-color:white")
dockDisplay.setFeatures(QDockWidget.DockWidgetFloatable)
dockDisplay.setAllowedAreas(Qt.LeftDockWidgetArea |
Qt.RightDockWidgetArea)
self.addDockWidget(Qt.LeftDockWidgetArea,dockDisplay)
containDock = QWidget(dockDisplay)
dockDisplay.setWidget(containDock)
dockLayout = QVBoxLayout()
displayWidget = QScrollArea()
displayWidget.setWidgetResizable(1)
dockLayout.addWidget(displayWidget)
containDock.setLayout(dockLayout)
#Ajouter la list au dockwidget
self.listContact = QListWidget()
displayWidget.setWidget(self.listContact)
示例6: initoptionspanel
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def initoptionspanel(self):
label = QLabel('Filter')
filtertype = QComboBox()
filtertype.addItem('None')
filtertype.addItem('Lowpass')
filtertype.addItem('Highpass')
filtertype.addItem('Bandreject')
filtertype.addItem('Bandpass')
filtertype.currentIndexChanged.connect(self.filtertypelistener)
self.filterfunction = QComboBox()
self.filterfunction.addItem('Ideal')
self.filterfunction.addItem('Butterworth')
self.filterfunction.addItem('Gaussian')
self.filterfunction.currentIndexChanged.connect(self.filterfunctionlistener)
self.filterfunction.setEnabled(False)
self.filtercutoff = QDoubleSpinBox()
self.filtercutoff.setValue(0.0)
self.filtercutoff.setRange(0.0, 10000.0)
self.filtercutoff.valueChanged.connect(self.filtercutofflistener)
self.filtercutoff.setEnabled(False)
self.filterbandwidth = QDoubleSpinBox()
self.filterbandwidth.setValue(1.0)
self.filterbandwidth.setRange(0.0, 10000.0)
self.filterbandwidth.valueChanged.connect(self.filterbandwidthlistener)
self.filterbandwidth.setEnabled(False)
self.filterorder = QDoubleSpinBox()
self.filterorder.setValue(1.0)
self.filterorder.setRange(0.0, 10000.0)
self.filterorder.valueChanged.connect(self.filterorderlistener)
self.filterorder.setEnabled(False)
loader = QMovie('loader.gif')
loader.start()
self.loadercontainer = QLabel()
self.loadercontainer.setMovie(loader)
self.loadercontainer.setVisible(False)
formlayout = QFormLayout()
formlayout.addRow('Type', filtertype)
formlayout.addRow('Function', self.filterfunction)
formlayout.addRow('Cut off', self.filtercutoff)
formlayout.addRow('Bandwidth', self.filterbandwidth)
formlayout.addRow('Order', self.filterorder)
formlayout.addRow('', self.loadercontainer)
filterbox = QGroupBox('Filter')
filterbox.setLayout(formlayout)
options = QDockWidget('Options')
options.setFeatures(QDockWidget.DockWidgetFloatable)
options.setFeatures(QDockWidget.DockWidgetMovable)
options.setWidget(filterbox)
self.addDockWidget(Qt.RightDockWidgetArea, options)
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def __init__(self):
super(AssetWindow, self).__init__()
self.prevDockWidget = None
aw = AssetWidget(self)
qd = QDockWidget()
qd.setWidget(aw)
self.setCentralWidget(qd)
self.setMinimumSize(480,360)
self.setMaximumSize(1920,1080)
self.setDockOptions(QMainWindow.AnimatedDocks | QMainWindow.ForceTabbedDocks);
示例8: add_view
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def add_view(self, name, widget,parent,first):
dock = QDockWidget(name, self)
dock.setAllowedAreas(Qt.AllDockWidgetAreas)
dock.setWidget(widget)
widget.show()
if first :
self.addDockWidget(Qt.TopDockWidgetArea, dock)
else :
self.tabifyDockWidget(parent,dock)
return dock
示例9: _createDock
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def _createDock(self, widgetClass, widgetName, widgetArea, *param):
"""创建停靠组件"""
widget = widgetClass(*param)
dock = QDockWidget(widgetName, self)
dock.setWidget(widget)
dock.setObjectName(widgetName)
dock.setFeatures(QDockWidget.NoDockWidgetFeatures)
self.addDockWidget(widgetArea, dock)
return widget, dock
示例10: initinformationpanel
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def initinformationpanel(self):
self.mselabel = QLabel('No image selected')
infoform = QFormLayout()
infoform.addRow('MSE:', self.mselabel)
imagebox = QGroupBox('Image')
imagebox.setLayout(infoform)
information = QDockWidget('Information')
information.setFeatures(QDockWidget.DockWidgetFloatable)
information.setFeatures(QDockWidget.DockWidgetMovable)
information.setWidget(imagebox)
self.addDockWidget(Qt.RightDockWidgetArea, information)
示例11: new_docked
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def new_docked(self, widget, name, title, dock_area, hiden=False):
dock = QDockWidget()
dock.setWindowTitle(title)
dock.setWidget(widget)
if hiden:
dock.hide()
else:
dock.show()
self.main_window.addDockWidget(dock_area, dock)
self.modules_dock[name] = dock
return dock
示例12: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createDockWindows(self):
# dock for project files
dock = QDockWidget("Project", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.projectTreeView= TreeView(dock)
dock.setWidget(self.projectTreeView)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
# dock for html preview
dock = QDockWidget("Preview", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.previewView= HtmlView(dock)
dock.setWidget(self.previewView)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
示例13: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createDockWindows(self):
dock = QDockWidget("Customers", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.customerList = QListWidget(dock)
self.customerList.addItems((
"John Doe, Harmony Enterprises, 12 Lakeside, Ambleton",
"Jane Doe, Memorabilia, 23 Watersedge, Beaton",
"Tammy Shea, Tiblanka, 38 Sea Views, Carlton",
"Tim Sheen, Caraba Gifts, 48 Ocean Way, Deal",
"Sol Harvey, Chicos Coffee, 53 New Springs, Eccleston",
"Sally Hobart, Tiroli Tea, 67 Long River, Fedula"))
dock.setWidget(self.customerList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Paragraphs", self)
self.paragraphsList = QListWidget(dock)
self.paragraphsList.addItems((
"Thank you for your payment which we have received today.",
"Your order has been dispatched and should be with you within "
"28 days.",
"We have dispatched those items that were in stock. The rest of "
"your order will be dispatched once all the remaining items "
"have arrived at our warehouse. No additional shipping "
"charges will be made.",
"You made a small overpayment (less than $5) which we will keep "
"on account for you, or return at your request.",
"You made a small underpayment (less than $1), but we have sent "
"your order anyway. We'll add this underpayment to your next "
"bill.",
"Unfortunately you did not send enough money. Please remit an "
"additional $. Your order will be dispatched as soon as the "
"complete amount has been received.",
"You made an overpayment (more than $5). Do you wish to buy more "
"items, or should we return the excess to you?"))
dock.setWidget(self.paragraphsList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.customerList.currentTextChanged.connect(self.insertCustomer)
self.paragraphsList.currentTextChanged.connect(self.addParagraph)
示例14: createDockWindows
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
def createDockWindows(self):
dock = QDockWidget("Sensors", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.sensors= Sensors(dock)
dock.setWidget(self.sensors)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Environment", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.environmentList = QListWidget(dock)
self.environmentList.addItems((
"Omnidirectional Sensor Networks",
"Directional Sensor Networks",
"Directional Path Tracking",
"Big Target Coverage"))
dock.setWidget(self.environmentList)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Simulation", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.simulation= Simulation(dock)
dock.setWidget(self.simulation)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
dock = QDockWidget("Console", self)
dock.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
self.console= Console(dock)
dock.setWidget(self.console)
self.addDockWidget(Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.console.applyButton.clicked.connect(self.applyButtonState)
self.console.playButton.clicked.connect(self.playButtonState)
self.console.pauseButton.clicked.connect(self.pauseButtonState)
self.environmentList.currentTextChanged.connect(self.changeEnvironment)
示例15: Window
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setWidget [as 别名]
#.........这里部分代码省略.........
"""
self.input_buffer = []
self.serial = QSerialPort()
self.serial.setPortName(port)
if self.serial.open(QIODevice.ReadWrite):
self.serial.dataTerminalReady = True
if not self.serial.isDataTerminalReady():
# Using pyserial as a 'hack' to open the port and set DTR
# as QtSerial does not seem to work on some Windows :(
# See issues #281 and #302 for details.
self.serial.close()
pyser = serial.Serial(port) # open serial port w/pyserial
pyser.dtr = True
pyser.close()
self.serial.open(QIODevice.ReadWrite)
self.serial.setBaudRate(115200)
self.serial.readyRead.connect(self.on_serial_read)
else:
raise IOError("Cannot connect to device on port {}".format(port))
def close_serial_link(self):
"""
Close and clean up the currently open serial link.
"""
self.serial.close()
self.serial = None
def add_filesystem(self, home, file_manager):
"""
Adds the file system pane to the application.
"""
self.fs_pane = FileSystemPane(home)
self.fs = QDockWidget(_('Filesystem on micro:bit'))
self.fs.setWidget(self.fs_pane)
self.fs.setFeatures(QDockWidget.DockWidgetMovable)
self.fs.setAllowedAreas(Qt.BottomDockWidgetArea)
self.addDockWidget(Qt.BottomDockWidgetArea, self.fs)
self.fs_pane.setFocus()
file_manager.on_list_files.connect(self.fs_pane.on_ls)
self.fs_pane.list_files.connect(file_manager.ls)
self.fs_pane.microbit_fs.put.connect(file_manager.put)
self.fs_pane.microbit_fs.delete.connect(file_manager.delete)
self.fs_pane.microbit_fs.list_files.connect(file_manager.ls)
self.fs_pane.local_fs.get.connect(file_manager.get)
self.fs_pane.local_fs.list_files.connect(file_manager.ls)
file_manager.on_put_file.connect(self.fs_pane.microbit_fs.on_put)
file_manager.on_delete_file.connect(self.fs_pane.microbit_fs.on_delete)
file_manager.on_get_file.connect(self.fs_pane.local_fs.on_get)
file_manager.on_list_fail.connect(self.fs_pane.on_ls_fail)
file_manager.on_put_fail.connect(self.fs_pane.on_put_fail)
file_manager.on_delete_fail.connect(self.fs_pane.on_delete_fail)
file_manager.on_get_fail.connect(self.fs_pane.on_get_fail)
self.connect_zoom(self.fs_pane)
return self.fs_pane
def add_micropython_repl(self, port, name):
"""
Adds a MicroPython based REPL pane to the application.
"""
if not self.serial:
self.open_serial_link(port)
# Send a Control-C / keyboard interrupt.
self.serial.write(b'\x03')
repl_pane = MicroPythonREPLPane(serial=self.serial, theme=self.theme)
self.data_received.connect(repl_pane.process_bytes)
self.add_repl(repl_pane, name)