src/guiutilities.cpp

changeset 1298
dbc8bb2a4d84
parent 1297
389516787a4c
child 1300
609b75b026c4
equal deleted inserted replaced
1297:389516787a4c 1298:dbc8bb2a4d84
22 #include "colors.h" 22 #include "colors.h"
23 #include "guiutilities.h" 23 #include "guiutilities.h"
24 #include "lddocument.h" 24 #include "lddocument.h"
25 #include "dialogs/colorselector.h" 25 #include "dialogs/colorselector.h"
26 #include "mainwindow.h" 26 #include "mainwindow.h"
27 #include "linetypes/modelobject.h"
28 #include "dialogs/subfilereferenceeditor.h"
29 #include "widgets/vertexobjecteditor.h"
27 30
28 GuiUtilities::GuiUtilities (QObject* parent) : 31 GuiUtilities::GuiUtilities (QObject* parent) :
29 QObject (parent), 32 QObject (parent),
30 HierarchyElement (parent) {} 33 HierarchyElement (parent) {}
31 34
165 button->setText(""); 168 button->setText("");
166 button->setStyleSheet(""); 169 button->setStyleSheet("");
167 } 170 }
168 } 171 }
169 172
170 void setupColorButton(QWidget* parent, QPushButton* button, LDColor* color) 173 void editObject(MainWindow* parent, LDObject* object)
171 { 174 {
172 QObject::connect( 175 if (object->type() == LDObjectType::SubfileReference)
173 button, 176 {
174 &QPushButton::clicked, 177 LDSubfileReference* reference = static_cast<LDSubfileReference*>(object);
175 [&]() 178 SubfileReferenceEditor editor {reference, parent};
176 { 179 editor.setPrimitivesTree(parent->primitives());
177 if (ColorSelector::selectColor(parent, *color, *color)) 180 editor.exec();
178 ::setColorButton(button, *color); 181 }
179 } 182 else
180 ); 183 {
181 setColorButton(button, *color); 184 VertexObjectEditor editor {object, parent};
185 editor.exec();
186 }
182 } 187 }

mercurial