-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
33 lines (28 loc) · 982 Bytes
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "qgraphicsitemfactory.h"
#include "commands.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
QGraphicsItemFactory factory;
ui->setupUi(this);
ui->graphicsView->setScene(ui->widget->getScene());
ui->graphicsView->setMouseTracking(true);
ui->widget->registerCommand("Select", new CommandSelect());
ui->widget->registerCommand("Move", new CommandMove());
ui->widget->registerCommand("Remove", new CommandRemove());
ui->widget->registerCommand("Group", new CommandGroup());
ui->widget->registerCommand("Enlarge", new CommandEnlarge());
ui->widget->registerCommand("Reduce", new CommandReduce());
ui->widget->registerCommand("Pin 1", new CommandPin1());
ui->widget->registerCommand("Pin 2", new CommandPin2());
for (QString& uid : factory.getUids()) {
ui->widget->registerCommand(uid, new CommandGraphicsItem(uid));
}
}
MainWindow::~MainWindow()
{
delete ui;
}