diff -r ee5758ddb6d2 -r 8e1fe64ce4e3 src/widgets/colorindexinput.cpp --- a/src/widgets/colorindexinput.cpp Sat Jun 11 15:20:24 2022 +0300 +++ b/src/widgets/colorindexinput.cpp Sun Jun 12 20:47:04 2022 +0300 @@ -3,15 +3,15 @@ #include "colorselectdialog.h" #include "uiutilities.h" -ColorIndexInput::ColorIndexInput(EditorTabWidget *document, ColorIndex color, QWidget *parent) : +ColorIndexInput::ColorIndexInput(ColorTable *colorTable, ColorIndex color, QWidget *parent) : QWidget{parent}, - document{document}, + colorTable{colorTable}, ui{*new Ui_ColorIndexInput} { this->ui.setupUi(this); connect(this->ui.button, &QPushButton::clicked, [this]() { - ColorSelectDialog dialog{this->document->colorTable, this->document}; + ColorSelectDialog dialog{*this->colorTable, this}; const int result = dialog.exec(); if (result == QDialog::Accepted) { @@ -20,8 +20,9 @@ }); connect(this->ui.index, qOverload(&QSpinBox::valueChanged), [this](int value) { - this->ui.button->setText(colorDisplayName({value}, this->document->colorTable).value_or("???")); - const opt face = colorFace({value}, this->document->colorTable); + const opt displayName = colorDisplayName({value}, *this->colorTable); + const opt face = colorFace({value}, *this->colorTable); + this->ui.button->setText(displayName.value_or(tr("???"))); if (face.has_value()) { uiutilities::colorizeWidget(this->ui.button, *face); }