-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathdlgdatatype.cpp
48 lines (41 loc) · 987 Bytes
/
dlgdatatype.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
#include "dlgdatatype.h"
#include "editortab.h"
#include "editortabswidget.h"
#include "ui_dlgdatatype.h"
extern EditorTabsWidget* tabWidget;
dlgDataType::dlgDataType(QWidget* parent)
: QDialog(parent)
, ui(new Ui::dlgDataType)
{
ui->setupUi(this);
this->layout()->setMargin(0);
QStringList list;
list << "array"
<< "dict"
<< "integer"
<< "real"
<< "string"
<< "data"
<< "bool"
<< "date";
ui->listDataType->addItems(list);
}
dlgDataType::~dlgDataType()
{
delete ui;
}
void dlgDataType::getDataType(QString txt)
{
for (int i = 0; i < ui->listDataType->count(); i++) {
if (ui->listDataType->item(i)->text() == txt) {
ui->listDataType->setCurrentRow(i);
break;
}
}
}
void dlgDataType::on_listDataType_itemClicked(QListWidgetItem* item)
{
EditorTab* tab = tabWidget->getCurentTab();
tab->changeDataType(item->text());
close();
}