src/document.cpp

changeset 187
30204975694a
parent 185
a38a0eb007b0
child 188
64ea7282611e
--- a/src/document.cpp	Thu Apr 14 11:08:20 2022 +0300
+++ b/src/document.cpp	Mon May 16 01:40:49 2022 +0300
@@ -27,6 +27,7 @@
 #include "tools/pathtool.h"
 #include "tools/selecttool.h"
 #include "tools/transformtool.h"
+#include "tools/circletool.h"
 
 Document::Document(
 	Model* model,
@@ -43,6 +44,8 @@
 	toolsBar{new QToolBar{this}}
 {
 	this->ui.setupUi(this);
+	const int listWidth = static_cast<int>(this->width() / 3);
+	this->ui.viewportListSplitter->setSizes({listWidth * 2, listWidth});
 	this->ui.toolsBarContainer->setLayout(new QVBoxLayout{this->ui.toolsBarContainer});
 	this->ui.toolsBarContainer->layout()->addWidget(this->toolsBar);
 	this->ui.listView->setModel(model);
@@ -50,7 +53,7 @@
 	this->ui.viewportFrame->layout()->addWidget(this->renderer);
 	this->toolsBar->setOrientation(Qt::Vertical);
 	this->setMouseTracking(true);
-	connect(this->ui.splitter, &QSplitter::splitterMoved, this, &Document::splitterChanged);
+	connect(this->ui.viewportListSplitter, &QSplitter::splitterMoved, this, &Document::splitterChanged);
 	connect(this->renderer, &Canvas::newStatusText, this, &Document::newStatusText);
 	connect(this->renderer, &Canvas::selectionChanged, [&](const QSet<ldraw::id_t>& newSelection)
 	{
@@ -115,12 +118,12 @@
 
 QByteArray Document::saveSplitterState() const
 {
-	return this->ui.splitter->saveState();
+	return this->ui.viewportListSplitter->saveState();
 }
 
 void Document::restoreSplitterState(const QByteArray& state)
 {
-	this->ui.splitter->restoreState(state);
+	this->ui.viewportListSplitter->restoreState(state);
 }
 
 void Document::setRenderPreferences(const gl::RenderPreferences& newPreferences)
@@ -161,6 +164,7 @@
 	this->tools.reserve(3);
 	this->tools.push_back(new SelectTool{this});
 	this->tools.push_back(new DrawTool{this});
+	this->tools.push_back(new CircleTool{this});
 	this->tools.push_back(new PathTool{this});
 	this->tools.push_back(new TransformTool{this});
 	for (BaseTool* const toolInstance : this->tools)

mercurial