当前位置:网站首页>QT qpprogressbar details
QT qpprogressbar details
2022-07-02 23:01:00 【Mr.codeee】
1.QProgressBar sketch
QProgressBar Provides a horizontal or vertical progress bar , have access to setMinimum() and setMaximum Specify the minimum and maximum steps . The current number of steps is setValue() Set up . The progress bar can be used reset() Rewind to the beginning .
2. Common methods
| void setMaximum(int maximum) | Set maximum |
| void setMinimum(int minimum) | Set minimum |
| void setRange(int minimum, int maximum) | set range , Maximum 、 minimum value |
| void setValue(int value) | set currency |
| void reset() | Reset |
| void setOrientation(Qt::Orientation) | Set the direction , vertical , level |
| void setAlignment(Qt::Alignment alignment) | Set alignment , In the middle , Left 、 Right |
| void setTextVisible(bool visible) | Set whether the progress bar text is displayed |
| void setInvertedAppearance(bool invert) | Set positive 、 back |
| void setFormat(const QString &format) | Set the text display format |
3. Example , Compare progress bar

p1 Set as follows , Normal settings .
ui->progressBar1->setMinimum(0);
ui->progressBar1->setMaximum(100);
ui->progressBar1->setValue(50);
ui->progressBar1->setOrientation(Qt::Horizontal);p2 Set as follows , Set the text alignment , Progress bar direction, etc .
ui->progressBar2->setMinimum(0);
ui->progressBar2->setMaximum(100);
ui->progressBar2->setValue(50);
ui->progressBar2->setOrientation(Qt::Horizontal);
ui->progressBar2->setInvertedAppearance(true);// Set opposite direction
ui->progressBar2->setFormat("%v");
ui->progressBar2->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); // Alignment mode setFormat(), There are several ways
%p% | percentage , This is the default display |
| %v | Current progress |
| %m | Total steps |
You can also directly set the displayed value , As shown in the figure below , Display decimal .

ui->progressBar1->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); // Alignment mode
ui->progressBar1->setFormat(QString("cur progress value:%1%").arg(QString::number(50.43, 'f', 2)));p3 Set as follows , Busy progress display .
Just set the maximum value 、 The minimum value is 0 That's it .
ui->progressBar3->setMinimum(0);
ui->progressBar3->setMaximum(0);4. Set up a style sheet
Here is a simple style sheet . The effect is as follows , For reference only .

QString s1 = "QProgressBar {\
border: 2px solid grey;\
border-radius: 5px;\
text-align: center;\
color:#ff0000;\
}";
QString s2 = "QProgressBar::chunk {\
background-color: #05B8CC;\
width: 20px;\
margin: 0.5px;\
}";call
ui->progressBar1->setStyleSheet(s1+s2);边栏推荐
- Antd component upload uploads xlsx files and reads the contents of the files
- 【板栗糖GIS】global mapper 如何通过dsm批量制作贴地等高线
- 损失函数~
- Go 4 modes Singleton
- Golang interview finishing three resumes how to write
- 性能优化----严苛模式
- MySQL查询附近的数据.并按距离进行排序.
- Odoo13 build a hospital HRP environment (detailed steps)
- pytorch训练CPU占用持续增长(bug)
- Niuke network: maximum submatrix
猜你喜欢
![[leetcode] most elements [169]](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[leetcode] most elements [169]

Wait to solve the zombie process

损失函数~

性能优化----严苛模式

Hanging mirror security won four global infosec awards on rsac2022
![P7072 [CSP-J2020] 直播获奖](/img/bc/fcbc2b1b9595a3bd31d8577aba9b8b.png)
P7072 [CSP-J2020] 直播获奖

MySQL reset password, forget password, reset root password, reset MySQL password

The motivation of AES Advanced Encryption Protocol

Jatpack------LiveData

Local dealers play the community group purchase mode and share millions of operations
随机推荐
[leetcode] most elements [169]
kubernetes 使用主机名将 pod 分配在指定节点上
Baidu AI Cloud - create a face recognition application
Share 10 JS closure interview questions (diagrams), come in and see how many you can answer correctly
Qt QSplitter拆分器
To myself who is about to work
Go language sqlx library operation SQLite3 database addition, deletion, modification and query
[Solved] Splunk: Cannot get username when all users are selected“
剑指 Offer II 099. 最小路径之和-双百代码
Zhong Xuegao responded that the product will not melt for 1 hour: it contains solid components and cannot melt into water
easyclick,ec权朗网络验证源码
Qt QScrollArea
数组进阶提高
1px pixel compatibility of mobile terminal, 1px border
Data analysis learning records -- complete a simple one-way ANOVA with Excel
Golang's learning route
Storage unit conversion
stop slave卡住--事务的事件没有复制完整
用sentinel熔断比例阈值改不了,设置慢调用比例没效果
Hanging mirror security won four global infosec awards on rsac2022