我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用PyQt5.QtCore.Qt.RightDockWidgetArea()。
def _do_add_new_plot(self, plot_area_name): def remove(): self._plot_containers.remove(plc) plc = PlotContainerWidget(self, PLOT_AREAS[plot_area_name], self._active_data_types) plc.on_close = remove self._plot_containers.append(plc) docks = [ Qt.LeftDockWidgetArea, Qt.LeftDockWidgetArea, Qt.RightDockWidgetArea, Qt.RightDockWidgetArea, ] dock_to = docks[(len(self._plot_containers) - 1) % len(docks)] self.addDockWidget(dock_to, plc) if len(self._plot_containers) > 1: self.statusBar().showMessage('Drag plots by the header to rearrange or detach them')
def _create_projectview(self): """Spawn projectview.""" self.dock_projectview = QDockWidget() self.dock_projectview.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea) self.dock_projectview.setWidget(QTextEdit()) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_projectview)
def _create_templateview(self): """Spawn templateview.""" self.dock_templateview = QDockWidget() self.dock_templateview.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea | Qt.BottomDockWidgetArea) self.dock_templateview.setWidget(QTextEdit()) self.addDockWidget(Qt.BottomDockWidgetArea, self.dock_templateview)
def __init__(self, *__args): super(BinjaDockWidget, self).__init__(*__args) self._app = QtWidgets.QApplication.instance() self._main_window = [x for x in self._app.allWidgets() if x.__class__ is QtWidgets.QMainWindow][0] self._tool_menu = [x for x in self._main_window.menuWidget().children() if x.__class__ is QtWidgets.QMenu and x.title() == u'&Tools'][0] self._main_window.addDockWidget(Qt.RightDockWidgetArea, self) self._tabs = QtWidgets.QTabWidget() self._tabs.setTabPosition(QtWidgets.QTabWidget.East) self.setWidget(self._tabs) self.addToolMenuAction('Toggle plugin dock', self.toggle) self.hide()
def __init__(self): super(MainWindow, self).__init__() uiPath = resourceFileName( 'crispy:' + os.path.join('gui', 'uis', 'main.ui')) loadUi(uiPath, baseinstance=self, package='crispy.gui') self.setWindowTitle('Crispy - untitled.lua') self.splitter.setSizes((600, 0)) self.statusbar.showMessage('Ready') font = QFontDatabase.systemFont(QFontDatabase.FixedFont) font.setPointSize(font.pointSize() + 1) self.loggerWidget.setFont(font) self.loggerWidget.setLineWrapMode(QPlainTextEdit.NoWrap) # Quanty self.quantyDockWidget = QuantyDockWidget() self.addDockWidget(Qt.RightDockWidgetArea, self.quantyDockWidget) self.quantyDockWidget.setVisible(True) self.quantyRunCalculationAction.triggered.connect( self.quantyDockWidget.runCalculation) self.quantySaveInputAction.triggered.connect( self.quantyDockWidget.saveInput) self.quantySaveAsInputAction.triggered.connect( self.quantyDockWidget.saveInputAs) self.quantyLoadCalculations.triggered.connect( self.quantyDockWidget.loadCalculations) self.quantyRemoveAllCalculations.triggered.connect( self.quantyDockWidget.removeAllCalculations) self.quantyModuleShowAction.triggered.connect(self.quantyModuleShow) self.quantyModuleHideAction.triggered.connect(self.quantyModuleHide) # ORCA # self.orcaDockWidget = QDockWidget() # self.addDockWidget(Qt.RightDockWidgetArea, self.orcaDockWidget) # self.orcaDockWidget.setVisible(False)
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)