#include"gui.h" calc::calc() : QWidget() { setFixedSize(366, 281); m_bouton0 = new QPushButton("0",this); m_bouton0->setFont(QFont("Comic Sans MS", 13)); m_bouton0->setGeometry(QRect(50, 180, 25, 20)); QObject::connect(m_bouton0,SIGNAL(clicked()),m_lineEdit,SLOT(afficher_numero())); m_boutonPM = new QPushButton("+/-",this); m_boutonPM->setFont(QFont("ARIAL", 9)); m_boutonPM->setGeometry(QRect(87, 180, 30, 20)); m_boutonV = new QPushButton(".",this); m_boutonPM->setFont(QFont("Comic Sans MS", 13)); m_boutonV->setGeometry(QRect(130, 180, 25, 20)); m_bouton1 = new QPushButton("1",this); m_bouton1->setFont(QFont("Comic Sans MS", 13)); m_bouton1->setGeometry(QRect(50, 150, 25, 20)); m_bouton2 = new QPushButton("2",this); m_bouton2->setFont(QFont("Comic Sans MS", 13)); m_bouton2->setGeometry(QRect(90, 150, 25, 20)); m_bouton3 = new QPushButton("3",this); m_bouton3->setFont(QFont("Comic Sans MS", 13)); m_bouton3->setGeometry(QRect(130, 150, 25, 20)); m_bouton4 = new QPushButton("4",this); m_bouton4->setFont(QFont("Comic Sans MS", 13)); m_bouton4->setGeometry(QRect(50, 120, 25, 20)); m_bouton5 = new QPushButton("5",this); m_bouton5->setFont(QFont("Comic Sans MS", 13)); m_bouton5->setGeometry(QRect(90, 120, 25, 20)); m_bouton6 = new QPushButton("6",this); m_bouton6->setFont(QFont("Comic Sans MS", 13)); m_bouton6->setGeometry(QRect(130, 120, 25, 20)); m_bouton7 = new QPushButton("7",this); m_bouton7->setFont(QFont("Comic Sans MS", 13)); m_bouton7->setGeometry(QRect(50, 90, 25, 20)); m_bouton8 = new QPushButton("8",this); m_bouton8->setFont(QFont("Comic Sans MS", 13)); m_bouton8->setGeometry(QRect(90, 90, 25, 20)); m_bouton9 = new QPushButton("9",this); m_bouton9->setFont(QFont("Comic Sans MS", 13)); m_bouton9->setGeometry(QRect(130, 90, 25, 20)); m_lineEdit = new QLineEdit("",this); m_lineEdit->setGeometry(QRect(50, 40, 261, 20)); //connexion QObject::connect(m_bouton1, SIGNAL(clicked()), qApp, SLOT(quit())); } void calc::afficher_numero() { QString numero = sender()->objectName().remove( "m_bouton" ); m_lineEdit->setText( numero); }