-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainwindow.cpp
76 lines (57 loc) · 1.9 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
QWidget *mainW = new QWidget;
setCentralWidget(mainW);
windowFields();
setWindowProperties();
mainW->setLayout(vCard);
}
MainWindow::~MainWindow(){
}
void MainWindow::setWindowProperties(void){
setWindowTitle("AITP Membership Sign-Up");
setFocus();
QIcon icon;
icon.addFile(":images/favicon114.ico");
setWindowIcon(icon);
setFixedHeight(440);
//setFixedWidth(670);
}
void MainWindow::windowFields(void){
createWindowFields();
setWindowFields();
arrangeWindowFields();
}
void MainWindow::createWindowFields(void){
sqlPersonModel = new TrackerSql;
sqlPersonModel->createConnectionOne();
sqlResponseModel = new TrackerSql;
sqlResponseModel->createConnectionTwo();
card = new Card(sqlPersonModel, sqlResponseModel, this);
cardList = new List(sqlPersonModel, this);
header = new QLabel;
header->setAlignment(Qt::AlignRight);
header->setPixmap(QPixmap(QString(":images/aitpLogo.png"),0,Qt::AutoColor));
}
void MainWindow::setWindowFields(void){
//card->setMaximumWidth(460);
card->setMaximumHeight(450);
//cardList->setMaximumWidth(175);
connect(card, SIGNAL(newRecord()), this, SLOT(update()));// Refresh list with new entry.
connect(cardList->theList, SIGNAL(doubleClicked(QModelIndex)), card, SLOT(editFormMapItem(QModelIndex)));// load selected list item to card.
}
void MainWindow::arrangeWindowFields(void){
hCard = new QHBoxLayout;
vCard = new QVBoxLayout;
vCard->setMargin(10);
hCard->addWidget(card);
hCard->addWidget(cardList);
hCard->setAlignment(card, Qt::AlignTop);
hCard->setAlignment(Qt::AlignLeft);
vCard->addLayout(hCard);
vCard->addWidget(header);
}
void MainWindow::update(){
sqlPersonModel->setCardTableQuery();
sqlResponseModel->setResponseTableQuery();
}