mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-20 15:24:14 +02:00
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.
This commit is contained in:
@@ -29,6 +29,9 @@ TerminalStripLayoutEditor::TerminalStripLayoutEditor(QSharedPointer<TerminalStri
|
||||
{
|
||||
ui->setupUi(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();
|
||||
}
|
||||
|
||||
@@ -251,8 +251,10 @@ QList<QStandardItem *> 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<QColor>();
|
||||
qsi->setData(color, Qt::EditRole);
|
||||
qsi->setData(color, Qt::ForegroundRole);
|
||||
qsi->setData(color, Qt::DecorationRole);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user