-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystemproperties.cpp
More file actions
69 lines (61 loc) · 2.48 KB
/
Copy pathsystemproperties.cpp
File metadata and controls
69 lines (61 loc) · 2.48 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
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 "systemproperties.h"
#include "ui_systemproperties.h"
#include "mainwindow.h"
SystemProperties::SystemProperties(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::SystemProperties),
p(parent)
{
ui->setupUi(this);
//обрабатываем события кнопок в окне свойств системы
connect(ui->maxStateLoadBtn,SIGNAL(clicked(bool)), parent, SLOT(getMaxState()));
connect(ui->maxStateSaveBtn,SIGNAL(clicked(bool)), parent, SLOT(setMaxState()));
connect(ui->minStateLoadBtn,SIGNAL(clicked(bool)), parent, SLOT(getMinState()));
connect(ui->minStateSaveBtn,SIGNAL(clicked(bool)), parent, SLOT(setMinState()));
connect(ui->currentStateClearBtn,SIGNAL(clicked(bool)), parent, SLOT(clearCurrentState()));
connect(ui->currentStateChangeBtn,SIGNAL(clicked(bool)), parent, SLOT(changeCurrentState()));
connect(ui->interactionRangeSaveBtn,SIGNAL(clicked()), this, SLOT(changeInteractionRange()));
}
SystemProperties::~SystemProperties()
{
delete ui;
}
void SystemProperties::updateData(PartArray *sys)
{
ui->minStateCheck->setChecked((bool)sys->Minstate().size());
ui->maxStateCheck->setChecked((bool)sys->Maxstate().size());
ui->eMinLbl->setText(QString::number(sys->EMin()));
ui->eMaxLbl->setText(QString::number(sys->EMax()));
ui->partsNumberLabel->setText(QString::number(sys->size()));
ui->interactionRangeField->setValue(sys->interactionRange());
}
void SystemProperties::changeInteractionRange()
{
QMessageBox msgBox;
msgBox.setText("В результате действия будут удалены минимальная и максимальная энергии.");
msgBox.setInformativeText("Вы хотите продолжить?");
msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
int ret = msgBox.exec();
MainWindow *mw = qobject_cast<MainWindow*>(p);
if (ret==QMessageBox::Yes){
mw->setInteractionRange(this->ui->interactionRangeField->value());
} else {
emit mw->updateSys();
}
}
QString SystemProperties::split(const QString &s)
{
QString pathNameClean(s);
int c = pathNameClean.length();
int n=10; //каждые сколько символов разбивать на подстроки
if( c > n)
{
for(int i = n; i < c; i+=n)
{
pathNameClean.insert(i-1, " ");
}
}
return pathNameClean;
}