Pyqt5Qprogressbar边界半径exight

问题描述 投票:0回答:2

I在PYQT5设计器中取得了进度标准,并具有以下样式表:

border: 2px solid black;
border-radius: 20px;

但似乎有一个图形故障,条栏并未圆形,文字被未对准。 enter image description here

这是一个已知的问题?

A.UI文件如果需要,可以通过在设计器中拖动进度栏并使用上面的样式表来轻松复制。

<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>800</width> <height>289</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QProgressBar" name="progressBar"> <property name="geometry"> <rect> <x>90</x> <y>110</y> <width>201</width> <height>61</height> </rect> </property> <property name="styleSheet"> <string notr="true">border: 2px solid black; border-radius: 20px;</string> </property> <property name="value"> <number>24</number> </property> <property name="textVisible"> <bool>true</bool> </property> </widget> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>800</width> <height>26</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/>
    
python pyqt5
2个回答
1
投票

QProgressBar { border: 2px solid black; border-radius: 20px; text-align: center; } QProgressBar::chunk { border-radius: 5px; }

检查
https://doc.qt.io/qt-6/stylesheet-examples.html#customisiz-qprogressbar

用于自定义进度栏示例的其他方法。 我是我所做的进度栏类,它应该解决这个问题。

https://github.com/viabeze/progressbar_pyqt6

0
投票

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.