-
Notifications
You must be signed in to change notification settings - Fork 11
resize sidebar #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
+481
−129
Merged
resize sidebar #55
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
178c7a7
feat(ui): 统一调整控件宽度以适应文本内容
chenjintang-shrimp 0097ff9
feat(ui): 优化导航栏按钮布局支持多语言文本换行
chenjintang-shrimp 0ac242e
Merge branch 'feature/resize-sidebar' into develop
chenjintang-shrimp 4a6d81f
feat(ui): 优化界面布局与按钮绘制逻辑
chenjintang-shrimp 46d9a0a
Merge branch 'master' into develop
chenjintang-shrimp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| """按钮绘制工具函数""" | ||
|
|
||
| from PySide6.QtCore import Qt | ||
| from PySide6.QtGui import QPainter, QColor | ||
| from qfluentwidgets.common.color import autoFallbackThemeColor | ||
| from qfluentwidgets.common.config import isDarkTheme | ||
|
|
||
|
|
||
| def centered_draw_background(button, painter: QPainter, button_size: int): | ||
| """绘制按钮背景,使选中指示条(小蓝条)垂直居中""" | ||
| if button.isSelected: | ||
| painter.setBrush(QColor(255, 255, 255, 42) if isDarkTheme() else Qt.white) | ||
| painter.drawRoundedRect(button.rect(), 5, 5) | ||
|
|
||
| # 绘制指示条(小蓝条),垂直居中 | ||
| painter.setBrush( | ||
| autoFallbackThemeColor(button.lightSelectedColor, button.darkSelectedColor) | ||
| ) | ||
| indicator_height = 24 if not button.isPressed else 18 | ||
| indicator_y = (button_size - indicator_height) // 2 | ||
| if button.isPressed: | ||
| indicator_y += 3 # 按下时稍微下移 | ||
| painter.drawRoundedRect(0, indicator_y, 4, indicator_height, 2, 2) | ||
| elif button.isPressed or button.isEnter: | ||
| c = 255 if isDarkTheme() else 0 | ||
| alpha = 9 if button.isEnter else 6 | ||
| painter.setBrush(QColor(c, c, c, alpha)) | ||
| painter.drawRoundedRect(button.rect(), 5, 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lzy98276 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.