-
Notifications
You must be signed in to change notification settings - Fork 1
/
hauptmenue.cpp
126 lines (106 loc) · 3.26 KB
/
hauptmenue.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include "hauptmenue.h"
#include "ui_hauptmenue.h"
#include "haushaltsverwaltung.h"
#include "erfassen.h"
#include "abrechnung.h"
#include "bezahlart.h"
#include "benutzerdaten.h"
# include <QtGui>
Haushaltsverwaltung *newHauptmenuWindow = 0;
QTableWidget *table;
Hauptmenue::Hauptmenue(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Hauptmenue)
{
ui->setupUi(this);
table = ui->tbl_Transaktionen;
table->horizontalHeader()->setStretchLastSection(true);
table->setRowCount(10);
table->setColumnCount(6);
table->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("Datum")));
table->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("Betrag")));
table->setHorizontalHeaderItem(2, new QTableWidgetItem(QString("Kategorie")));
table->setHorizontalHeaderItem(3, new QTableWidgetItem(QString("Quelle")));
table->setHorizontalHeaderItem(4, new QTableWidgetItem(QString("Zahlungsart")));
table->setHorizontalHeaderItem(5, new QTableWidgetItem(QString("")));
for( int i = 0; i < table->rowCount(); i++ ){
table->setCellWidget( i, 5, new QPushButton(QString("Details") ));
}
}
Hauptmenue::~Hauptmenue()
{
delete ui;
}
void Hauptmenue::on_btn_Abmelden_clicked()
{
this->hide();
newHauptmenuWindow = new Haushaltsverwaltung();
newHauptmenuWindow->show();
}
void Hauptmenue::on_btn_Erfassen_clicked()
{
Erfassen erfassen;
erfassen.setModal(true);
erfassen.exec();
}
void Hauptmenue::on_btn_Abrechnung_clicked()
{
Abrechnung abrechnung;
abrechnung.setModal(true);
abrechnung.exec();
}
void Hauptmenue::on_btn_Bezahlart_clicked()
{
Bezahlart bezahlart;
bezahlart.setModal(true);
bezahlart.exec();
}
void Hauptmenue::on_btn_Benutzerdaten_clicked()
{
Benutzerdaten benutzerdaten;
benutzerdaten.setModal(true);
benutzerdaten.exec();
}
void Hauptmenue::on_tbl_Transaktionen_activated(const QModelIndex &index)
{
// Test ************************************************************
int s;
int row ,column;
int zeilen =table->rowCount();
int spalten= table->columnCount();
int pos1,pos2,lastpos;
QString line;
QString eintrag[99][99];
QString verzeichnis=QCoreApplication::applicationDirPath();
verzeichnis.append("/data.txt");
QFile datei(verzeichnis);
if (datei.open(QIODevice::ReadOnly | QIODevice::Text)){
QApplication::setOverrideCursor(Qt::WaitCursor);
QTextStream in(&datei);
while(!in.atEnd()){
line = in.readLine();
s=0;
pos1=0;
lastpos=0;
while(pos1!=-1){
pos1=line.indexOf("\"",lastpos);
lastpos=pos1+1;
pos2=line.indexOf("\"",lastpos);
lastpos=pos2+1;
if(pos1!=-1){
eintrag[zeilen][s]=line.mid((pos1+1),(pos2-pos1-1));
s++;
}
}
}
}
//datei.close();
for(row=0;row<zeilen;row++){
for(column=0;column<spalten;column++){
QTableWidgetItem *newItem = new QTableWidgetItem;
newItem->setText(eintrag[row][column]);
table->setItem(row, column, newItem);
}
}
// Test ************************************************************
}