QT学习记录-进度条:
来源:互联网 发布:win7网络图标不见 编辑:程序博客网 时间:2024/05/29 02:11
QT学习记录-进度条:
在QT中可以用QProgressBar或着QProgressDialog来实现进度条。
QProgressDialog:
QProgressBar:
// progress.h#ifndefPROGRESS_H#definePROGRESS_H#include<QtGui/QMainWindow>#include<QPushButton>#include<QProgressBar>#include<QProgressDialog>#include<QVBoxLayout>classprogress:publicQMainWindow{ Q_OBJECTpublic: progress(QWidget*parent=0);publicslots: voidbarstart(void);private: QPushButton*startbutton; QProgressBar*bar; QProgressDialog*process;};#endif//PROGRESS_H // progress.cpp#include"progress.h"#include<windows.h>progress::progress(QWidget*parent) :QMainWindow(parent){ resize(500,150); startbutton=newQPushButton("clickme!",this); bar=newQProgressBar(this); startbutton->setGeometry(30,20,100,30); bar->setGeometry(30,100,300,20); connect(startbutton,SIGNAL(clicked()),this,SLOT(barstart()));}voidprogress::barstart(void){#if1 //QProgressBar unsignedinti,j; bar->setRange(0,5000-1); for(i=0;i<5000;i++) { //for(j=0;j<5000;j++); //Sleep(10); bar->setValue(i); }#else //QProgressDialog对话框的形式 QProgressDialogprocess(this); process.setLabelText(tr("processing...")); process.setRange(0,5000-1); process.setModal(true); process.setCancelButtonText(tr("cancel")); for(inti=0;i<5000;i++) { for(intj=0;j<20000;j++); process.setValue(i); if(process.wasCanceled()) break; }#endif}
- QT学习记录-进度条:
- QT 进度条学习
- QT 学习记录1
- Qt学习记录
- Qt学习记录
- QT学习记录
- QT学习的记录
- QT学习记录
- qt线程学习记录
- qt学习记录
- Qt 数据库学习记录
- Qt学习记录,QSortFilterProxyModel
- QT 学习记录
- Qt学习记录1
- QT 学习记录
- QT学习记录
- QT学习记录一
- QT学习记录三
- svg标签
- 发现CSDN的一个操作不友好的功能
- repo 未强地址
- System.Threading.Thread.Sleep(2000);
- Xcode调试技巧之二 crash之后的定位问题
- QT学习记录-进度条:
- gpio键盘驱动
- IOS 如何选择delegate、notification、KVO?
- svg中transform的矩阵变换原理
- CISCO GLC-SX-MM 光模块 参数
- Android最佳实践之:代码性能优化——Strict Mode介绍
- MediaWiki开启上传文件功能
- [j2ee][servlet]使用get方法提交form表单时出现乱码解决方法
- list-style与list-style-type的区别