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
| //version 0.10
#include "pbaddi.h"
#include <QApplication>
#include <QPushButton>
#include <QLabel>
#include <QObject>
#include <QString>
#include <QTextEdit>
#include <QGridLayout>
#include <QWidget>
//#include <QFont>
int main(int argc,char ** argv)
{ QApplication app(argc,argv) ;
PBadditionor objt ;
objt.init() ;
QLabel * wfnetre = new QLabel() ;
wfnetre->setFixedSize(250,210) ;
QLabel * wptitfnetr = new QLabel() ;
wptitfnetr->setFixedSize(250,50) ;
//------------------------------------------------------------------
QPushButton * btnexit = new QPushButton("QUITTER") ;
QPushButton * btnclear = new QPushButton("NOUVELLE\nADDITION") ;
btnclear->setFixedSize(250,70) ;
QPushButton * btnpluss = new QPushButton(" + ") ;
btnpluss->setFixedSize(250,70) ;
QPushButton * btnegal = new QPushButton(" = ") ;
QTextEdit * txtesaisir = new QTextEdit() ;
txtesaisir->setFixedSize(250,40) ;
//-----------------------------------------------------
objt.complete(txtesaisir,wfnetre,wptitfnetr ) ;
//-----------------------------------------------------
QGridLayout * en1layout1 = new QGridLayout ;
en1layout1->addWidget(txtesaisir,1,0) ;
en1layout1->addWidget(btnpluss,2,0) ;
en1layout1->addWidget(btnclear,0,0) ;
QGridLayout * en1layout2 = new QGridLayout ;
en1layout2->addWidget(btnexit,0,0) ;
en1layout2->addWidget(btnegal,0,1) ;
//***********************************
QGridLayout * gridranger = new QGridLayout ;
gridranger->addWidget(wfnetre,0,1) ;
gridranger->addLayout(en1layout1,0,0 ) ;
gridranger->addLayout(en1layout2,1,0) ;
gridranger->addWidget(wptitfnetr,1,1) ;
//--------------------------------------------
QWidget * fenetrefinal = new QWidget() ;
fenetrefinal->setLayout(gridranger) ;
fenetrefinal->show() ;
QObject::connect(btnclear,SIGNAL(clicked()),&objt,SLOT(recommence()) ) ;
QObject::connect(btnpluss,SIGNAL(clicked() ),&objt,SLOT(super()) ) ;
QObject::connect(btnegal,SIGNAL(clicked() ),&objt,SLOT(resultat()) ) ;
QObject::connect(btnexit,SIGNAL(clicked() ),&app,SLOT(quit()) ) ;
app.exec() ;
} |
Partager