This commit is contained in:
Irony 2018-12-31 14:49:29 +08:00
parent 305efd60bd
commit d356665756
357 changed files with 238 additions and 693 deletions

View file

@ -1,16 +1,24 @@
eclipse.preferences.version=1
encoding//QListView/CustomWidgetSortItem.py=utf-8
encoding//QListView/SortItemByRole.py=utf-8
encoding//QMessageBox/CustomColorIcon.py=utf-8
encoding//QProgressBar/Lib/WaterRippleProgressBar.py=utf-8
encoding//QProgressBar/MetroCircleProgress.py=utf-8
encoding//QProgressBar/PercentProgressBar.py=utf-8
encoding//QProgressBar/SimpleStyle.py=utf-8
encoding//QProgressBar/WaterProgressBar.py=utf-8
encoding//QProxyStyle/Lib/TabBarStyle.py=utf-8
encoding//QProxyStyle/TabTextDirection.py=utf-8
encoding//QPushButton/BottomLineProgress.py=utf-8
encoding//QPushButton/FontRotate.py=utf-8
encoding//QPushButton/NormalStyle.py=utf-8
encoding//QScrollBar/StyleScrollBar.py=utf-8
encoding//QSlider/PaintQSlider.py=utf-8
encoding//QSlider/QssQSlider.py=utf-8
encoding//QSplitter/RewriteHandle.py=utf-8
encoding//QThread/moveToThread.py=utf-8
encoding//QTreeWidget/ParsingJson.py=utf-8
encoding//QWebView/DreamTree.py=utf-8
encoding//\u7F8E\u5316/QProgressBar/Metro\u8FDB\u5EA6\u6761.py=utf-8
encoding//\u7F8E\u5316/QProgressBar/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/ProgressBar.py=utf-8
encoding//\u7F8E\u5316/QProgressBar/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761.py=utf-8
encoding//\u7F8E\u5316/QSlider/PaintQSlider.py=utf-8
encoding//\u7F8E\u5316/QWidget/CustomPaintWidget.py=utf-8
encoding//\u7F8E\u5316/QWidget/CustomWidget.py=utf-8
encoding//\u7F8E\u5316/QWidget/QWidget\u6837\u5F0F\u6D4B\u8BD5.py=utf-8
encoding//QWidget/Lib/CustomPaintWidget.py=utf-8
encoding//QWidget/Lib/CustomWidget.py=utf-8
encoding//QWidget/WidgetStyle.py=utf-8

View file

@ -3,4 +3,6 @@
## 1、QSS美化日历样式
[运行 CalendarQssStyle.py](CalendarQssStyle.py)
对日历控件的部分控件进行QSS美化顶部背景颜色和高度上下月按钮、月份选择、年选择、菜单
![CalendarQssStyle](ScreenShot/CalendarQssStyle.gif)

View file

@ -3,8 +3,9 @@
## 1、边框阴影动画
[运行 ShadowEffect.py](ShadowEffect.py)
1. 对子控件设置 `QGraphicsDropShadowEffect`
2. 配合 `QPropertyAnimation` 属性动画修改半径值
3. 不能对父控件使用
1. 通过`setGraphicsEffect`设置控件的边框阴影
2. 继承`QGraphicsDropShadowEffect`实现增加动态属性`radius`
3. 通过`QPropertyAnimation`属性动画不断改变`radius`的值并调用`setBlurRadius`更新半径值
4. 不能对父控件使用
![ShadowEffect](ScreenShot/ShadowEffect.gif)

View file

