-
Notifications
You must be signed in to change notification settings - Fork 0
/
methodeditor.cpp
73 lines (58 loc) · 1.83 KB
/
methodeditor.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
70
71
72
73
#include "methodeditor.h"
MethodEditor::MethodEditor(): FunctionEditor ()
{
setFixedHeight(300);
m_scope=new QComboBox;
m_scope->addItem("public");
m_scope->addItem("protected");
m_scope->addItem("private");
m_flLine->addRow("Scope", m_scope);
m_const=new QCheckBox;
m_flLine->addRow("Make constant fonction", m_const);
m_virtual=new QRadioButton("virtual");
m_static=new QRadioButton("static");
m_normal=new QRadioButton("");
m_normal->setChecked(true);
QGridLayout *glMode=new QGridLayout;
glMode->addWidget(m_normal, 0, 0);
glMode->addWidget(m_virtual, 1, 0);
glMode->addWidget(m_static, 2, 0);
m_pureVirtual=new QCheckBox("pure virtual");
m_pureVirtual->setEnabled(false);
glMode->addWidget(m_pureVirtual, 1, 1);
QGroupBox *gbMode=new QGroupBox;
gbMode->setLayout(glMode);
m_vlmain->insertWidget(1, gbMode);
connect(m_virtual, SIGNAL(toggled(bool)), this, SLOT(enableVirtual(bool)));
connect(m_validate, SIGNAL(clicked()), this, SLOT(validate()));
}
void MethodEditor::enableVirtual(bool value){
if(value){
m_pureVirtual->setEnabled(true);
}
else{
m_pureVirtual->setEnabled(false);
}
}
void MethodEditor::validate(){
if(!m_function.isNull()){
m_function="";
}
if(!m_name->text().isEmpty()){
m_function+=m_scope->currentText()+" ";
if(m_virtual->isChecked()){
m_function+="virtual ";
}
else if(m_static->isChecked()){
m_function+="static ";
}
genFunction();
if(m_virtual->isChecked() && m_pureVirtual->isChecked()){
m_function+= " =0";
}
if(m_const->isChecked()){
m_function+= " const";
}
}
accept();
}