-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
55 lines (46 loc) · 1.41 KB
/
mainwindow.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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QtDebug"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->tableWidget->setRowCount(0);
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
QStringList header;
header<<"type name"<<"variable name";
ui->tableWidget->setHorizontalHeaderLabels(header);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QString struct_name=ui->lineEdit->text();
int availabe_row=ui->tableWidget->rowCount();
// ui->tableWidget->insertRow(availabe_row);
qDebug()<<availabe_row;
}
void MainWindow::on_pushButton_2_clicked()
{
QString variable_name=ui->lineEdit_2->text();
QString type_name=ui->lineEdit_4->text();
int availabe_row=ui->tableWidget->rowCount();
ui->tableWidget->insertRow(availabe_row);
ui->tableWidget->setItem(availabe_row,0,new QTableWidgetItem(type_name));
ui->tableWidget->setItem(availabe_row,1,new QTableWidgetItem(variable_name));
}
void MainWindow::on_pushButton_3_clicked()
{
// QString variable_name=ui->lineEdit_2->text();
}
void MainWindow::on_pushButton_4_clicked()
{
int curow = ui->tableWidget->currentRow();
QString asd=ui->tableWidget->item(curow,0)->text();
qDebug()<<curow;
ui->tableWidget->removeRow(curow);
}