-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestwidget.cpp
More file actions
71 lines (49 loc) · 1.17 KB
/
testwidget.cpp
File metadata and controls
71 lines (49 loc) · 1.17 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
70
71
#include "testwidget.h"
#include <QDebug>
#include <QPushButton>
#include <QTableView>
#include <QVBoxLayout>
#include <QSqlTableModel>
TestWidget::TestWidget(QWidget *parent) :
QWidget(parent)
{
qDebug() << "hello testwidget" ;
setWindowTitle(tr("Widget de prueba"));
setMinimumSize(250,250);
createWidgets();
layoutWidgets();
connectSlots();
retranslateUi();
}
TestWidget::~TestWidget()
{
qDebug() << "bye testwidget" ;
}
void TestWidget::retranslateUi()
{
btnOk->setText("Guardar");
btnNew->setText("Nuevo");
}
void TestWidget::createWidgets()
{
btnNew=new QPushButton(this);
btnOk=new QPushButton(this);
tbl1=new QTableView(this);
model = new QSqlTableModel(this);
model->setTable("usuario");
tbl1->setModel(model);
model->select();
}
void TestWidget::layoutWidgets()
{
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(tbl1);
mainLayout->addWidget(btnOk);
mainLayout->addWidget(btnNew);
setLayout(mainLayout);
}
void TestWidget::connectSlots()
{
connect(btnOk, SIGNAL(clicked()), model, SLOT(submitAll()));
//connect(btnNew, SIGNAL(clicked()), tbl1, SLOT()
}