summaryrefslogtreecommitdiffstats
path: root/dlgpreferences.cpp
blob: 4661fa5ec4029099bc20333be2ce3693f51d5052 (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
51
52
53
54
55
56
57
58
59
60
#include "dlgpreferences.h"
#include "ui_dlgpreferences.h"

DlgPreferences::DlgPreferences(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgPreferences)
{
    ui->setupUi(this);

    QIntValidator *val = new QIntValidator(100,800,this);
    ui->lineEditHeight->setValidator(val);
    ui->lineEditWidth->setValidator(val);
}

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

void DlgPreferences::setHeight(int arg)
{
    if (m_Height == arg)
        return;

    m_Height = arg;
    ui->lineEditHeight->setText(QString::number(m_Height));
    emit HeightChanged(arg);
}

void DlgPreferences::setWidth(int arg)
{
    if (m_Width == arg)
        return;

    m_Width = arg;
    ui->lineEditWidth->setText(QString::number(m_Width));
    emit WidthChanged(arg);
}



void DlgPreferences::on_buttonOk_clicked()
{
    qDebug() << "Height: " << ui->lineEditHeight->text();
    qDebug() << "Width:" << ui->lineEditWidth->text();
}


void DlgPreferences::accept()
{
    setHeight(ui->lineEditHeight->text().toInt());
    setWidth(ui->lineEditWidth->text().toInt());

    QDialog::accept();
}

void DlgPreferences::reject()
{
    QDialog::reject();
}