资源简介
使用QT4编写的,简单易学,对初学者有很大的帮助。
代码片段和文件信息
/****************************************************************************
** 计算器
** 制作人:侯炯
** 2006.11.19
** ZTE-S
****************************************************************************/
#include “calculator.h“
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*
*构造函数
*/
Calculator::Calculator( QWidget* parent const char* name bool modal WFlags fl )
: QDialog( parent name modal fl )
{
if ( !name )
setName( “Calculator“ );
Num=0;
N=0;
XSD=0;
I=1;
//控件生成
Screem = new QLineEdit( this “Screem“ );
Screem->setGeometry( QRect( 20 10 170 30 ) );
Screem->setAlignment( int( QLineEdit::AlignRight ) );
Screem->setReadOnly( TRUE );
Equal = new QPushButton( this “Equal“ );
Equal->setGeometry( QRect( 30 220 110 30 ) );
B5 = new QPushButton( this “B5“ );
B5->setGeometry( QRect( 70 100 31 31 ) );
B0 = new QPushButton( this “B0“ );
B0->setGeometry( QRect( 30 180 30 30 ) );
B7 = new QPushButton( this “B7“ );
B7->setGeometry( QRect( 30 140 31 31 ) );
B1 = new QPushButton( this “B1“ );
B1->setGeometry( QRect( 30 60 31 31 ) );
B2 = new QPushButton( this “B2“ );
B2->setGeometry( QRect( 70 60 31 31 ) );
Div = new QPushButton( this “Div“ );
Div->setGeometry( QRect( 150 60 30 30 ) );
B6 = new QPushButton( this “B6“ );
B6->setGeometry( QRect( 110 100 31 31 ) );
Dec = new QPushButton( this “Dec“ );
Dec->setGeometry( QRect( 150 140 30 30 ) );
Mul = new QPushButton( this “Mul“ );
Mul->setGeometry( QRect( 150 100 30 30 ) );
B8 = new QPushButton( this “B8“ );
B8->setGeometry( QRect( 70 140 31 31 ) );
B9 = new QPushButton( this “B9“ );
B9->setGeometry( QRect( 110 140 31 31 ) );
B4 = new QPushButton( this “B4“ );
B4->setGeometry( QRect( 30 100 31 31 ) );
B3 = new QPushButton( this “B3“ );
B3->setGeometry( QRect( 110 60 31 31 ) );
Add = new QPushButton( this “Add“ );
Add->setGeometry( QRect( 150 180 30 30 ) );
AC = new QPushButton( this “AC“ );
AC->setGeometry( QRect( 150 220 31 31 ) );
ZF = new QPushButton( this “ZF“ );
ZF->setGeometry( QRect( 110 180 31 31 ) );
DD = new QPushButton( this “DD“ );
DD->setGeometry( QRect( 70 180 31 31 ) );
languageChange();
resize( QSize(212 264).expandedTo(minimumSizeHint()) );
setMinimumSize(212 264 );//固定版面大小
setMaximumSize( 212 264 );
SXS.sprintf(“%7.0f“Num);//屏幕数值初始化显示
Screem->setText(str);
// 信号与信号槽的连接
connect( B1 SIGNAL( clicked() ) this SLOT( B1_clicked() ) );
connect( B2 SIGNAL( clicked() ) this SLOT( B2_clicked() ) );
connect( B3 SIGNAL( clicked() ) this SLOT( B3_clicked() ) );
connect( B4 SIGNAL( clicked() ) this SLOT( B4_clic
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 534906 2006-11-28 10:55 calculator\calculator
文件 7233 2006-11-21 02:21 calculator\calculator.cpp
文件 2052 2006-11-21 02:18 calculator\calculator.h
文件 328280 2006-11-28 10:54 calculator\calculator.o
文件 334 2006-11-21 01:06 calculator\calculator.pro
文件 459 2006-11-20 10:58 calculator\main.cpp
文件 289744 2006-11-21 02:19 calculator\main.o
文件 3059 2006-11-21 01:12 calculator\Makefile
文件 5211 2006-11-21 02:19 calculator\moc_calculator.cpp
文件 322636 2006-11-21 02:19 calculator\moc_calculator.o
目录 0 2009-04-04 16:23 calculator
----------- --------- ---------- ----- ----
1493914 11
- 上一篇:UML期末考试试题与答案
- 下一篇:c51单片机的经典密码锁keil c
评论
共有 条评论