Skip to content

Commit d377893

Browse files
committed
feat: update window control icons and drawing logic
1. Replaced window_normal.dci with window_restore.dci and window_quit_full.dci icons 2. Updated icon references in dtk-icon-theme.qrc resource file 3. Simplified title bar button drawing functions to use new icons instead of manual drawing 4. Modified DStyle implementation to use the new icon assets 5. Improved visual consistency by using pre-made icons rather than programmatic drawing The changes were made to: - Standardize window control icons across the application - Replace programmatic drawing with higher quality vector icons - Make the UI more maintainable by using consistent icon assets - Prepare for future theme support by using icon resources feat: 更新窗口控制图标和绘制逻辑 1. 用 window_restore.dci 和 window_quit_full.dci 图标替换了 window_normal.dci 2. 更新了 dtk-icon-theme.qrc 资源文件中的图标引用 3. 简化了标题栏按钮绘制函数,使用新图标替代手动绘制 4. 修改了 DStyle 实现以使用新的图标资源 5. 通过使用预制图标而非程序绘制提高了视觉一致性 这些修改的目的是: - 标准化应用程序中的窗口控制图标 - 用更高质量的矢量图标替代程序绘制 - 通过使用一致的图标资源提高UI可维护性 - 通过使用图标资源为未来主题支持做准备
1 parent 9618f0c commit d377893

File tree

10 files changed

+4
-24
lines changed

10 files changed

+4
-24
lines changed
-72 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-2 Bytes
Binary file not shown.
-665 Bytes
Binary file not shown.
795 Bytes
Binary file not shown.
669 Bytes
Binary file not shown.
22 Bytes
Binary file not shown.

src/widgets/assets/icons/dtk-icon-theme.qrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
<file alias="window_close.dci">bloom/window_close.dci</file>
7272
<file alias="window_maximize.dci">bloom/window_maximize.dci</file>
7373
<file alias="window_minimize.dci">bloom/window_minimize.dci</file>
74-
<file alias="window_normal.dci">bloom/window_normal.dci</file>
74+
<file alias="window_restore.dci">bloom/window_restore.dci</file>
75+
<file alias="window_quit_full.dci">bloom/window_quit_full.dci</file>
7576
<file alias="switch_on.dci">bloom/switch_on.dci</file>
7677
<file alias="switch_off.dci">bloom/switch_off.dci</file>
7778
<file alias="radio_checked.dci">bloom/radio_checked.dci</file>

src/widgets/dstyle.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -736,33 +736,12 @@ void drawTitleBarCloseButton(QPainter *pa, const QRectF &rect)
736736

737737
void drawTitleBarNormalButton(QPainter *pa, const QRectF &rect)
738738
{
739-
drawTitleBarIcon(pa, rect, QLatin1String("window_normal"));
739+
drawTitleBarIcon(pa, rect, QLatin1String("window_restore"));
740740
}
741741

742742
void drawTitleQuitFullButton(QPainter *pa, const QRectF &rect)
743743
{
744-
const QPen pen = pa->pen();
745-
pa->setPen(Qt::NoPen);
746-
pa->drawRect(rect);
747-
QRectF content_rect(0, 0, rect.width() / 5, rect.height() / 5);
748-
content_rect.moveCenter(rect.center());
749-
pa->setPen(pen);
750-
pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0);
751-
qreal x = content_rect.x();
752-
qreal y = content_rect.y();
753-
qreal w = content_rect.width();
754-
qreal h = content_rect.height();
755-
qreal mean = w / 11;
756-
757-
QRectF right(x + mean * 6, y, mean * 5, mean * 5);
758-
pa->drawLine(QPointF(x + mean * 7, y), QPointF(x + mean * 7, y + mean * 5));
759-
pa->drawLine(QPointF(x + mean * 7, y + mean * 5), QPointF(x + w, y + mean * 5));
760-
pa->drawPoint(right.center());
761-
762-
QRectF left(x, y + mean * 6, mean * 5, mean * 5);
763-
pa->drawLine(QPointF(x, y + mean * 7), QPointF(x + mean * 5, y + mean * 7));
764-
pa->drawLine(QPointF(x + mean * 5, y + mean * 7), QPointF(x + mean * 5, y + h));
765-
pa->drawPoint(left.center());
744+
drawTitleBarIcon(pa, rect, QLatin1String("window_quit_full"));
766745
}
767746

768747
void drawArrowUp(QPainter *pa, const QRectF &rect)

0 commit comments

Comments
 (0)