Enhancements for QSlider to scale for all resolutions.

main
Alex Huszagh 2021-07-14 22:28:16 -05:00
parent b3bd326d48
commit eb75c6fcda
3 changed files with 2852 additions and 2749 deletions

File diff suppressed because it is too large Load Diff

View File

@ -239,9 +239,15 @@ def main(argv=None):
child.setValue(10.5); child.setValue(10.5);
elif args.widget == 'combobox': elif args.widget == 'combobox':
layout_type = 'horizontal' layout_type = 'horizontal'
child = QtWidgets.QComboBox(widget) child = []
child.addItem('Item 1') combo1 = QtWidgets.QComboBox(widget)
child.addItem('Item 2') combo1.addItem('Item 1')
combo1.addItem('Item 2')
child.append(combo1)
combo2 = QtWidgets.QComboBox(widget)
combo2.addItem('Very Very Long Item 1')
combo2.addItem('Very Very Long Item 2')
child.append(combo2)
elif args.widget == 'tab_widget_top': elif args.widget == 'tab_widget_top':
child = QtWidgets.QTabWidget(widget) child = QtWidgets.QTabWidget(widget)
child.setTabPosition(QtWidgets.QTabWidget.North) child.setTabPosition(QtWidgets.QTabWidget.North)
@ -387,6 +393,23 @@ def main(argv=None):
tree2.header().setSectionsClickable(True) tree2.header().setSectionsClickable(True)
item12 = QtWidgets.QTreeWidgetItem(tree2, ['Row 1', 'Column 2', 'Column 3']) item12 = QtWidgets.QTreeWidgetItem(tree2, ['Row 1', 'Column 2', 'Column 3'])
child.append(tree2) child.append(tree2)
elif args.widget == 'view_scrollarea':
# For us to have both scrollbars visible.
child = QtWidgets.QTableWidget(widget)
child.setColumnCount(100)
child.setRowCount(100)
for index in range(100):
row = QtWidgets.QTableWidgetItem(f'Row {index + 1}')
child.setVerticalHeaderItem(0, row)
column = QtWidgets.QTableWidgetItem(f'Column {index + 1}')
child.setHorizontalHeaderItem(index, column)
elif args.widget == 'widget_scrollarea':
child = QtWidgets.QProgressBar(widget)
child.setProperty('value', 24)
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

@ -556,27 +556,22 @@ QSizeGrip
QMainWindow::separator QMainWindow::separator
{ {
background-color: #31363b; border: 0.15em solid #76797c;
color: white; border-radius: 0.09em;
padding-left: 0.4ex; margin-left: 0.5em;
spacing: 0.09em;
border: 0.09em dashed #76797c;
} }
QMainWindow::separator:hover QMainWindow::separator:hover
{ {
background-color: #787876; border: 0.15em solid #8a8d8f;
color: white; border-radius: 0.09em;
padding-left: 0.4ex; margin-left: 0.5em;
border: 0.09em solid #76797c;
spacing: 0.09em;
} }
QMenu::separator QMenu::separator
{ {
height: 0.09em; height: 0.09em;
background-color: #76797c; background-color: #76797c;
color: white;
padding-left: 0.4ex; padding-left: 0.4ex;
margin-left: 1ex; margin-left: 1ex;
margin-right: 0.23em; margin-right: 0.23em;
@ -671,8 +666,8 @@ QPushButton:focus
QPushButton:pressed QPushButton:pressed
{ {
background-color: #31363b; background-color: #31363b;
padding-top: -1.5ex; padding-top: -0.65em;
padding-bottom: -1.7ex; padding-bottom: -0.74em;
} }
QComboBox QComboBox
@ -682,7 +677,7 @@ QComboBox
border: 0.04em solid #76797c; border: 0.04em solid #76797c;
border-radius: 0.09em; border-radius: 0.09em;
padding: 0.23em; padding: 0.23em;
min-width: 7.5ex; min-width: 2.5em;
} }
QPushButton:checked QPushButton:checked
@ -748,7 +743,7 @@ QComboBox::drop-down
{ {
subcontrol-origin: padding; subcontrol-origin: padding;
subcontrol-position: top right; subcontrol-position: top right;
width: 1.5ex; width: 0.65em;
border-left-width: 0ex; border-left-width: 0ex;
border-left-color: darkgray; border-left-color: darkgray;
@ -1313,6 +1308,74 @@ 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
{ {
@ -1325,14 +1388,12 @@ QSlider::handle:vertical
QSlider:horizontal QSlider:horizontal
{ {
min-width: 4.1em; height: 2em;
height: 4.1em;
} }
QSlider:vertical QSlider:vertical
{ {
min-height: 4.1em; width: 2em;
width: 4.1em;
} }
QSlider::handle:horizontal QSlider::handle:horizontal
@ -1348,10 +1409,9 @@ QSlider::handle:vertical
QSlider::groove:horizontal, QSlider::groove:horizontal,
QSlider::groove:vertical QSlider::groove:vertical
{ {
border: 0.09em solid #31363b;
background: #565a5e; background: #565a5e;
margin: 0ex; border: 0em solid #31363b;
border-radius: 0.15em; border-radius: 0.19em;
} }
QSlider::groove:horizontal QSlider::groove:horizontal
@ -1376,14 +1436,14 @@ QSlider::sub-page:horizontal,
QSlider::add-page:vertical QSlider::add-page:vertical
{ {
background: #3daee9; background: #3daee9;
border-radius: 0.12em; border-radius: 0.19em;
} }
QSlider::add-page:horizontal, QSlider::add-page:horizontal,
QSlider::sub-page:vertical QSlider::sub-page:vertical
{ {
background: #626568; background: #626568;
border-radius: 0.12em; border-radius: 0.19em;
} }
QToolButton QToolButton
@ -1665,7 +1725,9 @@ QProgressBar::chunk:vertical
border-radius: 0.13em; border-radius: 0.13em;
} }
QScrollArea QScrollArea,
QScrollArea:focus,
QScrollArea:hover
{ {
border: 0em solid black; border: 0em solid black;
} }