throttle: fix label text color wasn't set, used system default.

Dieser Commit ist enthalten in:
Reinder Feenstra 2025-09-29 23:03:22 +02:00
Ursprung 83b1eb11ac
Commit 380912b794
2 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -32,6 +32,7 @@ struct ThrottleStyle
inline static const QColor buttonDisabledColor{0x80, 0x80, 0x80};
inline static const QColor buttonEStopColor{0xCF, 0x66, 0x79};
inline static const QColor buttonTextColor{0x00, 0x00, 0x00};
inline static const QColor textColor{0xFF, 0xFF, 0xFF};
};
#endif

Datei anzeigen

@ -187,6 +187,9 @@ ThrottleWidget::ThrottleWidget(ObjectPtr train, QWidget* parent)
});
auto* main = new QVBoxLayout();
QPalette palette = m_nameLabel->palette();
palette.setColor(m_nameLabel->foregroundRole(), ThrottleStyle::textColor);
m_nameLabel->setPalette(palette);
QFont font = m_nameLabel->font();
font.setBold(true);
m_nameLabel->setFont(font);
@ -209,6 +212,9 @@ ThrottleWidget::ThrottleWidget(ObjectPtr train, QWidget* parent)
main->addLayout(columns, 1);
auto* bottom = new QHBoxLayout();
palette = m_throttleStatus->palette();
palette.setColor(m_throttleStatus->foregroundRole(), ThrottleStyle::textColor);
m_throttleStatus->setPalette(palette);
bottom->addWidget(m_throttleStatus, 1);
bottom->addWidget(m_throttleAction);
main->addLayout(bottom);
@ -612,6 +618,9 @@ void ThrottleWidget::createDecoderFunctionWidgets(size_t vehicleIndex)
if(auto* name = m_trainVehicles[vehicleIndex]->getProperty("name"))
{
auto* nameLabel = new QLabel(name->toString(), this);
QPalette palette = nameLabel->palette();
palette.setColor(nameLabel->foregroundRole(), ThrottleStyle::textColor);
nameLabel->setPalette(palette);
connect(name, &AbstractProperty::valueChangedString, nameLabel, &QLabel::setText);
grid->addWidget(nameLabel, 0, 0, 1, functionButtonsPerRow + 1);
}