disable progress bar animation in Qt

限于喜欢 提交于 2021-01-27 04:23:29

问题


Is it possible to disable animation of the progress bar in Qt and make it behave like a meter instead?

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.

enter image description here


回答1:


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 example:

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;}")

enter image description here




回答2:


It looks like the progress bar you are using is the Windows Vista look. You should be able to modify the behavior by changing the stylesheet. Try replacing the background, image of the progressbar and/or the chunk.



来源:https://stackoverflow.com/questions/16556482/disable-progress-bar-animation-in-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!