forked from Ramblurr/PietCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResizeDialog.cpp
51 lines (41 loc) · 1.54 KB
/
ResizeDialog.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "ResizeDialog.h"
#include <QtGui>
#include <QtWidgets>
ResizeDialog::ResizeDialog( const QSize &size, QWidget *parent ) :
QDialog( parent )
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
QWidget* formWidget = new QWidget( this );
QFormLayout* formLayout = new QFormLayout( formWidget );
QLabel* widthLabel = new QLabel( this );
widthLabel->setText( tr( "Width:" ) );
QLabel* heightLabel = new QLabel( this );
heightLabel->setText( tr( "Height:" ) );
mWidthSpin = new QSpinBox( this );
mWidthSpin->setMinimum( 1 );
mWidthSpin->setMaximum( 100 );
mWidthSpin->setSuffix( tr( " codels" ) );
mWidthSpin->setValue( size.width() );
mHeightSpin = new QSpinBox( this );
mHeightSpin->setMinimum( 1 );
mHeightSpin->setMaximum( 1000 );
mHeightSpin->setSuffix( tr( " codels" ) );
mHeightSpin->setValue( size.height() );
formLayout->addRow( widthLabel, mWidthSpin );
formLayout->addRow( heightLabel, mHeightSpin );
formWidget->setLayout( formLayout );
mainLayout->addWidget( formWidget );
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
mainLayout->addWidget( buttonBox );
setLayout( mainLayout );
}
ResizeDialog::~ResizeDialog()
{
}
QSize ResizeDialog::newSize() const
{
return QSize( mWidthSpin->value(), mHeightSpin->value() );
}
#include "ResizeDialog.moc"