Initial versions for better scaling stylesheets.

main
Alex Huszagh 2021-07-13 22:46:41 -05:00
parent ed4d3b1f69
commit 55c738813e
19 changed files with 3120 additions and 3139 deletions

View File

@ -3,6 +3,8 @@ BreezeStyleSheets
Breeze and BreezeDark-like stylesheets for Qt Applications.
This stylesheet aims to be similar across all platforms, and provide a nice UI for different font sizes. This is currently under work for scaling to multiple different DPIs and font sizes.
C++ Installation
================
@ -66,7 +68,6 @@ def main():
# code goes here
app.exec_()
}
```
License

File diff suppressed because it is too large Load Diff

94
dark.py
View File

@ -1,94 +0,0 @@
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
"""
A simple example of use.
Load an ui made in QtDesigner and apply the DarkStyleSheet.
Requirements:
- Python 2 or Python 3
- PyQt4
.. note.. :: qdarkstyle does not have to be installed to run
the example
"""
import logging
import sys
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QFile, QTextStream
# make the example runnable without the need to install
import example
import breeze_resources
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtWidgets.QApplication(sys.argv)
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window = QtWidgets.QMainWindow()
# setup ui
ui = example.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("BreezeDark example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
file = QFile(":/dark.qss")
file.open(QFile.ReadOnly | QFile.Text)
stream = QTextStream(file)
app.setStyleSheet(stream.readAll())
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
if __name__ == "__main__":
main()

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,0.91769718 4.5,4.2280182 7.8105408,0.91627648 c 0.1577125,-0.157702 0.4134624,-0.157702 0.5711749,0 0.1577124,0.15770202 0.1577124,0.41343492 0,0.57113692 l -3.5961283,3.5973102 0,0 0,0 c -0.1577124,0.1577019 -0.4134624,0.1577019 -0.5711748,0 L 0.6182843,1.4874134 c -0.1577124,-0.157702 -0.1577124,-0.4134349 0,-0.57113692 0.1577125,-0.15628131 0.4134624,-0.15628131 0.5711749,0.00142 z" fill="#3daee9"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 502 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,0.91769718 4.5,4.2280182 7.8105408,0.91627648 c 0.1577125,-0.157702 0.4134624,-0.157702 0.5711749,0 0.1577124,0.15770202 0.1577124,0.41343492 0,0.57113692 l -3.5961283,3.5973102 0,0 0,0 c -0.1577124,0.1577019 -0.4134624,0.1577019 -0.5711748,0 L 0.6182843,1.4874134 c -0.1577124,-0.157702 -0.1577124,-0.4134349 0,-0.57113692 0.1577125,-0.15628131 0.4134624,-0.15628131 0.5711749,0.00142 z" fill="#fff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 499 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,0.91769718 4.5,4.2280182 7.8105408,0.91627648 c 0.1577125,-0.157702 0.4134624,-0.157702 0.5711749,0 0.1577124,0.15770202 0.1577124,0.41343492 0,0.57113692 l -3.5961283,3.5973102 0,0 0,0 c -0.1577124,0.1577019 -0.4134624,0.1577019 -0.5711748,0 L 0.6182843,1.4874134 c -0.1577124,-0.157702 -0.1577124,-0.4134349 0,-0.57113692 0.1577125,-0.15628131 0.4134624,-0.15628131 0.5711749,0.00142 z" fill="#b0b0b0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 502 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="6px" height="9px" viewBox="0 0 6 9" enable-background="new 0 0 6 9" xml:space="preserve">
<svg width="60" height="90">
<g transform="scale(10)">
<path d="m 5.0823028,1.1894593 -3.310321,3.3105408 3.3117417,3.3105408 c 0.157702,0.1577125 0.157702,0.4134624 0,0.5711749 -0.157702,0.1577123 -0.4134349,0.1577123 -0.5711369,0 l -3.59731017,-3.5961283 0,0 0,0 c -0.15770191,-0.1577124 -0.15770191,-0.4134624 0,-0.5711748 L 4.5125866,0.61828437 c 0.157702,-0.1577124 0.4134349,-0.1577124 0.5711369,0 0.1562813,0.1577125 0.1562813,0.41346243 -0.00142,0.57117493 z" fill="#fff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 502 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="6px" height="9px" viewBox="0 0 6 9" enable-background="new 0 0 6 9" xml:space="preserve">
<svg width="60" height="90">
<g transform="scale(10)">
<path d="m 5.0823028,1.1894593 -3.310321,3.3105408 3.3117417,3.3105408 c 0.157702,0.1577125 0.157702,0.4134624 0,0.5711749 -0.157702,0.1577123 -0.4134349,0.1577123 -0.5711369,0 l -3.59731017,-3.5961283 0,0 0,0 c -0.15770191,-0.1577124 -0.15770191,-0.4134624 0,-0.5711748 L 4.5125866,0.61828437 c 0.157702,-0.1577124 0.4134349,-0.1577124 0.5711369,0 0.1562813,0.1577125 0.1562813,0.41346243 -0.00142,0.57117493 z" fill="#b0b0b0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 505 B

View File

@ -1,3 +1,5 @@
<svg width="6" height="9">
<svg width="60" height="90">
<g transform="scale(10)">
<path d="m 0.9166972,1.1894593 3.310321,3.3105408 -3.3117417,3.3105408 c -0.157702,0.1577125 -0.157702,0.4134624 0,0.5711749 0.157702,0.1577123 0.4134349,0.1577123 0.5711369,0 l 3.5973102,-3.5961283 0,0 0,0 c 0.1577019,-0.1577124 0.1577019,-0.4134624 0,-0.5711748 L 1.4864134,0.61828437 c -0.157702,-0.1577124 -0.4134349,-0.1577124 -0.5711369,0 -0.1562813,0.1577125 -0.1562813,0.41346243 0.00142,0.57117493 z" fill="#fff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 460 B

After

Width:  |  Height:  |  Size: 499 B

View File

@ -1,3 +1,5 @@
<svg width="6" height="9">
<svg width="60" height="90">
<g transform="scale(10)">
<path d="m 0.9166972,1.1894593 3.310321,3.3105408 -3.3117417,3.3105408 c -0.157702,0.1577125 -0.157702,0.4134624 0,0.5711749 0.157702,0.1577123 0.4134349,0.1577123 0.5711369,0 l 3.5973102,-3.5961283 0,0 0,0 c 0.1577019,-0.1577124 0.1577019,-0.4134624 0,-0.5711748 L 1.4864134,0.61828437 c -0.157702,-0.1577124 -0.4134349,-0.1577124 -0.5711369,0 -0.1562813,0.1577125 -0.1562813,0.41346243 0.00142,0.57117493 z" fill="#b0b0b0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 463 B

After

Width:  |  Height:  |  Size: 502 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,5.0833028 4.5,1.7729818 7.8105408,5.0847235 c 0.1577125,0.157702 0.4134624,0.157702 0.5711749,0 0.1577124,-0.157702 0.1577124,-0.4134349 0,-0.5711369 l -3.5961283,-3.59731019 0,0 0,0 c -0.1577124,-0.1577019 -0.4134624,-0.1577019 -0.5711748,0 L 0.6182843,4.5135866 c -0.1577124,0.157702 -0.1577124,0.4134349 0,0.5711369 0.1577125,0.1562813 0.4134624,0.1562813 0.5711749,-0.00142 z" fill="#3daee9"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 494 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,5.0833028 4.5,1.7729818 7.8105408,5.0847235 c 0.1577125,0.157702 0.4134624,0.157702 0.5711749,0 0.1577124,-0.157702 0.1577124,-0.4134349 0,-0.5711369 l -3.5961283,-3.59731019 0,0 0,0 c -0.1577124,-0.1577019 -0.4134624,-0.1577019 -0.5711748,0 L 0.6182843,4.5135866 c -0.1577124,0.157702 -0.1577124,0.4134349 0,0.5711369 0.1577125,0.1562813 0.4134624,0.1562813 0.5711749,-0.00142 z" fill="#fff"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 491 B

View File

@ -1,3 +1,5 @@
<svg x="0px" y="0px" width="9px" height="6px" viewBox="0 0 9 6" enable-background="new 0 0 9 6" xml:space="preserve">
<svg width="90" height="60">
<g transform="scale(10)">
<path d="M 1.1894592,5.0833028 4.5,1.7729818 7.8105408,5.0847235 c 0.1577125,0.157702 0.4134624,0.157702 0.5711749,0 0.1577124,-0.157702 0.1577124,-0.4134349 0,-0.5711369 l -3.5961283,-3.59731019 0,0 0,0 c -0.1577124,-0.1577019 -0.4134624,-0.1577019 -0.5711748,0 L 0.6182843,4.5135866 c -0.1577124,0.157702 -0.1577124,0.4134349 0,0.5711369 0.1577125,0.1562813 0.4134624,0.1562813 0.5711749,-0.00142 z" fill="#b0b0b0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 546 B

After

Width:  |  Height:  |  Size: 494 B

View File

@ -1,51 +1,98 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
# Modified by Alex Huszagh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Form implementation generated from reading ui file 'example.ui'
#
# Created by: PyQt5 UI code generator 5.4.2
#
# WARNING! All changes made in this file will be lost!
'''
example
=======
'''
import argparse
import logging
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import breeze_resources
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
# Create our arguments.
parser = argparse.ArgumentParser(description='Configurations for the Qt5 application.')
parser.add_argument(
'--stylesheet',
help='''stylesheet name''',
default='native'
)
parser.add_argument(
'--font-size',
help='''font size for the application''',
type=float,
default=-1
)
parser.add_argument(
'--font-family',
help='''the font family'''
)
class Ui:
'''Main class for the user interface.'''
def setup(self, MainWindow):
MainWindow.setObjectName('MainWindow')
MainWindow.resize(1068, 824)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.centralwidget.setObjectName('centralwidget')
self.verticalLayout_5 = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.verticalLayout_5.setObjectName('verticalLayout_5')
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.East)
self.tabWidget.setTabsClosable(True)
self.tabWidget.setObjectName("tabWidget")
self.tabWidget.setObjectName('tabWidget')
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.tab.setObjectName('tab')
self.gridLayout = QtWidgets.QGridLayout(self.tab)
self.gridLayout.setObjectName("gridLayout")
self.gridLayout.setObjectName('gridLayout')
self.groupBox = QtWidgets.QGroupBox(self.tab)
self.groupBox.setObjectName("groupBox")
self.groupBox.setObjectName('groupBox')
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.groupBox)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout_3.setObjectName('verticalLayout_3')
self.toolBox = QtWidgets.QToolBox(self.groupBox)
self.toolBox.setObjectName("toolBox")
self.toolBox.setObjectName('toolBox')
self.page = QtWidgets.QWidget()
self.page.setGeometry(QtCore.QRect(0, 0, 718, 227))
self.page.setObjectName("page")
self.page.setObjectName('page')
self.gridLayout_4 = QtWidgets.QGridLayout(self.page)
self.gridLayout_4.setObjectName("gridLayout_4")
self.gridLayout_4.setObjectName('gridLayout_4')
self.lineEdit = QtWidgets.QLineEdit(self.page)
self.lineEdit.setObjectName("lineEdit")
self.lineEdit.setObjectName('lineEdit')
self.gridLayout_4.addWidget(self.lineEdit, 0, 0, 1, 1)
self.toolBox.addItem(self.page, "")
self.toolBox.addItem(self.page, '')
self.page_2 = QtWidgets.QWidget()
self.page_2.setGeometry(QtCore.QRect(0, 0, 718, 227))
self.page_2.setObjectName("page_2")
self.page_2.setObjectName('page_2')
self.gridLayout_5 = QtWidgets.QGridLayout(self.page_2)
self.gridLayout_5.setObjectName("gridLayout_5")
self.gridLayout_5.setObjectName('gridLayout_5')
self.listWidget = QtWidgets.QListWidget(self.page_2)
self.listWidget.setObjectName("listWidget")
self.listWidget.setObjectName('listWidget')
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
@ -63,34 +110,34 @@ class Ui_MainWindow(object):
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
self.gridLayout_5.addWidget(self.listWidget, 0, 0, 1, 1)
self.toolBox.addItem(self.page_2, "")
self.toolBox.addItem(self.page_2, '')
self.verticalLayout_3.addWidget(self.toolBox)
self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1)
self.tabWidget_2 = QtWidgets.QTabWidget(self.tab)
self.tabWidget_2.setObjectName("tabWidget_2")
self.tabWidget_2.setObjectName('tabWidget_2')
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
self.tab_3.setObjectName('tab_3')
self.gridLayout_6 = QtWidgets.QGridLayout(self.tab_3)
self.gridLayout_6.setObjectName("gridLayout_6")
self.gridLayout_6.setObjectName('gridLayout_6')
self.checkableButton = QtWidgets.QPushButton(self.tab_3)
self.checkableButton.setCheckable(True)
self.checkableButton.setChecked(True)
self.checkableButton.setObjectName("checkableButton")
self.checkableButton.setObjectName('checkableButton')
self.gridLayout_6.addWidget(self.checkableButton, 1, 0, 1, 1)
self.pushButton = QtWidgets.QPushButton(self.tab_3)
self.pushButton.setObjectName("pushButton")
self.pushButton.setObjectName('pushButton')
self.pushButton.setToolTip('Sample Tooltip1')
self.gridLayout_6.addWidget(self.pushButton, 0, 0, 1, 1)
self.pushButton_5 = QtWidgets.QPushButton(self.tab_3)
self.pushButton_5.setObjectName("pushButton_5")
self.pushButton_5.setObjectName('pushButton_5')
self.gridLayout_6.addWidget(self.pushButton_5, 2, 0, 1, 1)
self.tabWidget_2.addTab(self.tab_3, "")
self.tabWidget_2.addTab(self.tab_3, '')
self.tab_5 = QtWidgets.QWidget()
self.tab_5.setObjectName("tab_5")
self.tab_5.setObjectName('tab_5')
self.gridLayout_7 = QtWidgets.QGridLayout(self.tab_5)
self.gridLayout_7.setObjectName("gridLayout_7")
self.gridLayout_7.setObjectName('gridLayout_7')
self.tableWidget = QtWidgets.QTableWidget(self.tab_5)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setObjectName('tableWidget')
self.tableWidget.setColumnCount(2)
self.tableWidget.setRowCount(4)
item = QtWidgets.QTableWidgetItem()
@ -106,138 +153,138 @@ class Ui_MainWindow(object):
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
self.gridLayout_7.addWidget(self.tableWidget, 0, 0, 1, 1)
self.tabWidget_2.addTab(self.tab_5, "")
self.tabWidget_2.addTab(self.tab_5, '')
self.tab_4 = QtWidgets.QWidget()
self.tab_4.setObjectName("tab_4")
self.tabWidget_2.addTab(self.tab_4, "")
self.tab_4.setObjectName('tab_4')
self.tabWidget_2.addTab(self.tab_4, '')
self.gridLayout.addWidget(self.tabWidget_2, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab, "")
self.tabWidget.addTab(self.tab, '')
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.tab_2.setObjectName('tab_2')
self.gridLayout_2 = QtWidgets.QGridLayout(self.tab_2)
self.gridLayout_2.setObjectName("gridLayout_2")
self.gridLayout_2.setObjectName('gridLayout_2')
self.groupBox_2 = QtWidgets.QGroupBox(self.tab_2)
self.groupBox_2.setObjectName("groupBox_2")
self.groupBox_2.setObjectName('groupBox_2')
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.verticalLayout_4.setObjectName('verticalLayout_4')
self.label = QtWidgets.QLabel(self.groupBox_2)
self.label.setObjectName("label")
self.label.setObjectName('label')
self.verticalLayout_4.addWidget(self.label)
self.radioButton = QtWidgets.QRadioButton(self.groupBox_2)
self.radioButton.setObjectName("radioButton")
self.radioButton.setObjectName('radioButton')
self.verticalLayout_4.addWidget(self.radioButton)
self.checkBox = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox.setObjectName("checkBox")
self.checkBox.setObjectName('checkBox')
self.verticalLayout_4.addWidget(self.checkBox)
self.checkBox_2 = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox_2.setTristate(True)
self.checkBox_2.setObjectName("checkBox_2")
self.checkBox_2.setObjectName('checkBox_2')
self.verticalLayout_4.addWidget(self.checkBox_2)
self.checkBox_3 = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox_3.setEnabled(False)
self.checkBox_3.setObjectName("checkBox_3")
self.checkBox_3.setObjectName('checkBox_3')
self.verticalLayout_4.addWidget(self.checkBox_3)
self.treeWidget = QtWidgets.QTreeWidget(self.groupBox_2)
self.treeWidget.setObjectName("treeWidget")
self.treeWidget.setObjectName('treeWidget')
item_0 = QtWidgets.QTreeWidgetItem(self.treeWidget)
item_1 = QtWidgets.QTreeWidgetItem(self.treeWidget)
item_2 = QtWidgets.QTreeWidgetItem(item_1)
item_2.setText(0, "subitem")
item_2.setText(0, 'subitem')
self.verticalLayout_4.addWidget(self.treeWidget)
self.gridLayout_2.addWidget(self.groupBox_2, 0, 0, 1, 1)
self.tab_3v2 = QtWidgets.QWidget()
self.tab_3v2.setObjectName("tab_3v2")
self.tab_3v2.setObjectName('tab_3v2')
self.gridLayout_3v2 = QtWidgets.QGridLayout(self.tab_3v2)
self.gridLayout_3v2.setObjectName("gridLayout_3v2")
self.gridLayout_3v2.setObjectName('gridLayout_3v2')
self.groupBox_3v2 = QtWidgets.QGroupBox(self.tab_3v2)
self.groupBox_3v2.setObjectName("groupBox_3v2")
self.groupBox_3v2.setObjectName('groupBox_3v2')
self.verticalLayout_4v2 = QtWidgets.QVBoxLayout(self.groupBox_3v2)
self.verticalLayout_4v2.setObjectName("verticalLayout_4v2")
self.verticalLayout_4v2.setObjectName('verticalLayout_4v2')
self.tabBar = QtWidgets.QTabBar(self.tab_3v2)
self.gridLayout_3v2.setObjectName("tabBar")
self.tabBar.addTab("TabBar Tab 1")
self.tabBar.addTab("TabBar Tab 2")
self.tabBar.addTab("TabBar Tab 3")
self.gridLayout_3v2.setObjectName('tabBar')
self.tabBar.addTab('TabBar Tab 1')
self.tabBar.addTab('TabBar Tab 2')
self.tabBar.addTab('TabBar Tab 3')
self.verticalLayout_4v2.addWidget(self.tabBar, 0, QtCore.Qt.AlignTop)
self.gridLayout_3v2.addWidget(self.groupBox_3v2, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab_2, "")
self.tabWidget.addTab(self.tab_3v2, "")
self.tabWidget.addTab(self.tab_2, '')
self.tabWidget.addTab(self.tab_3v2, '')
self.verticalLayout_5.addWidget(self.tabWidget)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout.setObjectName('horizontalLayout')
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_2.setObjectName("pushButton_2")
self.pushButton_2.setObjectName('pushButton_2')
self.pushButton_2.setToolTip('Sample Tooltip2')
self.horizontalLayout.addWidget(self.pushButton_2)
self.bt_delay_popup = QtWidgets.QToolButton(self.centralwidget)
self.bt_delay_popup.setObjectName("bt_delay_popup")
self.bt_delay_popup.setObjectName('bt_delay_popup')
self.horizontalLayout.addWidget(self.bt_delay_popup)
self.bt_instant_popup = QtWidgets.QToolButton(self.centralwidget)
self.bt_instant_popup.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.bt_instant_popup.setObjectName("bt_instant_popup")
self.bt_instant_popup.setObjectName('bt_instant_popup')
self.horizontalLayout.addWidget(self.bt_instant_popup)
self.bt_menu_button_popup = QtWidgets.QToolButton(self.centralwidget)
self.bt_menu_button_popup.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.bt_menu_button_popup.setObjectName("bt_menu_button_popup")
self.bt_menu_button_popup.setObjectName('bt_menu_button_popup')
self.horizontalLayout.addWidget(self.bt_menu_button_popup)
self.line_2 = QtWidgets.QFrame(self.centralwidget)
self.line_2.setFrameShape(QtWidgets.QFrame.VLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.line_2.setObjectName('line_2')
self.horizontalLayout.addWidget(self.line_2)
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_3.setEnabled(False)
self.pushButton_3.setObjectName("pushButton_3")
self.pushButton_3.setObjectName('pushButton_3')
self.pushButton_3.setToolTip('Sample Tooltip3')
self.horizontalLayout.addWidget(self.pushButton_3)
self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget)
self.doubleSpinBox.setObjectName("doubleSpinBox")
self.doubleSpinBox.setObjectName('doubleSpinBox')
self.horizontalLayout.addWidget(self.doubleSpinBox)
self.toolButton = QtWidgets.QToolButton(self.centralwidget)
self.toolButton.setPopupMode(QtWidgets.QToolButton.InstantPopup)
self.toolButton.setObjectName("toolButton")
self.toolButton.setObjectName('toolButton')
self.horizontalLayout.addWidget(self.toolButton)
self.verticalLayout_5.addLayout(self.horizontalLayout)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1068, 29))
self.menubar.setObjectName("menubar")
self.menubar.setObjectName('menubar')
self.menuMenu = QtWidgets.QMenu(self.menubar)
self.menuMenu.setObjectName("menuMenu")
self.menuMenu.setObjectName('menuMenu')
self.menuSubmenu_2 = QtWidgets.QMenu(self.menuMenu)
self.menuSubmenu_2.setObjectName("menuSubmenu_2")
self.menuSubmenu_2.setObjectName('menuSubmenu_2')
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
self.statusbar.setObjectName('statusbar')
MainWindow.setStatusBar(self.statusbar)
self.dockWidget1 = QtWidgets.QDockWidget(MainWindow)
self.dockWidget1.setObjectName("dockWidget1")
self.dockWidget1.setObjectName('dockWidget1')
self.dockWidgetContents = QtWidgets.QWidget()
self.dockWidgetContents.setObjectName("dockWidgetContents")
self.dockWidgetContents.setObjectName('dockWidgetContents')
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.dockWidgetContents)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout_2.setObjectName('verticalLayout_2')
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.setObjectName('verticalLayout')
self.comboBox = QtWidgets.QComboBox(self.dockWidgetContents)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.setObjectName('comboBox')
self.comboBox.addItem('')
self.comboBox.addItem('')
self.verticalLayout.addWidget(self.comboBox)
self.horizontalSlider = QtWidgets.QSlider(self.dockWidgetContents)
self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider.setObjectName("horizontalSlider")
self.horizontalSlider.setObjectName('horizontalSlider')
self.verticalLayout.addWidget(self.horizontalSlider)
self.textEdit = QtWidgets.QTextEdit(self.dockWidgetContents)
self.textEdit.setObjectName("textEdit")
self.textEdit.setObjectName('textEdit')
self.verticalLayout.addWidget(self.textEdit)
self.line = QtWidgets.QFrame(self.dockWidgetContents)
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.line.setObjectName('line')
self.verticalLayout.addWidget(self.line)
self.progressBar = QtWidgets.QProgressBar(self.dockWidgetContents)
self.progressBar.setProperty("value", 24)
self.progressBar.setObjectName("progressBar")
self.progressBar.setProperty('value', 24)
self.progressBar.setObjectName('progressBar')
self.verticalLayout.addWidget(self.progressBar)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.frame = QtWidgets.QFrame(self.dockWidgetContents)
@ -245,31 +292,31 @@ class Ui_MainWindow(object):
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setLineWidth(3)
self.frame.setObjectName("frame")
self.frame.setObjectName('frame')
self.verticalLayout_2.addWidget(self.frame)
self.dockWidget1.setWidget(self.dockWidgetContents)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget1)
self.toolBar = QtWidgets.QToolBar(MainWindow)
self.toolBar.setObjectName("toolBar")
self.toolBar.setObjectName('toolBar')
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.dockWidget2 = QtWidgets.QDockWidget(MainWindow)
self.dockWidget2.setObjectName("dockWidget2")
self.dockWidget2.setObjectName('dockWidget2')
self.dockWidgetContents_2 = QtWidgets.QWidget()
self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
self.dockWidgetContents_2.setObjectName('dockWidgetContents_2')
self.gridLayout_3 = QtWidgets.QGridLayout(self.dockWidgetContents_2)
self.gridLayout_3.setObjectName("gridLayout_3")
self.gridLayout_3.setObjectName('gridLayout_3')
self.verticalSlider = QtWidgets.QSlider(self.dockWidgetContents_2)
self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
self.verticalSlider.setObjectName("verticalSlider")
self.verticalSlider.setObjectName('verticalSlider')
self.gridLayout_3.addWidget(self.verticalSlider, 0, 0, 1, 1)
self.dockWidget2.setWidget(self.dockWidgetContents_2)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget2)
self.actionAction = QtWidgets.QAction(MainWindow)
self.actionAction.setObjectName("actionAction")
self.actionAction.setObjectName('actionAction')
self.actionSub_menu = QtWidgets.QAction(MainWindow)
self.actionSub_menu.setObjectName("actionSub_menu")
self.actionSub_menu.setObjectName('actionSub_menu')
self.actionAction_C = QtWidgets.QAction(MainWindow)
self.actionAction_C.setObjectName("actionAction_C")
self.actionAction_C.setObjectName('actionAction_C')
self.menuSubmenu_2.addAction(self.actionSub_menu)
self.menuSubmenu_2.addAction(self.actionAction_C)
self.menuMenu.addAction(self.actionAction)
@ -308,78 +355,129 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.groupBox.setTitle(_translate("MainWindow", "ToolBox"))
self.toolBox.setItemText(self.toolBox.indexOf(self.page), _translate("MainWindow", "Page 1"))
MainWindow.setWindowTitle(_translate('MainWindow', 'MainWindow'))
self.groupBox.setTitle(_translate('MainWindow', 'ToolBox'))
self.toolBox.setItemText(self.toolBox.indexOf(self.page), _translate('MainWindow', 'Page 1'))
__sortingEnabled = self.listWidget.isSortingEnabled()
self.listWidget.setSortingEnabled(False)
item = self.listWidget.item(0)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(1)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(2)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(3)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(4)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(5)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(6)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
item = self.listWidget.item(7)
item.setText(_translate("MainWindow", "New Item"))
item.setText(_translate('MainWindow', 'New Item'))
self.listWidget.setSortingEnabled(__sortingEnabled)
self.toolBox.setItemText(self.toolBox.indexOf(self.page_2), _translate("MainWindow", "Page 2"))
self.checkableButton.setText(_translate("MainWindow", "Checkable button"))
self.pushButton.setText(_translate("MainWindow", "PushButton"))
self.pushButton_5.setText(_translate("MainWindow", "PushButton"))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), _translate("MainWindow", "Tab 1"))
self.toolBox.setItemText(self.toolBox.indexOf(self.page_2), _translate('MainWindow', 'Page 2'))
self.checkableButton.setText(_translate('MainWindow', 'Checkable button'))
self.pushButton.setText(_translate('MainWindow', 'PushButton'))
self.pushButton_5.setText(_translate('MainWindow', 'PushButton'))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), _translate('MainWindow', 'Tab 1'))
item = self.tableWidget.verticalHeaderItem(0)
item.setText(_translate("MainWindow", "New Row"))
item.setText(_translate('MainWindow', 'New Row'))
item = self.tableWidget.verticalHeaderItem(1)
item.setText(_translate("MainWindow", "New Row"))
item.setText(_translate('MainWindow', 'New Row'))
item = self.tableWidget.verticalHeaderItem(2)
item.setText(_translate("MainWindow", "New Row"))
item.setText(_translate('MainWindow', 'New Row'))
item = self.tableWidget.verticalHeaderItem(3)
item.setText(_translate("MainWindow", "New Row"))
item.setText(_translate('MainWindow', 'New Row'))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "New Column"))
item.setText(_translate('MainWindow', 'New Column'))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "New Column 2"))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_5), _translate("MainWindow", "Page"))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), _translate("MainWindow", "Tab 2"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Tab 1"))
self.groupBox_2.setTitle(_translate("MainWindow", "GroupBox"))
self.label.setText(_translate("MainWindow", "TextLabel"))
self.radioButton.setText(_translate("MainWindow", "RadioB&utton"))
self.checkBox.setText(_translate("MainWindow", "CheckBox"))
self.checkBox_2.setText(_translate("MainWindow", "CheckBox Tristate"))
self.checkBox_3.setText(_translate("MainWindow", "CheckBox Disabled"))
self.treeWidget.headerItem().setText(0, _translate("MainWindow", "qdz"))
item.setText(_translate('MainWindow', 'New Column 2'))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_5), _translate('MainWindow', 'Page'))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), _translate('MainWindow', 'Tab 2'))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate('MainWindow', 'Tab 1'))
self.groupBox_2.setTitle(_translate('MainWindow', 'GroupBox'))
self.label.setText(_translate('MainWindow', 'TextLabel'))
self.radioButton.setText(_translate('MainWindow', 'RadioB&utton'))
self.checkBox.setText(_translate('MainWindow', 'CheckBox'))
self.checkBox_2.setText(_translate('MainWindow', 'CheckBox Tristate'))
self.checkBox_3.setText(_translate('MainWindow', 'CheckBox Disabled'))
self.treeWidget.headerItem().setText(0, _translate('MainWindow', 'qdz'))
__sortingEnabled = self.treeWidget.isSortingEnabled()
self.treeWidget.setSortingEnabled(False)
self.treeWidget.topLevelItem(0).setText(0, _translate("MainWindow", "qzd"))
self.treeWidget.topLevelItem(1).setText(0, _translate("MainWindow", "effefe"))
self.treeWidget.topLevelItem(0).setText(0, _translate('MainWindow', 'qzd'))
self.treeWidget.topLevelItem(1).setText(0, _translate('MainWindow', 'effefe'))
self.treeWidget.setSortingEnabled(__sortingEnabled)
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3v2), _translate("MainWindow", "Tab 3"))
self.groupBox_3v2.setTitle(_translate("MainWindow", "GroupBox v2"))
self.pushButton_2.setText(_translate("MainWindow", "PushButton"))
self.bt_delay_popup.setText(_translate("MainWindow", "Delayed popup "))
self.bt_instant_popup.setText(_translate("MainWindow", "Instant popup"))
self.bt_menu_button_popup.setText(_translate("MainWindow", "MenuButtonPopup"))
self.pushButton_3.setText(_translate("MainWindow", "Disabled"))
self.toolButton.setText(_translate("MainWindow", "..."))
self.menuMenu.setTitle(_translate("MainWindow", "&Menu"))
self.menuSubmenu_2.setTitle(_translate("MainWindow", "&Submenu 2"))
self.dockWidget1.setWindowTitle(_translate("MainWindow", "&Dock widget 1"))
self.comboBox.setItemText(0, _translate("MainWindow", "Item 0"))
self.comboBox.setItemText(1, _translate("MainWindow", "Item 2"))
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
self.dockWidget2.setWindowTitle(_translate("MainWindow", "Dock widget &2"))
self.actionAction.setText(_translate("MainWindow", "&Action"))
self.actionSub_menu.setText(_translate("MainWindow", "&Action B"))
self.actionSub_menu.setToolTip(_translate("MainWindow", "submenu"))
self.actionAction_C.setText(_translate("MainWindow", "Action &C"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate('MainWindow', 'Tab 2'))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3v2), _translate('MainWindow', 'Tab 3'))
self.groupBox_3v2.setTitle(_translate('MainWindow', 'GroupBox v2'))
self.pushButton_2.setText(_translate('MainWindow', 'PushButton'))
self.bt_delay_popup.setText(_translate('MainWindow', 'Delayed popup '))
self.bt_instant_popup.setText(_translate('MainWindow', 'Instant popup'))
self.bt_menu_button_popup.setText(_translate('MainWindow', 'MenuButtonPopup'))
self.pushButton_3.setText(_translate('MainWindow', 'Disabled'))
self.toolButton.setText(_translate('MainWindow', '...'))
self.menuMenu.setTitle(_translate('MainWindow', '&Menu'))
self.menuSubmenu_2.setTitle(_translate('MainWindow', '&Submenu 2'))
self.dockWidget1.setWindowTitle(_translate('MainWindow', '&Dock widget 1'))
self.comboBox.setItemText(0, _translate('MainWindow', 'Item 0'))
self.comboBox.setItemText(1, _translate('MainWindow', 'Item 2'))
self.toolBar.setWindowTitle(_translate('MainWindow', 'toolBar'))
self.dockWidget2.setWindowTitle(_translate('MainWindow', 'Dock widget &2'))
self.actionAction.setText(_translate('MainWindow', '&Action'))
self.actionSub_menu.setText(_translate('MainWindow', '&Action B'))
self.actionSub_menu.setToolTip(_translate('MainWindow', 'submenu'))
self.actionAction_C.setText(_translate('MainWindow', 'Action &C'))
def main(argv=None):
'Application entry point'
args, unknown = parser.parse_known_args(argv)
logging.basicConfig(level=logging.DEBUG)
app = QtWidgets.QApplication(argv[:1] + unknown)
window = QtWidgets.QMainWindow()
# setup ui
ui = Ui()
ui.setup(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle('Sample BreezeStyleSheets application.')
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
if args.stylesheet != 'native':
file = QtCore.QFile(f':/{args.stylesheet}.qss')
file.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text)
stream = QtCore.QTextStream(file)
app.setStyleSheet(stream.readAll())
# use the default font size
font = app.font()
if args.font_size > 0:
font.setPointSizeF(args.font_size)
if args.font_family:
font.setFamily(args.font_family)
app.setFont(font)
# run
window.show()
app.exec_()
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,94 +0,0 @@
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
"""
A simple example of use.
Load an ui made in QtDesigner and apply the DarkStyleSheet.
Requirements:
- Python 2 or Python 3
- PyQt4
.. note.. :: qdarkstyle does not have to be installed to run
the example
"""
import logging
import sys
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QFile, QTextStream
# make the example runnable without the need to install
import example
import breeze_resources
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtWidgets.QApplication(sys.argv)
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window = QtWidgets.QMainWindow()
# setup ui
ui = example.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("Breeze example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
file = QFile(":/light.qss")
file.open(QFile.ReadOnly | QFile.Text)
stream = QTextStream(file)
app.setStyleSheet(stream.readAll())
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
if __name__ == "__main__":
main()

View File

@ -1,87 +0,0 @@
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
"""
A simple example of use.
Load an ui made in QtDesigner and apply the DarkStyleSheet.
Requirements:
- Python 2 or Python 3
- PyQt4
.. note.. :: qdarkstyle does not have to be installed to run
the example
"""
import logging
import sys
from PyQt5 import QtWidgets, QtCore
# make the example runnable without the need to install
import example
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtWidgets.QApplication(sys.argv)
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window = QtWidgets.QMainWindow()
# setup ui
ui = example.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("Native example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
if __name__ == "__main__":
main()

189
single.py Normal file
View File

@ -0,0 +1,189 @@
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2021> <Alex Huszagh>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
'''
single
======
Test styles of a single widget.
'''
import argparse
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import breeze_resources
# Create our arguments.
parser = argparse.ArgumentParser(description='Configurations for the Qt5 application.')
parser.add_argument(
'--widget',
help='''widget to test'''
)
parser.add_argument(
'--stylesheet',
help='''stylesheet name''',
default='native'
)
parser.add_argument(
'--font-size',
help='''font size for the application''',
type=float,
default=-1
)
parser.add_argument(
'--font-family',
help='''the font family'''
)
parser.add_argument(
'--width',
help='''the window width''',
type=int,
default=1068,
)
parser.add_argument(
'--height',
help='''the window height''',
type=int,
default=824,
)
parser.add_argument(
'--alignment',
help='''the layout alignment''',
)
parser.add_argument(
'--compress',
help='''add stretch on both sides''',
action='store_true',
)
layout = {
'vertical': QtWidgets.QVBoxLayout,
'horizontal': QtWidgets.QHBoxLayout,
}
alignment = {
'top': QtCore.Qt.AlignTop,
'vcenter': QtCore.Qt.AlignVCenter,
'bottom': QtCore.Qt.AlignBottom,
'left': QtCore.Qt.AlignLeft,
'hcenter': QtCore.Qt.AlignHCenter,
'right': QtCore.Qt.AlignRight,
'center': QtCore.Qt.AlignCenter,
}
def main(argv=None):
'Application entry point'
args, unknown = parser.parse_known_args(argv)
app = QtWidgets.QApplication(argv[:1] + unknown)
window = QtWidgets.QMainWindow()
window.setWindowTitle('Sample single widget application.')
window.resize(args.width, args.height)
widget = QtWidgets.QWidget(window)
# setup stylesheet
if args.stylesheet != 'native':
file = QtCore.QFile(f':/{args.stylesheet}.qss')
file.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text)
stream = QtCore.QTextStream(file)
app.setStyleSheet(stream.readAll())
# use the default font size
font = app.font()
if args.font_size > 0:
font.setPointSizeF(args.font_size)
if args.font_family:
font.setFamily(args.font_family)
app.setFont(font)
# Load the correct widget.
layout_type = 'vertical'
if args.widget == 'progress_bar_horizontal':
child = QtWidgets.QProgressBar(widget)
child.setProperty('value', 24)
elif args.widget == 'progress_bar_vertical':
layout_type = 'horizontal'
child = QtWidgets.QProgressBar(widget)
child.setOrientation(QtCore.Qt.Vertical)
child.setProperty('value', 24)
if args.widget == 'slider_horizontal':
child = QtWidgets.QSlider(widget)
child.setOrientation(QtCore.Qt.Horizontal)
elif args.widget == 'slider_vertical':
layout_type = 'horizontal'
child = QtWidgets.QSlider(widget)
child.setOrientation(QtCore.Qt.Vertical)
#if args.widget == 'splitter_horizontal':
# layout_type = 'vertical'
# child = QtWidgets.QSplitter(widget)
#elif args.widget == 'splitter_vertical':
# layout_type = 'horizontal'
# child = QtWidgets.QSplitter(widget)
# child.setOrientation(QtCore.Qt.Vertical)
elif args.widget == 'menu':
child = QtWidgets.QMenuBar(window)
child.setGeometry(QtCore.QRect(0, 0, args.width, int(1.5 * font.pointSize())))
menu = QtWidgets.QMenu('Main Menu', child)
menu.addAction(QtWidgets.QAction('&Action 1', window))
menu.addAction(QtWidgets.QAction('&Action 2', window))
submenu = QtWidgets.QMenu('Sub Menu', menu)
submenu.addAction(QtWidgets.QAction('&Action 3', window))
menu.addAction(submenu.menuAction())
child.addAction(menu.menuAction())
window.setMenuBar(child)
elif args.widget == 'status_bar':
child = QtWidgets.QStatusBar(window)
window.setStatusBar(child)
elif args.widget == 'spinbox':
layout_type = 'horizontal'
child = QtWidgets.QSpinBox(window)
child.setValue(10);
elif args.widget == 'double_spinbox':
layout_type = 'horizontal'
child = QtWidgets.QDoubleSpinBox(window)
child.setValue(10.5);
elif args.widget == 'combobox':
layout_type = 'horizontal'
child = QtWidgets.QComboBox(widget)
child.addItem('Item 1')
child.addItem('Item 2')
widget_layout = layout[layout_type](widget)
if args.compress:
widget_layout.addStretch(1)
widget_layout.addWidget(child)
widget_layout.addStretch(1)
else:
widget_layout.addWidget(child)
if args.alignment is not None:
widget_layout.setAlignment(alignment[args.alignment])
window.setCentralWidget(widget)
# run
window.show()
app.exec_()
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,94 +0,0 @@
#!/usr/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
"""
A simple example of use.
Load an ui made in QtDesigner and apply the DarkStyleSheet.
Requirements:
- Python 2 or Python 3
- PyQt4
.. note.. :: qdarkstyle does not have to be installed to run
the example
"""
import logging
import sys
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import QFile, QTextStream
# make the example runnable without the need to install
import example
import breeze_resources
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtWidgets.QApplication(sys.argv)
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window = QtWidgets.QMainWindow()
# setup ui
ui = example.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("BreezeDark example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
file = QFile(":/windows_dark.qss")
file.open(QFile.ReadOnly | QFile.Text)
stream = QTextStream(file)
app.setStyleSheet(stream.readAll())
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
if __name__ == "__main__":
main()

View File

@ -312,18 +312,18 @@ QMenu::indicator:exclusive:checked:selected
QMenu::right-arrow
{
margin: 0.5ex;
margin: 0.23em;
border-image: url(:/dark/right_arrow.svg);
width: 1.2ex;
height: 1.8ex;
width: 0.5em;
height: 0.8em;
}
QAbstractItemView
{
alternate-background-color: #31363b;
color: #eff0f1;
border: 0.2ex solid #3A3939;
border-radius: 0.2ex;
border: 0.09em solid #3A3939;
border-radius: 0.09em;
}
QWidget:focus,
@ -518,8 +518,8 @@ QHeaderView::section
QSizeGrip
{
border-image: url(:/dark/sizegrip.svg);
width: 1.2ex;
height: 1.2ex;
width: 0.5em;
height: 0.5em;
}
QMainWindow::separator
@ -736,9 +736,9 @@ QComboBox::drop-down
QComboBox::down-arrow
{
border-image: url(:/dark/down_arrow_disabled.svg);
width: 2.4ex;
height: 1.8ex;
margin-right: 1ex;
width: 0.8em;
height: 0.5em;
margin-right: 0.41em;
}
QComboBox::down-arrow:on,
@ -746,26 +746,29 @@ QComboBox::down-arrow:hover,
QComboBox::down-arrow:focus
{
border-image: url(:/dark/down_arrow.svg);
width: 2.4ex;
height: 1.8ex;
margin-right: 1ex;
width: 0.8em;
height: 0.5em;
margin-right: 0.41em;
}
QAbstractSpinBox
{
padding: 0.5ex;
border: 0.2ex solid #76797c;
padding: 0.23em;
border: 0.09em solid #76797c;
background-color: #232629;
color: #eff0f1;
border-radius: 0.2ex;
min-width: 7.5ex;
margin: 2ex;
margin-left: 10ex;
border-radius: 0.09em;
min-width: 2.6em;
margin: 0.9em;
margin-left: 2.3em;
/* To deal with the padding of the arrows */
padding-left: 0.8em;
padding-right: 0.8em;
}
QAbstractSpinBox:hover
{
border: 0.2ex solid #3daee9;
border: 0.09em solid #3daee9;
}
QAbstractSpinBox:up-button,
@ -785,45 +788,52 @@ QAbstractSpinBox:down-button:hover
QAbstractSpinBox::up-arrow
{
border-image: url(:/dark/up_arrow.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
margin-right: 0.8em;
}
QAbstractSpinBox::up-arrow:disabled,
QAbstractSpinBox::up-arrow:off
{
border-image: url(:/dark/up_arrow_disabled.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
}
QAbstractSpinBox::up-arrow:hover
{
border-image: url(:/dark/up_arrow-hover.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
}
QAbstractSpinBox::down-arrow
{
border-image: url(:/dark/down_arrow.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
margin-left: 0.8em;
}
QAbstractSpinBox::down-arrow:disabled,
QAbstractSpinBox::down-arrow:off
{
border-image: url(:/dark/down_arrow_disabled.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
}
QAbstractSpinBox::down-arrow:hover
{
border-image: url(:/dark/down_arrow-hover.svg);
width: 1.8ex;
height: 1.2ex;
width: 0.8em;
height: 0.5em;
}
QDoubleSpinBox
{
min-width: 5em;
}
QLabel
@ -1221,42 +1231,55 @@ QTreeView::item:!selected:hover
padding: 0.3ex;
}
QSlider::groove:horizontal
QSlider::handle:horizontal,
QSlider::handle:vertical
{
border: 0.2ex solid #31363b;
height: 1ex;
background: #565a5e;
margin: 0ex;
border-radius: 0.2ex;
background: #232629;
border: 0.09em solid #626568;
width: 0.7em;
height: 0.7em;
border-radius: 0.35em;
}
QSlider:horizontal
{
min-width: 10ex;
height: 10ex;
}
QSlider:vertical
{
min-height: 10ex;
width: 10ex;
}
QSlider::handle:horizontal
{
background: #232629;
border: 0.2ex solid #626568;
width: 1.6ex;
height: 1.6ex;
margin: -0.8ex 0;
border-radius: 0.9ex;
}
QSlider::groove:vertical
{
border: 0.2ex solid #31363b;
width: 1ex;
background: #565a5e;
margin: 0ex;
border-radius: 0.3ex;
margin: -0.23em 0;
}
QSlider::handle:vertical
{
background: #232629;
border: 0.2ex solid #626568;
width: 1.6ex;
height: 1.6ex;
margin: 0 -0.8ex;
border-radius: 0.9ex;
margin: 0 -0.23em;
}
QSlider::groove:horizontal,
QSlider::groove:vertical
{
border: 0.09em solid #31363b;
background: #565a5e;
margin: 0ex;
border-radius: 0.15em;
}
QSlider::groove:horizontal
{
height: 0.4em;
}
QSlider::groove:vertical
{
width: 0.4em;
}
QSlider::handle:horizontal:hover,
@ -1264,21 +1287,21 @@ QSlider::handle:horizontal:focus,
QSlider::handle:vertical:hover,
QSlider::handle:vertical:focus
{
border: 0.2ex solid #3daee9;
border: 0.09em solid #3daee9;
}
QSlider::sub-page:horizontal,
QSlider::add-page:vertical
{
background: #3daee9;
border-radius: 0.3ex;
border-radius: 0.12em;
}
QSlider::add-page:horizontal,
QSlider::sub-page:vertical
{
background: #626568;
border-radius: 0.3ex;
border-radius: 0.12em;
}
QToolButton
@ -1457,49 +1480,80 @@ QToolBox
border: 0.2ex transparent black;
}
QToolBox::tab
{
border-bottom: 0.2ex solid #76797c;
}
QToolBox::tab:selected,
QToolBox::tab:hover
{
border-bottom: 0.2ex solid #3daee9;
}
QFrame[height="3"],
QFrame[width="3"]
{
background-color: #76797c;
}
/* TODO(ahuszagh) Size is bad for this... */
QSplitter::handle
{
border: 0.2ex dashed #76797c;
border: 0.09em dashed #76797c;
}
QSplitter::handle:hover
{
background-color: #787876;
border: 0.2ex solid #76797c;
border: 0.09em solid #3daee9;
}
QSplitter::handle:horizontal
{
width: 0.2ex;
min-width: 5em;
height: 0.5em;
}
QSplitter::handle:vertical
{
height: 0.2ex;
width: 5em;
min-height: 0.5em;
}
QProgressBar:horizontal,
QProgressBar:vertical
{
background-color: #626568;
border: 0.9em solid #31363b;
border-radius: 0.13em;
padding: 0em;
}
QProgressBar:horizontal
{
background-color: #626568;
border: 0.2ex solid #31363b;
border-radius: 0.3ex;
height: 0.5ex;
height: 0.2em;
text-align: right;
margin-top: 0.5ex;
margin-bottom: 0.5ex;
margin-right: 10ex;
padding: 0px;
margin-top: 0.2em;
margin-bottom: 0.2em;
margin-right: 1em;
}
QProgressBar::chunk:horizontal
QProgressBar:vertical
{
width: 0.2em;
text-align: bottom;
margin-left: 0.2em;
margin-right: 0.2em;
margin-bottom: 1ex;
}
QProgressBar::chunk:horizontal,
QProgressBar::chunk:vertical
{
background-color: #3daee9;
border: 0.2ex transparent;
border-radius: 0.3ex;
border: 0.9em transparent;
border-radius: 0.13em;
}