forked from JT117/KFet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
56 lines (43 loc) · 1.67 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
QTableWidget* etuTable = new QTableWidget( ui->tab );
QStringList header;
header << "Nom" << "Prénom" << "Dette";
etuTable->setFixedHeight( ui->tab->height() );
etuTable->setFixedWidth( ui->tab->width() );
etuTable->setColumnCount(3);
etuTable->setHorizontalHeaderLabels( header );
etuTable->setRowCount( 1 );
QTableWidgetItem* item = new QTableWidgetItem("WOOLOLO");
etuTable->setItem(0,0, item );
QToolButton* boutonCafe = new QToolButton();
boutonCafe->setIcon( QIcon( "cafe.png" ) );
boutonCafe->setText( "Café 0.50"+QString(8364) );
boutonCafe->setIconSize(QSize(64,64));
boutonCafe->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
boutonCafe->setFont( QFont( "MV Boli", 10, QFont::Bold ) );
QToolButton* boutonPizza = new QToolButton();
boutonPizza->setIcon( QIcon( "pizza.png" ) );
boutonPizza->setText( "Pizza 2.50"+QString(8364) );
boutonPizza->setIconSize(QSize(64,64));
boutonPizza->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
boutonPizza->setFont( QFont( "MV Boli", 10, QFont::Bold ) );
ui->gridLayout->addWidget( boutonCafe, 1, 0, 1, 1 );
ui->gridLayout->addWidget( boutonPizza, 1, 1, 1, 1 );
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setHostName("localhost");
db.setDatabaseName("kfet");
bool ok = db.open();
if( !ok )
{
QMessageBox::warning( this, "Erreur", "Pas d'acces a la BDD");
}
qDebug() << db.tables() << endl;
}
MainWindow::~MainWindow()
{
delete ui;
}