@ -0,0 +1,76 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2018年1月17日
@author: Irony."[讽刺]
@site: https://pyqt5.com , https://github.com/892768447
@email: 892768447@qq.com
@file: CustomBtnIcon
@description:
'''
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
import sys
from PyQt5.QtWidgets import QApplication, QMessageBox
app = QApplication(sys.argv)
app.setStyleSheet('''QDialogButtonBox {
dialogbuttonbox-buttons-have-icons: 1;
dialog-ok-icon: url(Data/icons/Ok.png);
dialog-open-icon: url(Data/icons/Open.png);
dialog-save-icon: url(Data/icons/Save.png);
dialog-cancel-icon: url(Data/icons/Cancel.png);
}
#qt_msgbox_label {
color: red;
background: green;
}
#qt_msgboxex_icon_label {
background: red;
}
QMessageBox {
background: black;
messagebox-information-icon: url(Data/icons/Close.png);
}
QMessageBox QPushButton {
padding: 2px;
border-radius: 5px;
background: white;
}
QMessageBox QPushButton:hover {
background: darkCyan;
}
QMessageBox QPushButton[text="Reset"] {
background: red;
}
QMessageBox QPushButton[text="Apply"] {
background: cyan;
qproperty-icon: url(Data/icons/Apply.png);
}
''')
QMessageBox.information(None, "information", "消息",
QMessageBox.Apply |
QMessageBox.Cancel |
QMessageBox.Close |
QMessageBox.Discard |
QMessageBox.Help |
QMessageBox.No |
QMessageBox.Ok |
QMessageBox.Open |
QMessageBox.Reset |
QMessageBox.Save |
QMessageBox.Yes)
sys.exit()

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View file

Before

Width:  |  Height:  |  Size: 7 KiB

After

Width:  |  Height:  |  Size: 7 KiB

View file

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

View file

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View file

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View file

@ -7,3 +7,8 @@
1. `QTimer`定时器关闭窗口
![CountDownClose](ScreenShot/CountDownClose.gif)
## 2、自定义图标等
[运行 CustomColorIcon.py](CustomColorIcon.py)
![CustomColorIcon](ScreenShot/CustomColorIcon.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -5,7 +5,7 @@
# author: Irony
# site: https://pyqt5.com , https://github.com/892768447
# email: 892768447@qq.com
# file: ProgressBar
# file: WaterRippleProgressBar
# description:
__Author__ = """By: Irony
@ -21,7 +21,7 @@ from PyQt5.QtGui import QPainter, QPainterPath, QColor, QFont
from PyQt5.QtWidgets import QProgressBar
class ProgressBar(QProgressBar):
class WaterRippleProgressBar(QProgressBar):
# 浪高百分比
waterHeight = 1
@ -39,7 +39,7 @@ class ProgressBar(QProgressBar):
waterColor2 = QColor(33, 178, 148, 100)
def __init__(self, *args, **kwargs):
super(ProgressBar, self).__init__(*args, **kwargs)
super(WaterRippleProgressBar, self).__init__(*args, **kwargs)
self._offset = 0
# 每隔100ms刷新波浪模拟波浪动态
self._updateTimer = QTimer(self, timeout=self.update)
@ -48,17 +48,17 @@ class ProgressBar(QProgressBar):
def setRange(self, minValue, maxValue):
if minValue == maxValue == 0:
return # 不允许设置busy状态
super(ProgressBar, self).setRange(minValue, maxValue)
super(WaterRippleProgressBar, self).setRange(minValue, maxValue)
def setMinimum(self, value):
if value == self.maximum() == 0:
return # 不允许设置busy状态
super(ProgressBar, self).setMinimum(value)
super(WaterRippleProgressBar, self).setMinimum(value)
def setMaximum(self, value):
if value == self.minimum() == 0:
return # 不允许设置busy状态
super(ProgressBar, self).setMaximum(value)
super(WaterRippleProgressBar, self).setMaximum(value)
def setWaterHeight(self, height):
"""设置浪高"""
@ -133,6 +133,10 @@ class ProgressBar(QProgressBar):
# 设置没有画笔
painter.setPen(Qt.NoPen)
if not self.styleType:
# 圆形
painter.setClipPath(bgPath)
# 先整体绘制背景,然后再在背景上方绘制两条波浪
painter.save()
painter.setBrush(self.backgroundColor)

View file

@ -6,7 +6,7 @@ Created on 2018年9月4日
@author: Irony
@site: https://pyqt5.com , https://github.com/892768447
@email: 892768447@qq.com
@file: 界面美化.各类进度条.PercentProgressBar
@file: PercentProgressBar
@description:
"""
from PyQt5.QtCore import pyqtProperty, QSize, Qt, QRectF, QTimer

View file

@ -0,0 +1,32 @@
# QProgressBar
## 1、常规样式美化
[运行 SimpleStyle.py](SimpleStyle.py)
主要改变背景颜色、高度、边框、块颜色、边框、圆角
![SimpleStyle](ScreenShot/SimpleStyle.gif)
## 2、圆圈进度条
[运行 RoundProgressBar.py](RoundProgressBar.py)
![RoundProgressBar](ScreenShot/RoundProgressBar.gif)
## 3、百分比进度条
[运行 PercentProgressBar.py](PercentProgressBar.py)
![PercentProgressBar](ScreenShot/PercentProgressBar.gif)
## 4、Metro进度条
[运行 MetroCircleProgress.py](MetroCircleProgress.py)
![MetroCircleProgress](ScreenShot/MetroCircleProgress.gif)
## 5、水波纹进度条
[运行 WaterProgressBar.py](WaterProgressBar.py)
1. 利用正弦函数根据0-width的范围计算y坐标
2. 利用 `QPainterPath` 矩形或者圆形作为背景
3. 用 `QPainterPath` 把y坐标用 `lineTo` 连接起来形成一个U字形+上方波浪的闭合区间
![WaterProgressBar](ScreenShot/WaterProgressBar.gif)

View file

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 193 KiB

View file

Before

Width:  |  Height:  |  Size: 821 KiB

After

Width:  |  Height:  |  Size: 821 KiB

View file

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 135 KiB

View file

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

View file

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 3.4 MiB

View file

@ -6,7 +6,7 @@ Created on 2018年1月30日
@author: Irony."[讽刺]
@site: https://pyqt5.com , https://github.com/892768447
@email: 892768447@qq.com
@file: ProgressBar
@file: SimpleStyle
@description:
'''
from random import randint

