From 72b215bb23c2dd651a26ddf8b05a290da583d360 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Wed, 7 Oct 2026 20:53:11 +1300 Subject: [PATCH] Always use Qt's own colour dialog On GTK desktops (Mint, XFCE, GNOME) Qt hands QColorDialog to GTK's chooser. Its "Custom" row is a recent-colours list kept by GTK: every colour picked is pushed in on the left and the oldest drops out, so a user's saved wire colours are lost (forum topic 3190). It also ignores the custom colours QET saves (#918) and has no swatch grid for the double-click to accept (#1172). Pass DontUseNativeDialog at every colour dialog, so all platforms get the dialog Windows already shows: 16 custom slots that change only on "Add to Custom Colors", saved across restarts. Co-Authored-By: Claude Opus 5.5 --- sources/SearchAndReplace/ui/replaceconductordialog.cpp | 6 ++++-- sources/diagramview.cpp | 3 +++ sources/editor/ui/terminaleditor.cpp | 3 ++- sources/richtext/richtexteditor.cpp | 3 ++- sources/ui/conductorcolortoolbutton.cpp | 1 + sources/ui/configpage/guidespropertieswidget.cpp | 3 ++- sources/ui/diagrambgcolorbutton.cpp | 3 ++- sources/ui/dynamicelementtextmodel.cpp | 3 ++- sources/ui/nokde/kcolorbutton.cpp | 3 ++- 9 files changed, 20 insertions(+), 8 deletions(-) diff --git a/sources/SearchAndReplace/ui/replaceconductordialog.cpp b/sources/SearchAndReplace/ui/replaceconductordialog.cpp index 9b8fd7017..627ab5d25 100644 --- a/sources/SearchAndReplace/ui/replaceconductordialog.cpp +++ b/sources/SearchAndReplace/ui/replaceconductordialog.cpp @@ -329,7 +329,8 @@ void ReplaceConductorDialog::on_m_update_preview_pb_clicked() void ReplaceConductorDialog::on_m_color_pb_clicked() { - QColor color = QColorDialog::getColor(m_properties.color, this); + QColor color = QColorDialog::getColor(m_properties.color, this, QString(), + QColorDialog::DontUseNativeDialog); if (color.isValid()) { setColorButton(color); } @@ -337,7 +338,8 @@ void ReplaceConductorDialog::on_m_color_pb_clicked() void ReplaceConductorDialog::on_m_color_2_pb_clicked() { - QColor color = QColorDialog::getColor(m_properties.m_color_2, this); + QColor color = QColorDialog::getColor(m_properties.m_color_2, this, QString(), + QColorDialog::DontUseNativeDialog); if (color.isValid()) { setColorButton2(color); } diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 0e67bf5ac..b8e26ff5e 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -177,6 +177,9 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : #ifdef Q_OS_MACOS color_dialog -> setWindowFlags(Qt::Sheet); #endif + // Qt's own dialog on every platform: the GTK one keeps its own + // recent-colours row and ignores the custom colours QET saves + color_dialog->setOption(QColorDialog::DontUseNativeDialog); color_dialog->setCurrentColor(initial_properties.color); ColorDialogDoubleClick::install(color_dialog); diff --git a/sources/editor/ui/terminaleditor.cpp b/sources/editor/ui/terminaleditor.cpp index f3d23b7d9..ce9b1ea06 100644 --- a/sources/editor/ui/terminaleditor.cpp +++ b/sources/editor/ui/terminaleditor.cpp @@ -411,7 +411,8 @@ void TerminalEditor::labelColorClicked() m_locked = true; #ifdef BUILD_WITHOUT_KF - QColor new_color = QColorDialog::getColor(m_part->labelColor(), this); + QColor new_color = QColorDialog::getColor(m_part->labelColor(), this, QString(), + QColorDialog::DontUseNativeDialog); if (new_color.isValid() && m_part->labelColor() != new_color) { auto undo = new QPropertyUndoCommand(m_part, "label_color", m_part->labelColor(), new_color); undo->setText(tr("Modifier la couleur du label")); diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index a982db81f..9fd1eee45 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -387,7 +387,8 @@ void ColorAction::setColor(const QColor &color) void ColorAction::chooseColor() { - const QColor col = QColorDialog::getColor(m_color, nullptr); + const QColor col = QColorDialog::getColor(m_color, nullptr, QString(), + QColorDialog::DontUseNativeDialog); if (col.isValid() && col != m_color) { setColor(col); emit colorChanged(m_color); diff --git a/sources/ui/conductorcolortoolbutton.cpp b/sources/ui/conductorcolortoolbutton.cpp index f85ece30c..12bdd6f63 100644 --- a/sources/ui/conductorcolortoolbutton.cpp +++ b/sources/ui/conductorcolortoolbutton.cpp @@ -220,6 +220,7 @@ void ConductorColorToolButton::chooseOtherColor() { QColorDialog dialog(m_current, this); dialog.setWindowTitle(tr("Choisir une couleur de conducteur")); + dialog.setOption(QColorDialog::DontUseNativeDialog); ColorDialogDoubleClick::install(&dialog); if (dialog.exec() == QDialog::Accepted && dialog.selectedColor().isValid()) { applyColor(dialog.selectedColor()); diff --git a/sources/ui/configpage/guidespropertieswidget.cpp b/sources/ui/configpage/guidespropertieswidget.cpp index 73b3d3e96..4bac17a29 100644 --- a/sources/ui/configpage/guidespropertieswidget.cpp +++ b/sources/ui/configpage/guidespropertieswidget.cpp @@ -96,7 +96,8 @@ void GuidesPropertiesWidget::addGuide() { colorBtn->setStyleSheet(QString("background-color: %1; color: white; font-weight: bold;").arg(defaultColor.name())); connect(colorBtn, &QPushButton::clicked, [this, colorBtn]() { - QColor c = QColorDialog::getColor(colorBtn->property("color").value(), this); + QColor c = QColorDialog::getColor(colorBtn->property("color").value(), this, + QString(), QColorDialog::DontUseNativeDialog); if (c.isValid()) { colorBtn->setProperty("color", c); colorBtn->setStyleSheet(QString("background-color: %1; color: white; font-weight: bold;").arg(c.name())); diff --git a/sources/ui/diagrambgcolorbutton.cpp b/sources/ui/diagrambgcolorbutton.cpp index e16e81321..3612c8a10 100644 --- a/sources/ui/diagrambgcolorbutton.cpp +++ b/sources/ui/diagrambgcolorbutton.cpp @@ -186,7 +186,8 @@ void DiagramBgColorToolButton::applySystemColor() void DiagramBgColorToolButton::chooseOtherColor() { const QColor c = QColorDialog::getColor(m_current, this, - tr("Choisir une couleur de fond")); + tr("Choisir une couleur de fond"), + QColorDialog::DontUseNativeDialog); if (c.isValid()) { applyColor(c); } diff --git a/sources/ui/dynamicelementtextmodel.cpp b/sources/ui/dynamicelementtextmodel.cpp index a3e825218..f761f99c3 100644 --- a/sources/ui/dynamicelementtextmodel.cpp +++ b/sources/ui/dynamicelementtextmodel.cpp @@ -1729,7 +1729,8 @@ QWidget *DynamicTextItemDelegate::createEditor( * handling, so it didn't crash). Resolving the dialog * before returning removes the second, competing teardown * path entirely. */ - QColor color = QColorDialog::getColor(index.data(Qt::EditRole).value(), parent); + QColor color = QColorDialog::getColor(index.data(Qt::EditRole).value(), parent, + QString(), QColorDialog::DontUseNativeDialog); QWidget *w = new QWidget(parent); if (color.isValid()) { diff --git a/sources/ui/nokde/kcolorbutton.cpp b/sources/ui/nokde/kcolorbutton.cpp index 3436d06f1..987ced849 100644 --- a/sources/ui/nokde/kcolorbutton.cpp +++ b/sources/ui/nokde/kcolorbutton.cpp @@ -48,7 +48,8 @@ void KColorButton::setColor(const QColor &color) void KColorButton::chooseColor() { - const auto selected = QColorDialog::getColor(m_color, this); + const auto selected = QColorDialog::getColor(m_color, this, QString(), + QColorDialog::DontUseNativeDialog); if (!selected.isValid() || selected == m_color) { return; }