Enhance SettingsDialog and MainWindow styling; improve QComboBox appearance and validation logic for geometry data

This commit is contained in:
2025-07-31 16:02:17 +02:00
parent 879141a080
commit 21dd3e7ba4
+63 -13
View File
@@ -869,12 +869,24 @@ class SettingsDialog(QtWidgets.QDialog):
}} }}
QComboBox::down-arrow {{ QComboBox::down-arrow {{
image: none; image: none;
width: 0; width: 0px;
height: 0; height: 0px;
border-left: 5px solid transparent; border-left: 5px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
border-top: 6px solid {colors['foreground']}; border-top: 6px solid {colors['foreground']};
margin: 0px; margin: 0px;
padding: 0px;
}}
QComboBox::down-arrow:hover {{
border-top-color: {colors['accent']};
}}
QComboBox QAbstractItemView {{
background-color: {colors['input_bg']};
border: 1px solid {colors['border']};
border-radius: 3px;
color: {colors['foreground']};
selection-background-color: {colors['accent']};
selection-color: white;
}} }}
QPushButton {{ QPushButton {{
font-size: 9pt; font-size: 9pt;
@@ -1083,12 +1095,24 @@ class SettingsDialog(QtWidgets.QDialog):
}} }}
QComboBox::down-arrow {{ QComboBox::down-arrow {{
image: none; image: none;
width: 0; width: 0px;
height: 0; height: 0px;
border-left: 5px solid transparent; border-left: 5px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
border-top: 6px solid {colors['foreground']}; border-top: 6px solid {colors['foreground']};
margin: 0px; margin: 0px;
padding: 0px;
}}
QComboBox::down-arrow:hover {{
border-top-color: {colors['accent']};
}}
QComboBox QAbstractItemView {{
background-color: {colors['input_bg']};
border: 1px solid {colors['border']};
border-radius: 3px;
color: {colors['foreground']};
selection-background-color: {colors['accent']};
selection-color: white;
}} }}
QPushButton {{ QPushButton {{
font-size: 9pt; font-size: 9pt;
@@ -2073,10 +2097,10 @@ class MainWindow(QtWidgets.QMainWindow):
'maximized': self.isMaximized() 'maximized': self.isMaximized()
} }
# Validate geometry data before saving # Validate geometry data before saving - only prevent extremely invalid values
if (geometry_data['width'] < 400 or geometry_data['height'] < 300 or if (geometry_data['width'] < 300 or geometry_data['height'] < 200 or
geometry_data['x'] < -100 or geometry_data['y'] < -100): geometry_data['width'] > 10000 or geometry_data['height'] > 10000):
logger.debug(f"Invalid geometry data, skipping save: {geometry_data}") logger.debug(f"Invalid geometry dimensions, skipping save: {geometry_data}")
return return
# Load existing config if it exists # Load existing config if it exists
@@ -2140,11 +2164,18 @@ class MainWindow(QtWidgets.QMainWindow):
screen_width = screen.width() screen_width = screen.width()
screen_height = screen.height() screen_height = screen.height()
# Use exact saved position with minimal validation (only prevent completely offscreen) # Use the exact saved position and dimensions - no adjustments
x = geometry_data['x'] x = geometry_data['x']
y = geometry_data['y'] y = geometry_data['y']
width = max(640, min(geometry_data['width'], screen_width)) # Minimum 640px wide width = geometry_data['width']
height = max(720, min(geometry_data['height'], screen_height)) # Minimum 720px tall (matching initial height) height = geometry_data['height']
# Only ensure the saved dimensions meet actual minimum requirements
# but preserve the exact position
if width < 640:
width = 640
if height < 720:
height = 720
# Only adjust position if window would be completely invisible (very permissive) # Only adjust position if window would be completely invisible (very permissive)
# Allow negative positions for multi-monitor setups # Allow negative positions for multi-monitor setups
@@ -2627,12 +2658,24 @@ class MainWindow(QtWidgets.QMainWindow):
}} }}
QComboBox::down-arrow {{ QComboBox::down-arrow {{
image: none; image: none;
width: 0; width: 0px;
height: 0; height: 0px;
border-left: 5px solid transparent; border-left: 5px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
border-top: 6px solid {colors['foreground']}; border-top: 6px solid {colors['foreground']};
margin: 0px; margin: 0px;
padding: 0px;
}}
QComboBox::down-arrow:hover {{
border-top-color: {colors['accent']};
}}
QComboBox QAbstractItemView {{
background-color: {colors['input_bg']};
border: 1px solid {colors['border']};
border-radius: 3px;
color: {colors['foreground']};
selection-background-color: {colors['accent']};
selection-color: white;
}} }}
QListWidget {{ QListWidget {{
font-size: 9pt; font-size: 9pt;
@@ -2721,6 +2764,10 @@ class MainWindow(QtWidgets.QMainWindow):
is_dark = self.get_effective_dark_mode() is_dark = self.get_effective_dark_mode()
self.apply_dark_title_bar(is_dark) self.apply_dark_title_bar(is_dark)
# Force immediate update and repaint
self.update()
self.repaint()
# Also apply to any open dialogs immediately # Also apply to any open dialogs immediately
for dialog in QtWidgets.QApplication.allWidgets(): for dialog in QtWidgets.QApplication.allWidgets():
if isinstance(dialog, QtWidgets.QDialog) and dialog.isVisible(): if isinstance(dialog, QtWidgets.QDialog) and dialog.isVisible():
@@ -2746,6 +2793,9 @@ class MainWindow(QtWidgets.QMainWindow):
break break
except: except:
continue continue
# Force dialog to update its theme styling
if hasattr(dialog, 'apply_theme_to_all_widgets'):
dialog.apply_theme_to_all_widgets()
except: except:
pass pass