QT5-控件-QProgressBar-進度條-用來做下載進度,文件讀取進度還不錯,qt5--qprogressbar-
#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();
}