-
Notifications
You must be signed in to change notification settings - Fork 0
/
setdialog.cpp
executable file
·71 lines (50 loc) · 2.35 KB
/
setdialog.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "setdialog.h"
#include "pages.h"
SetDialog::SetDialog(QWidget *parent) :
QDialog(parent)
{
verticalLayout = new QVBoxLayout(this);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
horizontalLayout = new QHBoxLayout();
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
listWidget = new QListWidget(this);
listWidget->setViewMode(QListView::IconMode);
listWidget->setIconSize(QSize(72, 72));
listWidget->setMovement(QListView::Static);
listWidget->setMaximumWidth(128);
listWidget->setSpacing(12);
horizontalLayout->addWidget(listWidget);
stackedWidget = new QStackedWidget(this);
stackedWidget->addWidget(new FormulaWidget(stackedWidget));
stackedWidget->addWidget(new CustomCurveWidget(stackedWidget));
horizontalLayout->addWidget(stackedWidget);
verticalLayout->addLayout(horizontalLayout);
buttonBox = new QDialogButtonBox(this);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
verticalLayout->addWidget(buttonBox);
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QListWidgetItem *configButton = new QListWidgetItem(listWidget);
configButton->setIcon(QIcon(":/images/mydocuments.png"));
configButton->setText(tr("Calc Formula"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *updateButton = new QListWidgetItem(listWidget);
updateButton->setIcon(QIcon(":/images/looknfeel.png"));
updateButton->setText(tr("Custom curve"));
updateButton->setTextAlignment(Qt::AlignHCenter);
updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(listWidget,
SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
this, SLOT(changePage(QListWidgetItem *, QListWidgetItem*)));
listWidget->setCurrentRow(0);
setWindowTitle(tr("Config Dialog"));
}
void SetDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
if (!current)
current = previous;
stackedWidget->setCurrentIndex(listWidget->row(current));
}