各类进度条
This commit is contained in:
parent
cef020d4ec
commit
3a0a113448
7 changed files with 163 additions and 22 deletions
|
@ -87,6 +87,8 @@ encoding//\u754C\u9762\u7F8E\u5316/QSS\u7F8E\u5316\u4F8B\u5B50/QPushButton\u6309
|
||||||
encoding//\u754C\u9762\u7F8E\u5316/QScrollBar\u6EDA\u52A8\u6761\u6837\u5F0F/ScrollBar.py=utf-8
|
encoding//\u754C\u9762\u7F8E\u5316/QScrollBar\u6EDA\u52A8\u6761\u6837\u5F0F/ScrollBar.py=utf-8
|
||||||
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/PaintQSlider.py=utf-8
|
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/PaintQSlider.py=utf-8
|
||||||
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/QssQSlider.py=utf-8
|
encoding//\u754C\u9762\u7F8E\u5316/QSlider\u7F8E\u5316/QssQSlider.py=utf-8
|
||||||
|
encoding//\u754C\u9762\u7F8E\u5316/\u5404\u7C7B\u8FDB\u5EA6\u6761/CircleProgressBar.py=utf-8
|
||||||
|
encoding//\u754C\u9762\u7F8E\u5316/\u5404\u7C7B\u8FDB\u5EA6\u6761/Test.py=utf-8
|
||||||
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/ProgressBar.py=utf-8
|
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/ProgressBar.py=utf-8
|
||||||
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/TestWidget.py=utf-8
|
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/TestWidget.py=utf-8
|
||||||
encoding//\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
|
encoding//\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
- [4.8 折叠动画效果](partner_625781186/2.折叠控件/)
|
- [4.8 折叠动画效果](partner_625781186/2.折叠控件/)
|
||||||
- [4.9 水波纹进度条](界面美化/水波纹进度条)
|
- [4.9 水波纹进度条](界面美化/水波纹进度条)
|
||||||
- [4.10 QSlider美化](界面美化/QSlider美化)
|
- [4.10 QSlider美化](界面美化/QSlider美化)
|
||||||
|
- [4.11 各类进度条](界面美化/各类进度条)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
# 通过QSS或者重绘对界面进行美化
|
# 通过QSS或者重绘对界面进行美化
|
||||||
|
|
||||||
### [1.QSS美化例子](QSS美化例子/)
|
### [1.QSS美化例子](QSS美化例子/)
|
||||||
- [1.1 QPushButton按钮](QSS美化例子/QPushButton按钮/)
|
- [1.1 QPushButton按钮](QSS美化例子/QPushButton按钮/)
|
||||||
- [1.2 QCalendarWidget日历](QSS美化例子/QCalendarWidget日历/)
|
- [1.2 QCalendarWidget日历](QSS美化例子/QCalendarWidget日历/)
|
||||||
- [1.3 QProgressBar进度条样式](QSS美化例子/QProgressBar进度条样式/)
|
- [1.3 QProgressBar进度条样式](QSS美化例子/QProgressBar进度条样式/)
|
||||||
|
|
||||||
### [2.Material样式](https://github.com/892768447/QMaterial)
|
### [2.Material样式](https://github.com/892768447/QMaterial)
|
||||||
|
|
||||||
### [3.QMessageBox样式](QMessageBox样式/)
|
### [3.QMessageBox样式](QMessageBox样式/)
|
||||||
- [3.1 方案一](QMessageBox样式/方案一)
|
- [3.1 方案一](QMessageBox样式/方案一)
|
||||||
- [3.2 方案二](QMessageBox样式/方案二)
|
- [3.2 方案二](QMessageBox样式/方案二)
|
||||||
|
|
||||||
### [4.QScrollBar滚动条样式](QScrollBar滚动条样式/)
|
### [4.QScrollBar滚动条样式](QScrollBar滚动条样式/)
|
||||||
|
|
||||||
### [5.QLabel圆形头像](QLabel圆形头像/)
|
### [5.QLabel圆形头像](QLabel圆形头像/)
|
||||||
|
|
||||||
### [6.QFileSystemModel图标](QFileSystemModel图标/)
|
### [6.QFileSystemModel图标](QFileSystemModel图标/)
|
||||||
|
|
||||||
### [7.QPushButton进度动画](QPushButton进度动画/)
|
### [7.QPushButton进度动画](QPushButton进度动画/)
|
||||||
|
|
||||||
### [7.水波纹进度条](水波纹进度条/)
|
### [7.水波纹进度条](水波纹进度条/)
|
||||||
|
|
||||||
|
### [8.各类进度条](各类进度条/)
|
96
界面美化/各类进度条/CircleProgressBar.py
Normal file
96
界面美化/各类进度条/CircleProgressBar.py
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
Created on 2018年9月4日
|
||||||
|
@author: Irony
|
||||||
|
@site: https://github.com/892768447
|
||||||
|
@email: 892768447@qq.com
|
||||||
|
@file: 界面美化.圆形进度条.CircleProgressBar
|
||||||
|
@description:
|
||||||
|
"""
|
||||||
|
from PyQt5.QtCore import QSize, pyqtProperty, QTimer, Qt
|
||||||
|
from PyQt5.QtGui import QColor, QPainter
|
||||||
|
from PyQt5.QtWidgets import QWidget
|
||||||
|
|
||||||
|
|
||||||
|
__Author__ = """By: Irony
|
||||||
|
QQ: 892768447
|
||||||
|
Email: 892768447@qq.com"""
|
||||||
|
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||||
|
__Version__ = "Version 1.0"
|
||||||
|
|
||||||
|
|
||||||
|
class CircleProgressBar(QWidget):
|
||||||
|
|
||||||
|
Color = QColor(24, 189, 155) # 圆圈颜色
|
||||||
|
Clockwise = True # 顺时针还是逆时针
|
||||||
|
Delta = 36
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(CircleProgressBar, self).__init__(*args, **kwargs)
|
||||||
|
self.angle = 0
|
||||||
|
self._timer = QTimer(self, timeout=self.update)
|
||||||
|
self._timer.start(100)
|
||||||
|
|
||||||
|
def paintEvent(self, event):
|
||||||
|
super(CircleProgressBar, self).paintEvent(event)
|
||||||
|
painter = QPainter(self)
|
||||||
|
painter.setRenderHint(QPainter.Antialiasing)
|
||||||
|
painter.translate(self.width() / 2, self.height() / 2)
|
||||||
|
side = min(self.width(), self.height())
|
||||||
|
painter.scale(side / 100.0, side / 100.0)
|
||||||
|
painter.rotate(self.angle)
|
||||||
|
painter.save()
|
||||||
|
painter.setPen(Qt.NoPen)
|
||||||
|
color = self.Color
|
||||||
|
for i in range(11):
|
||||||
|
color.setAlphaF(1.0 * i / 10)
|
||||||
|
painter.setBrush(color)
|
||||||
|
painter.drawEllipse(30, -10, 20, 20)
|
||||||
|
painter.rotate(36)
|
||||||
|
painter.restore()
|
||||||
|
self.angle += self.Delta if self.Clockwise else -self.Delta
|
||||||
|
self.angle %= 360
|
||||||
|
|
||||||
|
@pyqtProperty(QColor)
|
||||||
|
def color(self) -> QColor:
|
||||||
|
return self.Color
|
||||||
|
|
||||||
|
@color.setter
|
||||||
|
def color(self, color: QColor):
|
||||||
|
if self.Color != color:
|
||||||
|
self.Color = color
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
@pyqtProperty(bool)
|
||||||
|
def clockwise(self) -> bool:
|
||||||
|
return self.Clockwise
|
||||||
|
|
||||||
|
@clockwise.setter
|
||||||
|
def clockwise(self, clockwise: bool):
|
||||||
|
if self.Clockwise != clockwise:
|
||||||
|
self.Clockwise = clockwise
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
@pyqtProperty(int)
|
||||||
|
def delta(self) -> int:
|
||||||
|
return self.Delta
|
||||||
|
|
||||||
|
@delta.setter
|
||||||
|
def delta(self, delta: int):
|
||||||
|
if self.delta != delta:
|
||||||
|
self.delta = delta
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
def sizeHint(self) -> QSize:
|
||||||
|
return QSize(100, 100)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
w = CircleProgressBar()
|
||||||
|
w.show()
|
||||||
|
sys.exit(app.exec_())
|
5
界面美化/各类进度条/README.md
Normal file
5
界面美化/各类进度条/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# 各类进度条
|
||||||
|
|
||||||
|
### [1.CircleProgressBar](各类进度条/CircleProgressBar.py)
|
||||||
|
|
||||||
|
![1](ScreenShot/1.gif)
|
BIN
界面美化/各类进度条/ScreenShot/1.gif
Normal file
BIN
界面美化/各类进度条/ScreenShot/1.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 135 KiB |
35
界面美化/各类进度条/Test.py
Normal file
35
界面美化/各类进度条/Test.py
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
Created on 2018年9月4日
|
||||||
|
@author: Irony
|
||||||
|
@site: https://github.com/892768447
|
||||||
|
@email: 892768447@qq.com
|
||||||
|
@file: Test
|
||||||
|
@description:
|
||||||
|
"""
|
||||||
|
from PyQt5.QtWidgets import QWidget, QFormLayout
|
||||||
|
|
||||||
|
|
||||||
|
__Author__ = """By: Irony
|
||||||
|
QQ: 892768447
|
||||||
|
Email: 892768447@qq.com"""
|
||||||
|
__Copyright__ = "Copyright (c) 2018 Irony"
|
||||||
|
__Version__ = "Version 1.0"
|
||||||
|
|
||||||
|
|
||||||
|
class Window(QWidget):
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(Window, self).__init__(*args, **kwargs)
|
||||||
|
layout = QFormLayout(self)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
w = Window()
|
||||||
|
w.show()
|
||||||
|
sys.exit(app.exec_())
|
Loading…
Reference in a new issue