资源简介
基于QT creator 的简单计算器 有ui界面的设计
这是本人在学习QT时自行编写,有什么不正确的地方,还请各位大神指导!
代码片段和文件信息
#include “dialog.h“
#include “ui_dialog.h“
#include
Dialog::Dialog(QWidget *parent) :
QDialog(parent)
ui(new Ui::Dialog)
{
ui->setupUi(this);
ui->lcdNumber->setNumDigits(10);//设置lcd显示的位数;
setWindowtitle(“Calculator“); //设置窗口标题
//对各个按键进行链接
connect(ui->pushButton_1SIGNAL(clicked())thisSLOT(button1()));
connect(ui->pushButton_2SIGNAL(clicked())thisSLOT(button2()));
connect(ui->pushButton_3SIGNAL(clicked())thisSLOT(button3()));
connect(ui->pushButton_4SIGNAL(clicked())thisSLOT(button4()));
connect(ui->pushButton_5SIGNAL(clicked())thisSLOT(button5()));
connect(ui->pushButton_6SIGNAL(clicked())thisSLOT(button6()));
connect(ui->pushButton_7SIGNAL(clicked())thisSLOT(button7()));
connect(ui->pushButton_8SIGNAL(clicked())thisSLOT(button8()));
connect(ui->pushButton_9SIGNAL(clicked())thisSLOT(button9()));
connect(ui->pushButton_0SIGNAL(clicked())thisSLOT(button0()));
connect(ui->pushButton_pointSIGNAL(clicked())thisSLOT(buttonPoint()));
connect(ui->pushButton_addSIGNAL(clicked())thisSLOT(buttonAdd()));
connect(ui->pushButton_subSIGNAL(clicked())thisSLOT(buttonSub()));
connect(ui->pushButton_mulSIGNAL(clicked())thisSLOT(buttonMul()));
connect(ui->pushButton_divisionSIGNAL(clicked())thisSLOT(buttonDivision()));
connect(ui->pushButton_equalSIGNAL(clicked())thisSLOT(buttonEqual()));
connect(ui->pushButton_emptySIGNAL(clicked())thisSLOT(buttonEmpty()));
connect(ui->pushButton_delSIGNAL(clicked())thisSLOT(buttonDel()));
connect(ui->pushButton_squareSIGNAL(clicked())thisSLOT(buttonSquare()));
connect(ui->pushButton_reciprocalSIGNAL(clicked())thisSLOT(buttonReciprocal()));
connect(ui->pushButton_evolutionSIGNAL(clicked())thisSLOT(buttonEvolution()));
connect(ui->pushButton_factorialSIGNAL(clicked())thisSLOT(buttonFactorial()));
}
Dialog::~Dialog()
{
delete ui;
}
//对各个按键进行定义
QString sumsum1;//定义了两个操作数
int aa; //定义了一个用于判断是那种运算符的整形数;
void Dialog::button1()
{
sum = sum.append(‘1‘);
ui->lcdNumber->display(sum);
}
void Dialog::button2()
{
sum = sum.append(‘2‘);
ui->lcdNumber->display(sum);
}
void Dialog::button3()
{
sum = sum.append(‘3‘);
ui->lcdNumber->display(sum);
}
void Dialog::button4()
{
sum = sum.append(‘4‘);
ui->lcdNumber->display(sum);
}
void Dialog::button5()
{
sum = sum.append(‘5‘);
ui->lcdNumber->display(sum);
}
void Dialog::button6()
{
sum = sum.append(‘6‘);
ui->lcdNumber->display(sum);
}
void Dialog::button7()
{
sum = sum.append(‘7‘);
ui->lcdNumber->display(sum);
}
void Dialog::button8()
{
sum = sum.append(‘8‘);
ui->lcdNumber->display(sum);
}
void Dialog::button9()
{
sum = sum.append(‘9‘);
ui->lcdNumber->display(sum);
}
void Dialog::button0()
{
sum = sum.append(‘0‘);
ui->lcdNumber->display(sum);
}
void Dialog::buttonPoint()
{
sum = sum.append(‘.‘);
ui->lcdNumb
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 29828 2013-02-21 01:28 computer-build-desktop-Qt_4_8_1___PATH________\dialog.o
文件 1592 2013-02-20 15:41 computer-build-desktop-Qt_4_8_1___PATH________\main.o
文件 8325 2013-02-14 06:32 computer-build-desktop-Qt_4_8_1___PATH________\Makefile
文件 43766 2013-02-21 01:28 computer-build-desktop-Qt_4_8_1___PATH________\computer
文件 11246 2013-02-21 01:28 computer-build-desktop-Qt_4_8_1___PATH________\ui_dialog.h
文件 9276 2013-02-20 15:44 computer-build-desktop-Qt_4_8_1___PATH________\moc_dialog.o
文件 4635 2013-02-20 15:44 computer-build-desktop-Qt_4_8_1___PATH________\moc_dialog.cpp
文件 5913 2013-02-21 01:28 computer\dialog.ui
文件 0 2013-02-18 04:58 computer\computer.pro.user.1.3
文件 5464 2013-02-21 01:17 computer\dialog.cpp
文件 174 2013-02-12 00:56 computer\main.cpp
文件 300 2013-02-12 00:56 computer\computer.pro
文件 776 2013-02-20 15:31 computer\dialog.h
文件 18571 2013-02-21 01:44 computer\computer.pro.user
目录 0 2013-02-21 01:28 computer-build-desktop-Qt_4_8_1___PATH________\
目录 0 2013-02-21 01:44 computer\
相关资源
- QT opengl 绘制立体图形
- QT 实现TTS朗读
- QT编写RTF格式文件
- QT5 打开一个浏览器和对应的网页
- Qt 超级日记本
- 基于qt3的作业:点菜系统
- Qt自定义/自绘复选框/单选框类
- EDA大作业_简易计算器
- Qt加载3D模型
- QT实现http GET POST操作
- Qt 网络通信源码
- LibreCAD 源码编译,编译通过,可拿着
- 基于qt开发的会员管理系统
- 毕设程序89C51计算器程序+proteus仿真
- QT下实现类似QQ聊天窗口tab控件
- Qt程序crash信息的捕捉与跟踪Demo
- QT一个简单通讯录
- qt Qpushbutton圆按钮加图片代码
- qt股票系统
- QT编写的RTSP播放器各QT版本可完整编译
- qt 界面跳转 界面跳转 界面跳转
- QT仪表盘(项目实战)
- 汇编语言win32简单计算器源码
- Delphi编写的简易计算器含源码
- QT中利用QCustomPlot类画曲线图
- QT 自助点餐系统
- Qt实现托盘全部常用功能
- Qt实现仿qq右下角浮动弹窗
- QTP11.5原版以及中文版本地址.xlsx
- Qt 获取Cookie
评论
共有 条评论