src/document.cpp

changeset 188
64ea7282611e
parent 187
30204975694a
child 191
d355d4c52d51
equal deleted inserted replaced
187:30204975694a 188:64ea7282611e
165 this->tools.push_back(new SelectTool{this}); 165 this->tools.push_back(new SelectTool{this});
166 this->tools.push_back(new DrawTool{this}); 166 this->tools.push_back(new DrawTool{this});
167 this->tools.push_back(new CircleTool{this}); 167 this->tools.push_back(new CircleTool{this});
168 this->tools.push_back(new PathTool{this}); 168 this->tools.push_back(new PathTool{this});
169 this->tools.push_back(new TransformTool{this}); 169 this->tools.push_back(new TransformTool{this});
170 for (BaseTool* const toolInstance : this->tools) 170 for (BaseTool* toolInstance : this->tools)
171 { 171 {
172 QAction* action = new QAction{toolInstance->name(), this}; 172 QAction* action = new QAction{toolInstance->name(), this};
173 action->setCheckable(true); 173 action->setCheckable(true);
174 this->toolActions[toolInstance] = action; 174 this->toolActions[toolInstance] = action;
175 action->setToolTip(toolInstance->toolTip()); 175 action->setToolTip(toolInstance->toolTip());
183 } 183 }
184 else 184 else
185 { 185 {
186 this->ui.toolWidgetStack->addWidget(new QWidget{this}); 186 this->ui.toolWidgetStack->addWidget(new QWidget{this});
187 } 187 }
188 connect(toolInstance, &BaseTool::desiredGridChange, this->renderer, &Canvas::setGridMatrix);
188 } 189 }
189 this->selectTool(this->tools[0]); 190 this->selectTool(this->tools[0]);
190 } 191 }
191 192
192 void Document::toolActionTriggered() 193 void Document::toolActionTriggered()
238 void Document::adjustGridToView() 239 void Document::adjustGridToView()
239 { 240 {
240 this->renderer->adjustGridToView(); 241 this->renderer->adjustGridToView();
241 } 242 }
242 243
244 const glm::mat4 &Document::currentGrid() const
245 {
246 return this->renderer->getGridMatrix();
247 }
248
243 const Model &Document::getModel() const 249 const Model &Document::getModel() const
244 { 250 {
245 return *this->model; 251 return *this->model;
246 } 252 }
247 253

mercurial