-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPreferencesDialog.cpp
More file actions
44 lines (39 loc) · 1.59 KB
/
PreferencesDialog.cpp
File metadata and controls
44 lines (39 loc) · 1.59 KB
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
#include "PreferencesDialog.h"
#include <QVBoxLayout>
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QToolBar>
#include <QStatusBar>
#include "MainWindow.h"
PreferencesDialog::PreferencesDialog(QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("Параметры"));
setWindowIcon(QIcon::fromTheme("preferences-other", QIcon(":/Images/Preferences.ico")));
// setAttribute(Qt::WA_DeleteOnClose);/////////////////////////////////////
QVBoxLayout *layout = new QVBoxLayout(this);
statusBar = (static_cast<MainWindow*>(parent))->statusBar();
toolBar = (static_cast<MainWindow*>(parent))->toolBar;
showToolBarCheckBox = new QCheckBox((tr("&Показать Панель управления")));
showToolBarCheckBox->setChecked(toolBar->isVisible());
showStatusBarCheckBox = new QCheckBox((tr("&Показать строку Уведомлений")));
showStatusBarCheckBox->setChecked(statusBar->isVisible());
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(showToolBarCheckBox);
layout->addWidget(showStatusBarCheckBox);
layout->addWidget(buttonBox);
setLayout(layout);
}
void PreferencesDialog::accept()
{
toolBar->setVisible(showToolBarCheckBox->isChecked());
statusBar->setVisible(showStatusBarCheckBox->isChecked());
done(1);
}
void PreferencesDialog::reject()
{
done(0);
}