summaryrefslogtreecommitdiff
path: root/numberator.cpp
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-12-17 15:43:37 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-12-17 15:43:37 +0100
commit6a484c615ae3f04873fe41a415277ef6c2c37573 (patch)
treeb2f429eb1baf703463821624691921e1426b7361 /numberator.cpp
parentc6713d0876ce2d99f912151c9884477606909681 (diff)
downloadnumberator-6a484c615ae3f04873fe41a415277ef6c2c37573.tar.gz
numberator-6a484c615ae3f04873fe41a415277ef6c2c37573.tar.bz2
numberator-6a484c615ae3f04873fe41a415277ef6c2c37573.zip
Diffstat (limited to 'numberator.cpp')
-rw-r--r--numberator.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/numberator.cpp b/numberator.cpp
index 3161ee8..3fe6497 100644
--- a/numberator.cpp
+++ b/numberator.cpp
@@ -3,6 +3,7 @@
#include "ui_TagListDock.h"
#include <QMessageBox>
+#include <QToolbar>
Numberator::Numberator(QWidget *parent)
: QMainWindow(parent)
@@ -88,6 +89,30 @@ Numberator::Numberator(QWidget *parent)
}
});
+ QToolBar *tools_tb = new QToolBar("Tools", this);
+ struct tool_def {
+ ToolType type;
+ QString filename;
+ QString name;
+ };
+
+ std::initializer_list<struct tool_def> tool_defs = {
+ {SELECTION_TOOL, ":/icons/selection_tool.png", "Select"},
+ {TAG_TOOL, ":/icons/tag.png", "Add Tag"},
+ {MOVE_TOOL, ":/icons/move_tool.png", "Move Tag"},
+ {EDIT_TOOL, ":/icons/edit_tool.png", "Edit Tag"},
+ };
+ QActionGroup toolsActionGroup(this);
+ for (auto tool : tool_defs) {
+ auto action = tools_tb->addAction(QIcon(tool.filename), tool.name, [=](){
+ setTool(tool.type);
+ });
+ action->setCheckable(true);
+ toolsActionGroup.addAction(action);
+ }
+ toolsActionGroup.actions().first()->setChecked(true);
+ this->addToolBar(Qt::TopToolBarArea, tools_tb);
+
ui->menuView->addAction(dock->toggleViewAction());
connect(ui->actionReload_Image, &QAction::triggered, &proj, &SQLiteSaveFile::reloadImageFromDisk);
@@ -151,6 +176,11 @@ Numberator::~Numberator()
delete ui;
}
+void Numberator::setTool(Numberator::ToolType tool)
+{
+ ui->graphicsView->scene()->setTool(tool);
+}
+
bool Numberator::showConfirmDiscardDialog()
{
if (!proj.isMemory() || !proj.isDirty())