资源简介
Qt creator 设计的简易计算器工程源码包,标准型,功能全面。
代码片段和文件信息
#include
#include ript>
#include
#include “calculator.h“
Calculator::Calculator(QWidget *parent)
: QDialog(parent)
{
sumInMemory = 0.0;
sumSoFar = 0.0;
factorSoFar = 0.0;
waitingForOperand = true;
display = new QLineEdit(“0“);
display->setReadOnly(true);
display->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
QFont font = display->font();
font.setPointSize(font.pointSize() + 8);
display->setFont(font);
for (int i = 0; i < NumDigitButtons; ++i) {
digitButtons[i] = createButton(QString::number(i)
SLOT(digitClicked()));
}
pointButton = createButton(tr(“.“) SLOT(pointClicked()));
changeSignButton = createButton(tr(“\261“)
SLOT(changeSignClicked()));
backspaceButton = createButton(tr(“Backspace“)
SLOT(backspaceClicked()));
clearButton = createButton(tr(“Clear“) SLOT(clear()));
clearAllButton = createButton(tr(“Clear All“) SLOT(clearAll()));
clearMemoryButton = createButton(tr(“MC“) SLOT(clearMemory()));
readMemoryButton = createButton(tr(“MR“) SLOT(readMemory()));
setMemoryButton = createButton(tr(“MS“) SLOT(setMemory()));
addToMemoryButton = createButton(tr(“M+“) SLOT(addToMemory()));
divisionButton = createButton(tr(“\367“)
SLOT(multiplicativeOperatorClicked()));
timesButton = createButton(tr(“\327“)
SLOT(multiplicativeOperatorClicked()));
minusButton = createButton(tr(“-“)
SLOT(additiveOperatorClicked()));
plusButton = createButton(tr(“+“)
SLOT(additiveOperatorClicked()));
squareRootButton = createButton(tr(“Sqrt“)
SLOT(unaryOperatorClicked()));
powerButton = createButton(tr(“x\262“)
SLOT(unaryOperatorClicked()));
reciprocalButton = createButton(tr(“1/x“)
SLOT(unaryOperatorClicked()));
equalButton = createButton(tr(“=“) SLOT(equalClicked()));
createCustomButtons();
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setContentsMargins(8 8 8 8);
mainLayout->setHorizontalSpacing(5);
mainLayout->setVerticalSpacing(5);
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
mainLayout->addWidget(display 0 0 1 6);
mainLayout->addWidget(backspaceButton 1 0 1 2);
mainLayout->addWidget(clearButton 1 2 1 2);
mainLayout->addWidget(clearAllButton 1 4 1 2);
mainLayout->addWidget(clearMemoryButton 2 0);
mainLayout->addWidget(readMemoryButton 3 0);
mainLayout->addWidget(setMemoryButton 4 0);
mainLayout->addWidget(addToMemoryButton 5 0);
for (int i = 1; i < NumDigitButtons; ++i) {
int row = ((9 - i) / 3) + 2;
int column = ((i - 1) % 3) + 1;
main
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 11611 2008-01-09 08:43 calculator\calculator.cpp
文件 1848 2008-01-09 08:43 calculator\calculator.h
文件 130 2008-01-09 08:43 calculator\calculator.pro
文件 23780 2011-12-20 00:25 calculator\calculator.pro.user
文件 182 2008-01-09 08:43 calculator\main.cpp
文件 18 2008-01-09 08:43 calculator\sc
文件 152 2008-01-09 08:43 calculator\sc
文件 31 2008-01-09 08:43 calculator\sc
目录 0 2011-12-19 18:17 calculator\sc
目录 0 2011-12-19 18:47 calculator
----------- --------- ---------- ----- ----
37752 10
- 上一篇:origin7 pfm
- 下一篇:音响工程画系统图用的CAD图块
相关资源
- 表达式求值,模拟计算器功能的程序
- 北邮嵌入式实验_MQTT协议实验过程及代
- ARCGIS栅格计算器.docx
- Qt类继承关系图
- Qt4迁移至Qt5完全指南
- 基于QT局域网聊天系统毕业论文
- qtcreator + Keil MDK armcc +openocd 编译 调试
- 实现了异常管理流程QtSharpCore.zip
- 4412开发板linux-QT下使用wfi设置
- Qt中文语言包丨PyQt5汉化包附汉化说明
- QTP百度云盘连接.txt
- qt编程下实现点击按钮调用外部程序
- STM32单片机简易计算器
- cyusb-mingw-lib.rar
- qtopia下的简易pda应用程序
- 基于QT 点菜系统客户端程序
- Qt Office 集成
- delphi写的斗牛计算器
- 4G通过MQTT协议ONENET
- 水稻抽穗期QTL DTH2的图位克隆和功能分
- 水稻耐盐萌发能力的遗传分析和QTL定
- 水稻籽粒硒含量的QTL定位及遗传分析
- 利用籼粳亚种片段代换系对花粉半不
- 基于单片段代换系的水稻穗长QTL加性
- 利用染色体单片段代换系定位水稻结
- qt colorbar控件
- 程序员与算法工程师计算器
- 科学+程序员计算器
- MT2503/6261等平台MQTT实现代码
- mqttws31.js文件和MQTT.js-master
评论
共有 条评论