View file

@ -5,7 +5,7 @@
# author: Irony
# site: https://pyqt5.com , https://github.com/892768447
# email: 892768447@qq.com
# file: TestWidget
# file: WaterProgressBar
# description:
__Author__ = """By: Irony
@ -23,7 +23,7 @@ from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtWidgets import QWidget, QFormLayout, QRadioButton, QPushButton,\
QColorDialog
from ProgressBar import ProgressBar # @UnresolvedImport
from Lib.WaterRippleProgressBar import WaterRippleProgressBar # @UnresolvedImport
class Window(QWidget):
@ -32,7 +32,7 @@ class Window(QWidget):
super(Window, self).__init__(*args, **kwargs)
self.resize(800, 600)
self.bar = ProgressBar(self)
self.bar = WaterRippleProgressBar(self)
self.bar.setMinimumSize(400, 400)
self.bar.setMaximumSize(400, 400)

View file

@ -74,7 +74,7 @@ class PushButtonLine(QPushButton):
return self.stop()
self.loadingThread = LoadingThread(self)
self.loadingThread.valueChanged.connect(self.setPercent)
self._timer.start(200) # 200ms
self._timer.start(100) # 100ms
self.loadingThread.start()
self.setText(self._waitText)

View file

@ -84,7 +84,8 @@ if __name__ == "__main__":
app = QApplication(sys.argv)
# 加载字体到字体库中
QFontDatabase.addApplicationFont(
"Fonts/FontAwesome/fontawesome-webfont.ttf")
"Data/Fonts/FontAwesome/fontawesome-webfont.ttf")
w = PushButtonFont("点击加载")
w.resize(400, 400)
w.show()
sys.exit(app.exec_())

View file

@ -6,7 +6,7 @@ Created on 2018年1月29日
@author: Irony."[讽刺]
@site: https://pyqt5.com , https://github.com/892768447
@email: 892768447@qq.com
@file: ButtonHover
@file: NormalStyle
@description:
'''
import sys

View file

@ -0,0 +1,22 @@
# QPushButton
## 1、普通样式
[运行 NormalStyle.py](NormalStyle.py)
主要改变背景颜色、鼠标按下颜色、鼠标悬停颜色、圆角、圆形、文字颜色
![NormalStyle](ScreenShot/NormalStyle.gif)
## 2、按钮底部线条进度
[运行 BottomLineProgress.py](BottomLineProgress.py)
在按钮下方画一条线,根据百分值绘制
![BottomLineProgress](ScreenShot/BottomLineProgress.gif)
## 3、按钮文字旋转进度
[运行 FontRotate.py](FontRotate.py)
利用字体使用FontAwesome字体来显示一个圆形进度条然后利用旋转动画
![FontRotate](ScreenShot/FontRotate.gif)

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -79,27 +79,27 @@ QScrollBar::sub-line:horizontal {
}
/*纵向滚动条向上的三角形小图标*/
QScrollBar::up-arrow:vertical {
image: url(scrollbar/scrollbar_arrowup_normal.png);
image: url(Data/scrollbar/scrollbar_arrowup_normal.png);
}
/*横向滚动条左边的三角形小图标*/
QScrollBar::left-arrow:horizontal {
image: url(scrollbar/scrollbar_arrowleft_normal.png);
image: url(Data/scrollbar/scrollbar_arrowleft_normal.png);
}
/*纵向滚动条向上的三角形小图标 鼠标悬停*/
QScrollBar::up-arrow:vertical:hover {
image: url(scrollbar/scrollbar_arrowup_down.png);
image: url(Data/scrollbar/scrollbar_arrowup_down.png);
}
/*横向滚动条左边的三角形小图标 鼠标悬停*/
QScrollBar::left-arrow:horizontal:hover {
image: url(scrollbar/scrollbar_arrowleft_down.png);
image: url(Data/scrollbar/scrollbar_arrowleft_down.png);
}
/*纵向滚动条向上的三角形小图标 鼠标按下*/
QScrollBar::up-arrow:vertical:pressed {
image: url(scrollbar/scrollbar_arrowup_highlight.png);
image: url(Data/scrollbar/scrollbar_arrowup_highlight.png);
}
/*横向滚动条左边的三角形小图标 鼠标按下*/
QScrollBar::left-arrow:horizontal:pressed {
image: url(scrollbar/scrollbar_arrowleft_highlight.png);
image: url(Data/scrollbar/scrollbar_arrowleft_highlight.png);
}
/*纵向滚动条下面三角形部分*/
@ -118,25 +118,25 @@ QScrollBar::add-line:horizontal {
}
/*纵向滚动条下面三角形图标*/
QScrollBar::down-arrow:vertical {
image: url(scrollbar/scrollbar_arrowdown_normal.png);
image: url(Data/scrollbar/scrollbar_arrowdown_normal.png);
}
/*横向滚动条右侧三角形图标*/
QScrollBar::right-arrow:horizontal {
image: url(scrollbar/scrollbar_arrowright_normal.png);
image: url(Data/scrollbar/scrollbar_arrowright_normal.png);
}
/*纵向滚动条下面三角形图标 鼠标悬停*/
QScrollBar::down-arrow:vertical:hover {
image: url(scrollbar/scrollbar_arrowdown_down.png);
image: url(Data/scrollbar/scrollbar_arrowdown_down.png);
}
/*横向滚动条右侧三角形图标 鼠标悬停*/
QScrollBar::right-arrow:horizontal:hover {
image: url(scrollbar/scrollbar_arrowright_down.png);
image: url(Data/scrollbar/scrollbar_arrowright_down.png);
}
/*纵向滚动条下面三角形图标 鼠标按下*/
QScrollBar::down-arrow:vertical:pressed {
image: url(scrollbar/scrollbar_arrowdown_highlight.png);
image: url(Data/scrollbar/scrollbar_arrowdown_highlight.png);
}
/*横向滚动条右侧三角形图标 鼠标按下*/
QScrollBar::right-arrow:horizontal:pressed {
image: url(scrollbar/scrollbar_arrowright_highlight.png);
image: url(Data/scrollbar/scrollbar_arrowright_highlight.png);
}

View file

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View file

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

View file

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View file

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

View file

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 177 B

View file

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View file

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View file

Before

Width:  |  Height:  |  Size: 171 B

After

Width:  |  Height:  |  Size: 171 B

View file

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

View file

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View file

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

View file

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View file

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

View file

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

View file

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 119 B

View file

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

View file

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View file

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

View file

@ -0,0 +1,17 @@
# QScrollBar
## 1、滚动条样式美化
使用QSS和图片对滚动条进行美化horizontal 横向、vertical 纵向)
1. 横向或纵向滚动条整体也就是horizontal、vertical
2. 滚动条上面的小滑块handle
3. 纵向上部、横向左侧区域sub-page
4. 纵向下部、横向右侧区域add-page
5. 纵向上部、横向左侧三角形区域sub-line
6. 纵向下部、横向右侧三角形区域add-line
7. 纵向上部、横向左侧三角形up-arrow、left-arrow
8. 纵向下部、横向右侧三角形down-arrow、right-arrow
![StyleScrollBar1](ScreenShot/StyleScrollBar1.jpg)
![StyleScrollBar2](ScreenShot/StyleScrollBar2.jpg)

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View file

@ -23,10 +23,11 @@ class Window(QTextEdit):
def __init__(self, parent=None):
super(Window, self).__init__(parent)
self.resize(800, 600)
# 设置横向纵向滚动条总是显示
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
with open("ScrollBar.qss", "rb") as fp:
with open("Data/ScrollBar.qss", "rb") as fp:
content = fp.read()
encoding = chardet.detect(content) or {}
content = content.decode(encoding.get("encoding") or "utf-8")

View file

@ -34,3 +34,9 @@ def mousePressEvent(self, event):
```
![ClickJumpSlider](ScreenShot/ClickJumpSlider.gif)
## 2、双层圆环样式
[运行 QssQSlider.py](QssQSlider.py) | [运行 PaintQSlider.py](PaintQSlider.py)
![QssQSlider](ScreenShot/QssQSlider.gif)
![PaintQSlider](ScreenShot/PaintQSlider.gif)

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -0,0 +1,9 @@
# QWidget
## 1、样式表测试
[运行 WidgetStyle.py](WidgetStyle.py)
1. 一种是重写 `paintEvent`
2. 设置 `Qt.WA_StyledBackground` 后可以通过QSS增加背景等
![WidgetStyle](ScreenShot/WidgetStyle.png)

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -14,8 +14,8 @@ import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QApplication, QHBoxLayout
from CustomPaintWidget import CustomPaintWidget # @UnresolvedImport
from CustomWidget import CustomWidget # @UnresolvedImport
from Lib.CustomPaintWidget import CustomPaintWidget # @UnresolvedImport
from Lib.CustomWidget import CustomWidget # @UnresolvedImport
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
@ -23,16 +23,16 @@ __Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
__Version__ = "Version 1.0"
class TestWidget(QWidget):
class Window(QWidget):
def __init__(self, *args, **kwargs):
super(TestWidget, self).__init__(*args, **kwargs)
super(Window, self).__init__(*args, **kwargs)
layout = QHBoxLayout(self)
layout.addWidget(CustomPaintWidget(self))
layout.addWidget(CustomWidget(self))
#注意
# 注意
w = CustomWidget(self)
w.setAttribute(Qt.WA_StyledBackground)#很重要
w.setAttribute(Qt.WA_StyledBackground) # 很重要
layout.addWidget(w)
@ -56,6 +56,6 @@ CustomWidget {
background: orange;
}
''')
w = TestWidget()
w = Window()
w.show()
sys.exit(app.exec_())

View file

@ -8,8 +8,10 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| 分类 | 目录 |
|:-------|:-------|
| Demo | [Demo](Demo)
| ActiveX | [QAxWidget](QAxWidget)
| 日历 | [QCalendarWidget](QCalendarWidget)
| 图标 | [QChart](QChart)
| 复选框 | [QCheckBox](QCheckBox)
| 列视图 | [QColumnView](QColumnView)
| 组合框 | [QComboBox](QComboBox)
@ -18,10 +20,12 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| 刻度盘 | [QDial](QDial)
| 停靠窗口 | [QDockWidget](QDockWidget)
| 双精度编辑 | [QDoubleSpinBox](QDoubleSpinBox)
| 文件系统模型 | [QFileSystemModel](QFileSystemModel)
| 流布局 | [QFlowLayout](QFlowLayout)
| 字体选择 | [QFontComboBox](QFontComboBox)
| 表单布局 | [QFormLayout](QFormLayout)
| 边框容器 | [QFrame](QFrame)
| 边框阴影 | [QGraphicsDropShadowEffect](QGraphicsDropShadowEffect)
| 图形视图 | [QGraphicsView](QGraphicsView)
| 网格布局 | [QGridLayout](QGridLayout)
| 分组容器 | [QGroupBox](QGroupBox)
@ -33,10 +37,11 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| 列表控件 | [QListWidget](QListWidget)
| 子区域 | [QMdiArea](QMdiArea)
| 菜单 | [QMenu](QMenu)
| 消息提示框 | [QMessageBox](QMessageBox)
| OpenGL | [QOpenGLWidget](QOpenGLWidget)
| 纯文本 | [QPlainTextEdit](QPlainTextEdit)
| 进度条 | [QProgressBar](QProgressBar)
| 动画 | [QPropertyAnimation](QPropertyAnimation)
| 属性动画 | [QPropertyAnimation](QPropertyAnimation)
| 代理样式 | [QProxyStyle](QProxyStyle)
| 按钮 | [QPushButton](QPushButton)
| 单选框 | [QRadioButton](QRadioButton)
@ -46,6 +51,7 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| 拉动条 | [QSlider](QSlider)
| 拉伸条 | [QSpacerItem](QSpacerItem)
| 单精度编辑 | [QSpinBox](QSpinBox)
| 拆分窗口 | [QSplitter](QSplitter)
| 堆叠布局 | [QStackedLayout](QStackedLayout)
| 堆叠控件 | [QStackedWidget](QStackedWidget)
| 表格视图 | [QTableView](QTableView)
@ -53,6 +59,7 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| 多标签 | [QTabWidget](QTabWidget)
| 富文本 | [QTextBrowser](QTextBrowser)
| 多行富文本 | [QTextEdit](QTextEdit)
| 多线程 | [QThread](QThread)
| 时间编辑 | [QTimeEdit](QTimeEdit)
| 工具箱 | [QToolBox](QToolBox)
| 工具按钮 | [QToolButton](QToolButton)
@ -62,8 +69,6 @@ https://pyqt5.com 社区是专门针对PyQt5学习和提升开设的博客网站
| WebEngine | [QWebEngineView](QWebEngineView)
| WebView | [QWebView](QWebView)
| QWidget | [QWidget](QWidget)
| 美化样式 | [StyleSheets](StyleSheets)
# QQ群

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Some files were not shown because too many files have changed in this diff Show more