欢迎来到天天文库
浏览记录
ID:40574992
大小:19.96 KB
页数:37页
时间:2019-08-04
《QT打地鼠练手小程序》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、基于Qt5.2,需要勾掉影响文件,然后在工程目录中建立image,sound文件夹,并放入相关素材,修改文件名和拓展名#ifndefMOUSEWIDGET_H#defineMOUSEWIDGET_H#definescorec#definetimet#include#include#include#include#include#include#include#include#include2、uttonGroup>#include#include#include#include#include#include#include#include//#include//#includeclassmouseWidget:publicQWidget{Q_OBJECTpublic:mouseWidget(QWidget*pa3、rent=0);~mouseWidget();protectedslots:voidpaintEvent(QPaintEvent*event);//绘图voidplay_clicked();//开始倒计时voidkunnan_clicked();voidstop_clicked();voidup_clicked();voiddown_clicked();voidfuwei_clicked();voidtuichu_clicked();voidchengji();//voidon_Timer();voidShowTimer();voidmus4、ic_clicked();voidtimeUpDate0();//定时器刷新按钮0-9,控制按钮显示与隐藏voidtimeUpDate0_1();voidtimeUpDate1();voidtimeUpDate1_1();voidtimeUpDate2();voidtimeUpDate2_1();voidtimeUpDate3();voidtimeUpDate3_1();voidtimeUpDate4();voidtimeUpDate4_1();voidtimeUpDate5();voidtimeUpDate5_1();voidtimeUp5、Date6();voidtimeUpDate6_1();voidtimeUpDate7();voidtimeUpDate7_1();voidtimeUpDate8();voidtimeUpDate8_1();protected:voidmouseMoveEvent(QMouseEvent*event);voidmousePressEvent(QMouseEvent*event);voidmouseReleaseEvent(QMouseEvent*event);private:QPointmLastMousePosition;boolmMov6、ing;private:intflag;//音乐停止继续标志intflag1;//停止继续标志intt1;//计时调整intc;//成绩intt;//倒计时时间QPushButton*mousebtn0;//定时刷新按钮QPushButton*mousebtn1;QPushButton*mousebtn2;QPushButton*mousebtn3;QPushButton*mousebtn4;QPushButton*mousebtn5;QPushButton*mousebtn6;QPushButton*mousebtn7;QPushButt7、on*mousebtn8;QPushButton*playbtn;//play按钮QPushButton*kunnanbtn;//困难模式按钮QPushButton*stop;QPushButton*fuwei;QPushButton*tuichu;QPushButton*up;//调整计时QPushButton*down;QPushButton*music;QLabel*timelabel;//倒计时显示标签QLabel*DSlabel;//倒计时QLabel*Clabel;//成绩显示QLCDNumber*Clcd;//成绩QLCDNu8、mber*lcd;//lcd显示QTimer*timeplay;//游戏定时器QTimer*Ttime;//时间定时器QSound*sound;/*QTimer*nanplay;
2、uttonGroup>#include#include#include#include#include#include#include#include//#include//#includeclassmouseWidget:publicQWidget{Q_OBJECTpublic:mouseWidget(QWidget*pa
3、rent=0);~mouseWidget();protectedslots:voidpaintEvent(QPaintEvent*event);//绘图voidplay_clicked();//开始倒计时voidkunnan_clicked();voidstop_clicked();voidup_clicked();voiddown_clicked();voidfuwei_clicked();voidtuichu_clicked();voidchengji();//voidon_Timer();voidShowTimer();voidmus
4、ic_clicked();voidtimeUpDate0();//定时器刷新按钮0-9,控制按钮显示与隐藏voidtimeUpDate0_1();voidtimeUpDate1();voidtimeUpDate1_1();voidtimeUpDate2();voidtimeUpDate2_1();voidtimeUpDate3();voidtimeUpDate3_1();voidtimeUpDate4();voidtimeUpDate4_1();voidtimeUpDate5();voidtimeUpDate5_1();voidtimeUp
5、Date6();voidtimeUpDate6_1();voidtimeUpDate7();voidtimeUpDate7_1();voidtimeUpDate8();voidtimeUpDate8_1();protected:voidmouseMoveEvent(QMouseEvent*event);voidmousePressEvent(QMouseEvent*event);voidmouseReleaseEvent(QMouseEvent*event);private:QPointmLastMousePosition;boolmMov
6、ing;private:intflag;//音乐停止继续标志intflag1;//停止继续标志intt1;//计时调整intc;//成绩intt;//倒计时时间QPushButton*mousebtn0;//定时刷新按钮QPushButton*mousebtn1;QPushButton*mousebtn2;QPushButton*mousebtn3;QPushButton*mousebtn4;QPushButton*mousebtn5;QPushButton*mousebtn6;QPushButton*mousebtn7;QPushButt
7、on*mousebtn8;QPushButton*playbtn;//play按钮QPushButton*kunnanbtn;//困难模式按钮QPushButton*stop;QPushButton*fuwei;QPushButton*tuichu;QPushButton*up;//调整计时QPushButton*down;QPushButton*music;QLabel*timelabel;//倒计时显示标签QLabel*DSlabel;//倒计时QLabel*Clabel;//成绩显示QLCDNumber*Clcd;//成绩QLCDNu
8、mber*lcd;//lcd显示QTimer*timeplay;//游戏定时器QTimer*Ttime;//时间定时器QSound*sound;/*QTimer*nanplay;
此文档下载收益归作者所有