From b208a4f13162dc77082f2c9bc0cc15cf505420f4 Mon Sep 17 00:00:00 2001 From: Jeff Patterson Date: Sun, 13 Sep 2026 18:44:16 -0500 Subject: [PATCH] Show the text color as a swatch and keep the terminal plan preview on white The Selection properties "texts" tab painted the color value's own text in that color, so the default black was unreadable on a dark palette. Show a swatch in the cell instead and leave the text in the palette's color. The terminal plan preview draws black ink with a white brush, like the printed page it previews, on whatever background the view inherits from the palette. Give the view a white background. --- sources/TerminalStrip/ui/terminalstriplayouteditor.cpp | 3 +++ sources/ui/dynamicelementtextmodel.cpp | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp b/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp index 1801cf318..9b1a3506a 100644 --- a/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp +++ b/sources/TerminalStrip/ui/terminalstriplayouteditor.cpp @@ -29,6 +29,9 @@ TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointersetupUi(this); ui->m_graphics_view->setScene(new QGraphicsScene{ this }); + // The preview is printed output: black ink on a white page, whatever + // the application palette. + ui->m_graphics_view->setBackgroundBrush(Qt::white); ui->m_graphics_view->scene()->addItem(&m_preview_strip_item); updateUi(); } diff --git a/sources/ui/dynamicelementtextmodel.cpp b/sources/ui/dynamicelementtextmodel.cpp index 6ad12570a..3939d50b3 100644 --- a/sources/ui/dynamicelementtextmodel.cpp +++ b/sources/ui/dynamicelementtextmodel.cpp @@ -251,8 +251,10 @@ QList DynamicElementTextModel::itemsForText( QStandardItem *color = new QStandardItem(tr("Couleur")); color->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + // Shown as a swatch next to the value, not as the text color: black + // text (the default) is unreadable on a dark palette. QStandardItem *colora = new QStandardItem; - colora->setData(deti->color(), Qt::ForegroundRole); + colora->setData(deti->color(), Qt::DecorationRole); colora->setData(deti->color(), Qt::EditRole); colora->setData(DynamicElementTextModel::color, Qt::UserRole+1); colora->setFlags(Qt::ItemIsSelectable @@ -1500,7 +1502,7 @@ void DynamicElementTextModel::updateDataFromText(DynamicElementTextItem *deti, case color: { qsi->child(color_txt_row,1)->setData(deti->color(), Qt::EditRole); - qsi->child(color_txt_row,1)->setData(deti->color(), Qt::ForegroundRole); + qsi->child(color_txt_row,1)->setData(deti->color(), Qt::DecorationRole); break; } case pos: @@ -1832,7 +1834,7 @@ void DynamicTextItemDelegate::setModelData( { QColor color = editor->property("color").value(); qsi->setData(color, Qt::EditRole); - qsi->setData(color, Qt::ForegroundRole); + qsi->setData(color, Qt::DecorationRole); } return; }