标签:
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QProgressBar> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0); ~MainWindow(); QProgressBar* progress[10] ; }; #endif // MAINWINDOW_H
#include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { this->resize(400,300); progress[0] = new QProgressBar(this); progress[0]->setMinimum(0); progress[0]->setMaximum(100); progress[0]->setValue(50); progress[0]->setOrientation(Qt::Horizontal); progress[0]->setGeometry(10,30,300,30); progress[1] = new QProgressBar(this); progress[1]->setRange(0,100); progress[1]->setValue(70); progress[1]->setOrientation(Qt::Horizontal); progress[1]->setGeometry(10,70,300,30); progress[1]->setInvertedAppearance(true); // 设置为true则与默认方向相反 } MainWindow::~MainWindow() { }
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
QT5-控件-QProgressBar-进度条-用来做下载进度,文件读取进度还不错
标签:
原文地址:http://www.cnblogs.com/shiyumiao/p/5208307.html