Minor bug fixes for UI.

main
Alex Huszagh 2021-07-15 00:10:14 -05:00
parent ec9102c609
commit c7a1058e7d
5 changed files with 3182 additions and 3192 deletions

View File

@ -106,6 +106,13 @@ The limitations of stylesheets include:
- QToolButton cannot have center-aligned text. - QToolButton cannot have center-aligned text.
- The branch indicators on QTreeViews don't scale. - The branch indicators on QTreeViews don't scale.
# Debugging
Have an issue with the styles? Here's a few suggestions, prior to filing a bug report:
- Modified the application font? Make sure you do **before** setting the application stylesheet.
- Modified the application style? Make sure you do **before** you creating a `QApplication instance`.
# Contributing # Contributing
To configure the assets and the stylesheets, run `configure.py`. To compile the assets and stylesheets for Python, run `pyrcc5 breeze.qrc -o breeze_resources.py`. To configure the assets and the stylesheets, run `configure.py`. To compile the assets and stylesheets for Python, run `pyrcc5 breeze.qrc -o breeze_resources.py`.

File diff suppressed because it is too large Load Diff

View File

@ -458,6 +458,14 @@ def main(argv=None):
app = QtWidgets.QApplication(argv[:1] + unknown) app = QtWidgets.QApplication(argv[:1] + unknown)
window = QtWidgets.QMainWindow() window = QtWidgets.QMainWindow()
# 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)
# setup ui # setup ui
ui = Ui() ui = Ui()
ui.setup(window) ui.setup(window)
@ -485,14 +493,6 @@ def main(argv=None):
stream = QtCore.QTextStream(file) stream = QtCore.QTextStream(file)
app.setStyleSheet(stream.readAll()) 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 # run
window.show() window.show()
app.exec_() app.exec_()

53
test.py
View File

@ -23,14 +23,15 @@
# THE SOFTWARE. # THE SOFTWARE.
''' '''
single test
====== ====
Test styles of a single widget. Test styles of a single widget.
''' '''
import argparse import argparse
import os import os
import random
import sys import sys
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
@ -177,13 +178,38 @@ def main(argv=None):
# Load the correct widget. # Load the correct widget.
layout_type = 'vertical' layout_type = 'vertical'
if args.widget == 'progress_bar_horizontal': if args.widget == 'progress_bar_horizontal':
child = QtWidgets.QProgressBar(widget) child = []
child.setProperty('value', 24) bar1 = QtWidgets.QProgressBar(widget)
bar1.setProperty('value', 0)
child.append(bar1)
bar2 = QtWidgets.QProgressBar(widget)
bar2.setProperty('value', 24)
child.append(bar2)
bar3 = QtWidgets.QProgressBar(widget)
bar3.setProperty('value', 99)
child.append(bar3)
bar4 = QtWidgets.QProgressBar(widget)
bar4.setProperty('value', 100)
child.append(bar4)
elif args.widget == 'progress_bar_vertical': elif args.widget == 'progress_bar_vertical':
layout_type = 'horizontal' layout_type = 'horizontal'
child = QtWidgets.QProgressBar(widget) child = []
child.setOrientation(QtCore.Qt.Vertical) bar1 = QtWidgets.QProgressBar(widget)
child.setProperty('value', 24) bar1.setOrientation(QtCore.Qt.Vertical)
bar1.setProperty('value', 0)
child.append(bar1)
bar2 = QtWidgets.QProgressBar(widget)
bar2.setOrientation(QtCore.Qt.Vertical)
bar2.setProperty('value', 24)
child.append(bar2)
bar3 = QtWidgets.QProgressBar(widget)
bar3.setOrientation(QtCore.Qt.Vertical)
bar3.setProperty('value', 99)
child.append(bar3)
bar4 = QtWidgets.QProgressBar(widget)
bar4.setOrientation(QtCore.Qt.Vertical)
bar4.setProperty('value', 100)
child.append(bar4)
elif args.widget == 'slider_horizontal': elif args.widget == 'slider_horizontal':
child = QtWidgets.QSlider(widget) child = QtWidgets.QSlider(widget)
child.setOrientation(QtCore.Qt.Horizontal) child.setOrientation(QtCore.Qt.Horizontal)
@ -324,10 +350,16 @@ def main(argv=None):
item = QtWidgets.QTableWidgetItem('Column 2') item = QtWidgets.QTableWidgetItem('Column 2')
child.setHorizontalHeaderItem(1, item) child.setHorizontalHeaderItem(1, item)
elif args.widget == 'list': elif args.widget == 'list':
# TODO(ahuszagh) Need icons?
child = QtWidgets.QListWidget(widget) child = QtWidgets.QListWidget(widget)
for index in range(10): for index in range(10):
child.addItem(QtWidgets.QListWidgetItem(f'Item {index + 1}')) item = QtWidgets.QListWidgetItem(f'Item {index + 1}')
item.setTextAlignment(random.choice([QtCore.Qt.AlignLeft, QtCore.Qt.AlignRight, QtCore.Qt.AlignHCenter]))
child.addItem(item)
icon = QtGui.QIcon(':/dark/close.svg')
for index in range(10):
item = QtWidgets.QListWidgetItem(icon, f'Item {index + 1}')
item.setTextAlignment(random.choice([QtCore.Qt.AlignLeft, QtCore.Qt.AlignRight, QtCore.Qt.AlignHCenter]))
child.addItem(item)
elif args.widget == 'scrollbar_vertical': elif args.widget == 'scrollbar_vertical':
child = QtWidgets.QListWidget(widget) child = QtWidgets.QListWidget(widget)
for index in range(100): for index in range(100):
@ -407,9 +439,6 @@ def main(argv=None):
child = QtWidgets.QProgressBar(widget) child = QtWidgets.QProgressBar(widget)
child.setProperty('value', 24) child.setProperty('value', 24)
window.resize(30, 30) window.resize(30, 30)
elif args.widget == 'dock_progress':
# Bug fix for the dock scroll area issue in example.py.
raise NotImplementedError
else: else:
raise NotImplementedError raise NotImplementedError

