========================================================================
main.cpp
========================================================================
#include<qapplication.h>
#include"mainwindow.h"
int main(int argc,char **argv)
{
}
=======================================================================
mainwindow.h
=======================================================================
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include<QpushButton>
#include<QLineEdit>
#include<QWidget>
#include<QString>
#include<QLabel>
class window:public QWidget
{
public:
public slots:
private:
};
#endif // MAINWINDOW_H
=========================================================================
mainwindows.cpp
=========================================================================
#include "mainwindow.h"
#include<qfont.h>
window::window( )
{
firstNum="0";
secondNum="0";
oper=' ';
lineEdit=new QLineEdit(this);
index = 0;
Button[10]=new QPushButton("*",this);
Button[11]=new QPushButton("/",this);
Button[12]=new QPushButton("+",this);
Button[13]=new QPushButton("-",this);
Button[14]=new QPushButton("=",this);
for(int i = 0; i < 10; i++)
{
}
lineEdit->setGeometry(20,10,250,30);
for(int i = 1; i <= 3; i++)
{
}
connect(Button[1],SIGNAL(clicked()),this,SLOT(Button1Click()));
connect(Button[2],SIGNAL(clicked()),this,SLOT(Button2Click()));
connect(Button[3],SIGNAL(clicked()),this,SLOT(Button3Click()));
connect(Button[4],SIGNAL(clicked()),this,SLOT(Button4Click()));
connect(Button[5],SIGNAL(clicked()),this,SLOT(Button5Click()));
connect(Button[6],SIGNAL(clicked()),this,SLOT(Button6Click()));
connect(Button[7],SIGNAL(clicked()),this,SLOT(Button7Click()));
connect(Button[8],SIGNAL(clicked()),this,SLOT(Button8Click()));
connect(Button[9],SIGNAL(clicked()),this,SLOT(Button9Click()));
connect(Button[0],SIGNAL(clicked()),this,SLOT(Button0Click()));
connect(Button[12],SIGNAL(clicked()),this,SLOT(ButtonAddC()));
connect(Button[13],SIGNAL(clicked()),this,SLOT(ButtonDelC()));
connect(Button[10],SIGNAL(clicked()),this,SLOT(ButtonMulC()));
connect(Button[11],SIGNAL(clicked()),this,SLOT(ButtonDivC()));
connect(Button[14],SIGNAL(clicked()),this,SLOT(ButtonResult()));
}
void window::Button1Click()
{
}
void window::Button2Click()
{
}
void window::Button3Click()
{
}
void window::Button4Click()
{
}
void window::Button5Click()
{
}
void window::Button6Click()
{
}
void window::Button7Click()
{
}
void window::Button8Click()
{
}
void window::Button9Click()
{
}
void window::Button0Click()
{
}
void window::ButtonAddC()
{
}
void window::ButtonDelC()
{
}
void window::ButtonMulC()
{
}
void window::ButtonDivC()
{
}
void window::ButtonResult()
{
}
==============================================================================
程序截图如下
==============================================================================