highlightedPalette = defaultPalette;
// Get the default highlight color.
- QColor highlightColor = defaultPalette.color(QPalette::Highlight);
+ QColor alphaHighlightColor = defaultPalette.color(QPalette::Highlight);
// Set the highlight color to be partially transparent.
- highlightColor.setAlpha(64);
+ alphaHighlightColor.setAlpha(64);
// Set highlighted background color.
- highlightedPalette.setColor(QPalette::Window, highlightColor);
+ highlightedPalette.setColor(QPalette::Window, alphaHighlightColor);
// Setup the dialog according to the start type.
switch (startType)
}
}
+ // Get the combo box palette.
+ QPalette comboBoxPalette = comboBoxPointer->palette();
+
+ // Get the combo box window color.
+ QColor comboBoxWindowColor = comboBoxPalette.color(QPalette::Window);
+
+ // Set the combo box window color back to the palette. This makes the system think the palette has changed.
+ comboBoxPalette.setColor(QPalette::Window, comboBoxWindowColor);
+
+ // Explicitly set the combo box palette. Because the system thinks the palette has been changed, and because the combo box palette is being explicitly set,
+ // the system will not propagate the highlighted palette from the widget pointer palette down to the combo box. <https://redmine.stoutner.com/issues/1252>
+ comboBoxPointer->setPalette(comboBoxPalette);
+
// Populate the label and widget palette according to the currently selected combo box index.
switch (comboBoxPointer->currentIndex())
{
// Reset the palette.
widgetPointer->setPalette(defaultPalette);
-
break;
}
// Set the enabled bold text.
labelPointer->setText(enabledBoldString);
- // Set the palette.
+ // Set the widget palette.
widgetPointer->setPalette(highlightedPalette);
-
break;
}
// Set the disabled bold text.
labelPointer->setText(disabledBoldString);
- // Set the palette.
+ // Set the widget palette.
widgetPointer->setPalette(highlightedPalette);
-
break;
}
}
// Display the user agent name in bold.
userAgentLabelPointer->setText(QLatin1String("<strong>") + userAgentName + QLatin1String("</strong>"));
- // Set the palette.
+ // Get the combo box palette.
+ QPalette comboBoxPalette = userAgentComboBoxPointer->palette();
+
+ // Get the combo box window color.
+ QColor comboBoxWindowColor = comboBoxPalette.color(QPalette::Window);
+
+ // Set the combo box window color back to the palette. This makes the system think the palette has changed.
+ comboBoxPalette.setColor(QPalette::Window, comboBoxWindowColor);
+
+ // Explicitly set the combo box palette. Because the system thinks the palette has been changed, and because the combo box palette is being explicitly set,
+ // the system will not propagate the highlighted palette from the widget pointer palette down to the combo box. <https://redmine.stoutner.com/issues/1252>
+ userAgentComboBoxPointer->setPalette(comboBoxPalette);
+
+ // Set the widget palette.
userAgentWidgetPointer->setPalette(highlightedPalette);
}
}