本文整理汇总了Python中PyQt5.QtWidgets.QDockWidget.setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:Python QDockWidget.setStyleSheet方法的具体用法?Python QDockWidget.setStyleSheet怎么用?Python QDockWidget.setStyleSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QDockWidget
的用法示例。
在下文中一共展示了QDockWidget.setStyleSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createWidgets
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setStyleSheet [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)
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QDockWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QDockWidget import setStyleSheet [as 别名]
def __init__(self,mainwin):
te = QPlainTextEdit()
hilighter = hilite.Highlighter(te.document())
qd = QDockWidget("Dae:Xgm")
qd.setWidget(te)
qd.setMinimumSize(480,240)
qd.setFeatures(QDockWidget.DockWidgetMovable|QDockWidget.DockWidgetVerticalTitleBar|QDockWidget.DockWidgetFloatable)
qd.setAllowedAreas(Qt.LeftDockWidgetArea)
qdss = "QWidget{background-color: rgb(64,64,128); color: rgb(160,160,192);}"
qdss += "QDockWidget::title {background-color: rgb(32,32,48); color: rgb(255,0,0);}"
qd.setStyleSheet(qdss)
mainwin.addDockWidget(Qt.LeftDockWidgetArea,qd)
if mainwin.prevDockWidget!=None:
mainwin.tabifyDockWidget(mainwin.prevDockWidget,qd)
mainwin.prevDockWidget = qd
self.stdout = ""
self.stderr = ""
def onSubProcStdout():
bytes = self.process.readAllStandardOutput()
self.stdout += str(bytes, encoding='ascii')
te.setPlainText(self.stdout+self.stderr)
def onSubProcStderr():
bytes = self.process.readAllStandardError()
self.stderr += str(bytes, encoding='ascii')
te.setPlainText(self.stdout+self.stderr)
def finished(text):
print( "process done...\n")
self.process = QProcess()
self.process.readyReadStandardError.connect(onSubProcStderr)
self.process.readyReadStandardOutput.connect(onSubProcStdout);
self.process.finished.connect(finished);
self.process.start(cmd)