]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Fix the background of combo boxes in Domain Settings Dialog. https://redmine.stoutne...
authorSoren Stoutner <soren@stoutner.com>
Tue, 24 Dec 2024 21:19:10 +0000 (14:19 -0700)
committerSoren Stoutner <soren@stoutner.com>
Tue, 24 Dec 2024 21:19:10 +0000 (14:19 -0700)
doc/index.docbook
src/dialogs/DomainSettingsDialog.cpp
src/widgets/DraggableTreeView.cpp

index 5185d282b992410395edda10936f9dc156bae5a6..3bd7754b9b14f60dac9040b08eecc192852c4319 100644 (file)
 
         <!-- Version 0.7. -->
         <sect1 id="version_0.7">
-            <title><ulink url="https://www.stoutner.com/privacy-browser-pc-0.7/">0.7</ulink> -11 December 2024</title>
+            <title><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></title>
 
             <itemizedlist>
                 <listitem><para>Migrate to <ulink url="https://redmine.stoutner.com/issues/1223">KDE 6</ulink>.</para></listitem>
index cfe824853fd995af40e7b7bf056cc46da70084cf..8c77d6d71f73a60fbfc3e91552ce3a0a2d7028d0 100644 (file)
@@ -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.  <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())
     {
@@ -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("<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);
     }
 }
index 0deada6b7ca161b8281fd4536abba7dc99524310..35007936e31505566b0870673e5527a4ed42a657 100644 (file)
@@ -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<double> *previousParentFolderIdListPointer = new std::list<double>;