1 #include "subfilereferenceeditor.h" |
1 #include "subfilereferenceeditor.h" |
2 #include "ui_subfilereferenceeditor.h" |
2 #include "ui_subfilereferenceeditor.h" |
3 #include "../linetypes/modelobject.h" |
3 #include "../linetypes/modelobject.h" |
4 #include "../primitives.h" |
4 #include "../primitives.h" |
5 #include "../guiutilities.h" |
5 #include "../guiutilities.h" |
|
6 #include "../dialogs/colorselector.h" |
6 |
7 |
7 SubfileReferenceEditor::SubfileReferenceEditor(LDSubfileReference* reference, QWidget* parent) : |
8 SubfileReferenceEditor::SubfileReferenceEditor(LDSubfileReference* reference, QWidget* parent) : |
8 QDialog {parent}, |
9 QDialog {parent}, |
9 reference {reference}, |
10 reference {reference}, |
10 ui {*new Ui::SubfileReferenceEditor} |
11 ui {*new Ui::SubfileReferenceEditor} |
13 this->ui.referenceName->setText(reference->referenceName()); |
14 this->ui.referenceName->setText(reference->referenceName()); |
14 this->color = reference->color(); |
15 this->color = reference->color(); |
15 this->ui.positionX->setValue(reference->position().x()); |
16 this->ui.positionX->setValue(reference->position().x()); |
16 this->ui.positionY->setValue(reference->position().y()); |
17 this->ui.positionY->setValue(reference->position().y()); |
17 this->ui.positionZ->setValue(reference->position().z()); |
18 this->ui.positionZ->setValue(reference->position().z()); |
18 ::setupColorButton(parent, this->ui.colorButton, &this->color); |
19 |
|
20 connect( |
|
21 this->ui.colorButton, |
|
22 &QPushButton::clicked, |
|
23 [&]() |
|
24 { |
|
25 if (ColorSelector::selectColor(this, this->color, this->color)) |
|
26 ::setColorButton(this->ui.colorButton, this->color); |
|
27 } |
|
28 ); |
|
29 |
19 for (int i : {0, 1, 2}) |
30 for (int i : {0, 1, 2}) |
20 for (int j : {0, 1, 2}) |
31 for (int j : {0, 1, 2}) |
21 { |
32 { |
22 QLayoutItem* item = this->ui.matrixLayout->itemAtPosition(i, j); |
33 QLayoutItem* item = this->ui.matrixLayout->itemAtPosition(i, j); |
23 QDoubleSpinBox* spinbox = item ? qobject_cast<QDoubleSpinBox*>(item->widget()) : nullptr; |
34 QDoubleSpinBox* spinbox = item ? qobject_cast<QDoubleSpinBox*>(item->widget()) : nullptr; |