From: Soren Stoutner Date: Tue, 24 Dec 2024 21:19:10 +0000 (-0700) Subject: Fix the background of combo boxes in Domain Settings Dialog. https://redmine.stoutne... X-Git-Tag: v0.8~5 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=85e7de32d3aca6fcd9f91175856aad6c5f2c0aac;p=PrivacyBrowserPC.git Fix the background of combo boxes in Domain Settings Dialog. https://redmine.stoutner.com/issues/1252 --- diff --git a/doc/index.docbook b/doc/index.docbook index 5185d28..3bd7754 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1851,7 +1851,8 @@ - <ulink url="https://www.stoutner.com/privacy-browser-pc-0.7/">0.7</ulink> -11 December 2024 + <ulink url="https://www.stoutner.com/privacy-browser-pc-0.7/">0.7</ulink> - + <ulink url="https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=commitdiff;h=a459b80ec4603b2a48df3556c6dcf9ff805a56b0;ds=sidebyside">11 December 2024</ulink> Migrate to KDE 6. diff --git a/src/dialogs/DomainSettingsDialog.cpp b/src/dialogs/DomainSettingsDialog.cpp index cfe8248..8c77d6d 100644 --- a/src/dialogs/DomainSettingsDialog.cpp +++ b/src/dialogs/DomainSettingsDialog.cpp @@ -129,13 +129,13 @@ DomainSettingsDialog::DomainSettingsDialog(QWidget *parentWidgetPointer, const i 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) @@ -586,6 +586,19 @@ void DomainSettingsDialog::populateLabel(const int label) const } } + // 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. + comboBoxPointer->setPalette(comboBoxPalette); + // Populate the label and widget palette according to the currently selected combo box index. switch (comboBoxPointer->currentIndex()) { @@ -599,7 +612,6 @@ void DomainSettingsDialog::populateLabel(const int label) const // Reset the palette. widgetPointer->setPalette(defaultPalette); - break; } @@ -608,9 +620,8 @@ void DomainSettingsDialog::populateLabel(const int label) const // Set the enabled bold text. labelPointer->setText(enabledBoldString); - // Set the palette. + // Set the widget palette. widgetPointer->setPalette(highlightedPalette); - break; } @@ -619,9 +630,8 @@ void DomainSettingsDialog::populateLabel(const int label) const // Set the disabled bold text. labelPointer->setText(disabledBoldString); - // Set the palette. + // Set the widget palette. widgetPointer->setPalette(highlightedPalette); - break; } } @@ -643,7 +653,20 @@ void DomainSettingsDialog::populateUserAgentLabel(const QString &userAgentName) // Display the user agent name in bold. userAgentLabelPointer->setText(QLatin1String("") + userAgentName + QLatin1String("")); - // 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. + userAgentComboBoxPointer->setPalette(comboBoxPalette); + + // Set the widget palette. userAgentWidgetPointer->setPalette(highlightedPalette); } } diff --git a/src/widgets/DraggableTreeView.cpp b/src/widgets/DraggableTreeView.cpp index 0deada6..3500793 100644 --- a/src/widgets/DraggableTreeView.cpp +++ b/src/widgets/DraggableTreeView.cpp @@ -54,7 +54,7 @@ void DraggableTreeView::dropEvent(QDropEvent *dropEvent) int dropPosition = dropIndicatorPosition(); // Get the drop model index. - QModelIndex dropModelIndex = indexAt(dropEvent->pos()); + QModelIndex dropModelIndex = indexAt(dropEvent->position().toPoint()); // Create a previous parent folder ID standard C++ list (which can be sorted and from which duplicates can be removed). std::list *previousParentFolderIdListPointer = new std::list;