src/widgets/colorindexinput.cpp

changeset 258
fe094d0687ad
parent 214
8e1fe64ce4e3
child 264
76a025db4948
equal deleted inserted replaced
257:afdab56e8210 258:fe094d0687ad
1 #include "colorindexinput.h" 1 #include "colorindexinput.h"
2 #include "ui_colorindexinput.h" 2 #include "ui_colorindexinput.h"
3 #include "colorselectdialog.h" 3 #include "colorselectdialog.h"
4 #include "uiutilities.h" 4 #include "uiutilities.h"
5 5
6 ColorIndexInput::ColorIndexInput(ColorTable *colorTable, ColorIndex color, QWidget *parent) : 6 ColorIndexInput::ColorIndexInput(QWidget *parent) :
7 QWidget{parent}, 7 QWidget{parent},
8 colorTable{colorTable},
9 ui{*new Ui_ColorIndexInput} 8 ui{*new Ui_ColorIndexInput}
10 { 9 {
10 static const ColorTable emptyColorTable;
11 this->colorTable = &emptyColorTable;
11 this->ui.setupUi(this); 12 this->ui.setupUi(this);
12 connect(this->ui.button, &QPushButton::clicked, [this]() 13 connect(this->ui.button, &QPushButton::clicked, [this]()
13 { 14 {
14 ColorSelectDialog dialog{*this->colorTable, this}; 15 ColorSelectDialog dialog{*this->colorTable, this};
15 const int result = dialog.exec(); 16 const int result = dialog.exec();
26 if (face.has_value()) { 27 if (face.has_value()) {
27 uiutilities::colorizeWidget(this->ui.button, *face); 28 uiutilities::colorizeWidget(this->ui.button, *face);
28 } 29 }
29 Q_EMIT this->colorChanged({value}); 30 Q_EMIT this->colorChanged({value});
30 }); 31 });
31 this->ui.index->setValue(color.index); 32 this->ui.index->setValue(MAIN_COLOR.index);
32 } 33 }
33 34
34 ColorIndexInput::~ColorIndexInput() 35 ColorIndexInput::~ColorIndexInput()
35 { 36 {
36 delete &this->ui; 37 delete &this->ui;

mercurial