Fix UI inconsistencies and improve dark mode appearance
This commit addresses multiple UI issues related to theme switching and
dark mode styling:
1. Fix spinbox height inconsistency between light and dark modes
- Add changeEvent() handler in AmountSpinBox to invalidate cached
size hint when theme/style/palette changes
- Force updateGeometry() on all visible widgets after theme toggle
- Add min-height and padding to dark mode spinbox CSS to match
light mode dimensions
2. Improve spinbox button visibility in dark mode
- Add visible background and borders to up/down buttons
- Use dark grey arrows (#808080) instead of white for better contrast
- Add hover states with appropriate dark theme colors
- Set proper button width (16px) for consistent appearance
3. Enhanced theme switching
- Invalidate widget geometry caches when switching between themes
- Ensure consistent rendering between native (light) and stylesheet
(dark) rendering modes
Files modified:
- src/qt/palladiumamountfield.cpp: Add changeEvent() handler
- src/qt/palladiumgui.cpp: Force geometry update after theme change
- src/qt/res/styles/dark.qss: Improve spinbox styling with proper
dimensions, button visibility, and dark-appropriate colors
This ensures a consistent user experience across both themes with
properly sized widgets and visible, theme-appropriate controls
This commit is contained in:
@@ -190,6 +190,19 @@ protected:
|
||||
return QAbstractSpinBox::event(event);
|
||||
}
|
||||
|
||||
void changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::StyleChange ||
|
||||
event->type() == QEvent::PaletteChange ||
|
||||
event->type() == QEvent::FontChange)
|
||||
{
|
||||
// Invalidate cached size hint when theme/style changes
|
||||
cachedMinimumSizeHint = QSize();
|
||||
updateGeometry();
|
||||
}
|
||||
QAbstractSpinBox::changeEvent(event);
|
||||
}
|
||||
|
||||
StepEnabled stepEnabled() const
|
||||
{
|
||||
if (isReadOnly()) // Disable steps when AmountSpinBox is read-only
|
||||
|
||||
@@ -1544,14 +1544,22 @@ void PalladiumGUI::toggleTheme()
|
||||
// 1. Standard Theme (Weiß)
|
||||
qApp->setStyleSheet("");
|
||||
qApp->setPalette(style()->standardPalette());
|
||||
|
||||
|
||||
// 2. Speichern, dass er aus ist
|
||||
settings.setValue("darkModeEnabled", false);
|
||||
|
||||
|
||||
if (modalOverlay) {
|
||||
modalOverlay->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
|
||||
// Force geometry recalculation for all widgets after theme change
|
||||
// This ensures proper sizing when switching between native (light) and stylesheet (dark) rendering
|
||||
for (QWidget *widget : qApp->allWidgets()) {
|
||||
if (widget && widget->isVisible()) {
|
||||
widget->updateGeometry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PalladiumGUI::checkUpdate()
|
||||
|
||||
@@ -432,6 +432,8 @@ PalladiumAmountField QAbstractSpinBox {
|
||||
background-color: #1E1E1E;
|
||||
color: #FFFFFF;
|
||||
border: 1px solid #4A4A4A;
|
||||
min-height: 26px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox:hover {
|
||||
@@ -444,6 +446,49 @@ PalladiumAmountField QAbstractSpinBox:focus {
|
||||
background-color: #252525;
|
||||
}
|
||||
|
||||
/* Fix for spinbox up/down buttons visibility */
|
||||
PalladiumAmountField QAbstractSpinBox::up-button,
|
||||
PalladiumAmountField QAbstractSpinBox::down-button {
|
||||
background-color: #2A2A2A;
|
||||
border: 1px solid #3A3A3A;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox::up-button:hover,
|
||||
PalladiumAmountField QAbstractSpinBox::down-button:hover {
|
||||
background-color: #3A3A3A;
|
||||
border: 1px solid #4A4A4A;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox::up-button:pressed,
|
||||
PalladiumAmountField QAbstractSpinBox::down-button:pressed {
|
||||
background-color: #007BFF;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox::up-arrow {
|
||||
image: none;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-bottom: 6px solid #808080;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox::down-arrow {
|
||||
image: none;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-top: 6px solid #808080;
|
||||
}
|
||||
|
||||
PalladiumAmountField QAbstractSpinBox::up-arrow:hover,
|
||||
PalladiumAmountField QAbstractSpinBox::down-arrow:hover {
|
||||
border-bottom-color: #A0A0A0;
|
||||
border-top-color: #A0A0A0;
|
||||
}
|
||||
|
||||
PalladiumAmountField QComboBox {
|
||||
background-color: #1E1E1E;
|
||||
color: #E0E0E0;
|
||||
|
||||
Reference in New Issue
Block a user