本文整理汇总了Python中PyQt5.QtWidgets.QDockWidget类的典型用法代码示例。如果您正苦于以下问题:Python QDockWidget类的具体用法?Python QDockWidget怎么用?Python QDockWidget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDockWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parentObject, windowTitle, windowIcon=QIcon(), shortcut=None):
QDockWidget.__init__(self, parentObject)
self._showAction = None
self.setObjectName(str(self.__class__))
self.setWindowTitle(windowTitle)
self.setFeatures(self.features() & (~QDockWidget.DockWidgetFloatable))
if not windowIcon.isNull():
self.setWindowIcon(windowIcon)
if shortcut is not None:
self.showAction().setShortcut(shortcut)
self._titleBar = _TitleBar(self)
self.setTitleBarWidget(self._titleBar)
if shortcut is not None:
toolTip = "Move focus with <b>%s</b>,<br/>close with <b>Esc</b>" % shortcut
else:
toolTip = "Close with <b>Esc</b>"
self._titleBar.setToolTip(toolTip)
self._closeShortcut = QShortcut(QKeySequence("Esc"), self)
self._closeShortcut.setContext(Qt.WidgetWithChildrenShortcut)
self._closeShortcut.activated.connect(self._close)
示例2: __init__
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))
示例3: keyPressEvent
def keyPressEvent(self, event):
"""Catch Esc. Not using QShortcut, because dock shall be closed,
only if child widgets haven't catched Esc event
"""
if event.key() == Qt.Key_Escape and \
event.modifiers() == Qt.NoModifier:
self._hide()
else:
QDockWidget.keyPressEvent(self, event)
示例4: add_view
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
示例5: __init__
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);
示例6: createTreeView
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)
示例7: createWidgets
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)
示例8: createDockWindows
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)
示例9: createDockWindows
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()
示例10: __init__
def __init__(self, parent, plugin):
self.plugin = plugin
QDockWidget.__init__(self, parent)
self.setupUi(self)
self.btnApply.setIcon(QIcon(":plugins/nominatim/arrow_green.png"))
self.btnMask.setIcon(QIcon(":plugins/nominatim/add_mask.png"))
self.btnLayer.setIcon(QIcon(":plugins/nominatim/add_layer.png"))
self.tableResult.installEventFilter(self) # cf. eventFilter method
self.tableResult.cellDoubleClicked.connect(self.onChoose)
self.tableResult.cellEntered.connect(self.cellEntered)
self.editSearch.returnPressed.connect(self.onReturnPressed)
self.btnSearch.clicked.connect(self.onReturnPressed)
self.btnApply.clicked.connect(self.onApply)
self.btnHelp.clicked.connect(self.plugin.do_help)
self.btnLocalize.clicked.connect(self.doLocalize)
self.btnMask.clicked.connect(self.onMask)
self.btnLayer.clicked.connect(self.onLayer)
self.MultiPolygonLayerId = None
self.LineLayerId = None
self.PointLayerId = None
try:
self.cbExtent.setChecked(self.plugin.limitSearchToExtent)
except:
self.cbExtent.setChecked(self.plugin.limitSearchToExtent)
self.currentExtent = self.plugin.canvas.extent()
self.tableResult.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
try:
self.editSearch.setText(self.plugin.lastSearch)
except:
pass
try:
if self.plugin.localiseOnStartup:
self.doLocalize()
except Exception as e:
for m in e.args:
QgsMessageLog.logMessage(m, 'Extensions')
pass
self.nominatim_networkAccessManager = QgsNetworkAccessManager.instance()
示例11: add_filesystem
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
示例12: _initMaya
def _initMaya(self):
"""
Initialize Maya-related state. Delete Maya nodes if there
is an old document left over from the same session. Set up
the Maya window.
"""
# There will only be one document
if (app().active_document and app().active_document.win and
not app().active_document.win.close()):
return
del app().active_document
app().active_document = self
import maya.OpenMayaUI as OpenMayaUI
import sip
ptr = OpenMayaUI.MQtUtil.mainWindow()
mayaWin = sip.wrapinstance(int(ptr), QMainWindow)
self.windock = QDockWidget("cadnano")
self.windock.setFeatures(QDockWidget.DockWidgetMovable
| QDockWidget.DockWidgetFloatable)
self.windock.setAllowedAreas(Qt.LeftDockWidgetArea
| Qt.RightDockWidgetArea)
self.windock.setWidget(self.win)
mayaWin.addDockWidget(Qt.DockWidgetArea(Qt.LeftDockWidgetArea),
self.windock)
self.windock.setVisible(True)
示例13: titleBarWidget
def titleBarWidget(self):
"""QToolBar on the title.
You may add own actions to this tool bar
"""
# method was added only for documenting
return QDockWidget.titleBarWidget(self)
示例14: _createElectronicsControl
def _createElectronicsControl(self):
"""Creates a tabbed widget of voltage clamp and current clamp controls"""
self._electronicsTab = QTabWidget(self)
self._electronicsTab.addTab(self._getIClampCtrlBox(), 'Current clamp')
self._electronicsTab.addTab(self._getVClampCtrlBox(), 'Voltage clamp')
self._electronicsDock = QDockWidget(self)
self._electronicsDock.setWidget(self._electronicsTab)
示例15: new_docked
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