View File

@ -1290,6 +1290,12 @@ QTreeView::branch:open:has-children:has-siblings:hover
image: url(:/dark/branch_open_hover.svg); image: url(:/dark/branch_open_hover.svg);
} }
QListView
{
/* Give space for elements aligned left or right. */
padding: 0.2em;
}
QTableView::item, QTableView::item,
QListView::item, QListView::item,
QTreeView::item QTreeView::item
@ -1308,74 +1314,6 @@ QTreeView::item:!selected:hover
padding: 0.13em; padding: 0.13em;
} }
/*
QSlider::handle:horizontal,
QSlider::handle:vertical
{
background: #232629;
border: 0.09em solid #626568;
border-radius: 0.5em;
}
QSlider::handle:horizontal
{
width: 0.9em;
height: 1em;
margin-top: -0.25em;
margin-bottom: -0.25em;
}
QSlider::handle:vertical
{
height: 0.9em;
width: 1em;
margin-left: -0.25em;
margin-right: -0.25em;
}
QSlider::handle:horizontal:hover,
QSlider::handle:horizontal:focus,
QSlider::handle:vertical:hover,
QSlider::handle:vertical:focus
{
border: 0.09em solid #3daee9;
}
QSlider::sub-page:horizontal,
QSlider::add-page:vertical
{
background: #3daee9;
border-radius: 0.2em;
}
QSlider::add-page:horizontal,
QSlider::sub-page:vertical
{
background: #626568;
border-radius: 0.2em;
}
QSlider::groove:horizontal,
QSlider::groove:vertical
{
background-color: #565a5e;
border: 0em solid #31363b;
border-radius: 0.2em;
}
*/
/* TODO(ahuszagh) This is being ignored
QSlider::groove:horizontal
{
height: 0.5em;
}
QSlider::groove:vertical
{
width: 0.5em;
}
*/
QSlider::handle:horizontal, QSlider::handle:horizontal,
QSlider::handle:vertical QSlider::handle:vertical
{ {
@ -1702,9 +1640,11 @@ QProgressBar:horizontal
height: 0.2em; height: 0.2em;
min-width: 6em; min-width: 6em;
text-align: right; text-align: right;
padding-left: -0.03em;
padding-right: -0.03em;
margin-top: 0.2em; margin-top: 0.2em;
margin-bottom: 0.2em; margin-bottom: 0.2em;
margin-right: 1em; margin-right: 1.5em;
} }
QProgressBar:vertical QProgressBar:vertical
@ -1712,6 +1652,8 @@ QProgressBar:vertical
width: 0.2em; width: 0.2em;
min-height: 6em; min-height: 6em;
text-align: bottom; text-align: bottom;
padding-top: -0.03em;
padding-bottom: -0.03em;
margin-left: 0.2em; margin-left: 0.2em;
margin-right: 0.2em; margin-right: 0.2em;
margin-bottom: 0.41em; margin-bottom: 0.41em;
@ -1722,7 +1664,7 @@ QProgressBar::chunk:vertical
{ {
background-color: #3daee9; background-color: #3daee9;
border: 0.9em transparent; border: 0.9em transparent;
border-radius: 0.13em; border-radius: 0.08em;
} }
QScrollArea, QScrollArea,