summaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
blob: 5a548db559ab04715382ca2015d876e36fe1b2e2 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setCentralWidget(new InteractionCanvas());
}

MainWindow::~MainWindow()
{
    delete ui;
}

/**
 * @brief MainWindow::on_actionPreferences_triggered
 * Creates a DlgPreferences Dialog and sets hight and width of the MainWindow.
 */
void MainWindow::on_actionPreferences_triggered()
{
    qDebug() << "Preferences called";
    DlgPreferences *tmp = new DlgPreferences(this);

    tmp->setHeight(size().height());
    tmp->setWidth(size().width());

    if(tmp->exec())
    {
        qDebug() << "DlgPreferences okay clicked.";

        int width = tmp->Width();
        int height = tmp->Height();

        if(width >= 100 && width <= 800 && height >= 100 && height <= 800)
        {
            qDebug() << "Resizing QMainWindow.";
            resize(width,height);
        }
    }

    delete tmp;
}


void MainWindow::mouseMoveEvent(QMouseEvent *mouseEvent)
{
    qDebug() << "MainWindow:" << mouseEvent->pos();
}