在 Qt 中禁用进度条动画 [英] disable progress bar animation in Qt
本文介绍了在 Qt 中禁用进度条动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在 Qt 中禁用进度条的动画并使其表现得像一个仪表?
Is it possible to disable animation of the progress bar in Qt and make it behave like a meter instead?
以下是默认行为,我希望它不会定期让闪亮的波浪通过它.我希望用它来显示已使用的资源,例如 CPU、内存和磁盘空间.
Below is the default behavior, and I would instead like it to not have the shiny wave go through it periodically. I was hoping to use it to show used resources such as CPU, memory, and disk space.
推荐答案
css 用于 qt 设计器:
css for use in qt designer:
QProgressBar::chunk {
background-color: #3add36;
width: 1px;
}
QProgressBar {
border: 2px solid grey;
border-radius: 0px;
text-align: center;
}
pyqt 示例:
my_progress_bar = QProgressBar()
my_progress_bar.setStyleSheet(" QProgressBar { border: 2px solid grey; border-radius: 0px; text-align: center; } QProgressBar::chunk {background-color: #3add36; width: 1px;}")
这篇关于在 Qt 中禁用进度条动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文