Skip to content

Commit e0f6910

Browse files
committed
fix: remove redundant palette setup in RoundScrollArea
1. Removed unnecessary palette initialization in constructor that was setting window brush to transparent 2. Changed paintEvent to directly use Qt::transparent instead of palette().window() 3. This simplifies the code while maintaining the same visual effect of transparency 4. The palette setup was redundant since we're manually painting the background anyway fix: 移除RoundScrollArea中多余的调色板设置 1. 移除构造函数中不必要的调色板初始化(将窗口画刷设置为透明) 2. 修改paintEvent直接使用Qt::transparent替代palette().window() 3. 在保持相同透明视觉效果的同时简化了代码 4. 调色板设置是多余的,因为我们已经手动绘制背景 Pms: bug-315535
1 parent 731f05a commit e0f6910

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

plugins/dde-dock/util/roundscrollarea.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ RoundScrollArea::RoundScrollArea(QWidget *parent)
1616
: QScrollArea(parent)
1717
, m_radius(18)
1818
{
19-
DPalette pa = DPaletteHelper::instance()->palette(this);
20-
pa.setBrush(DPalette::Window, Qt::transparent);
21-
DPaletteHelper::instance()->setPalette(this, pa);
2219
}
2320

2421
void RoundScrollArea::setRadius(int radius)
@@ -35,5 +32,5 @@ void RoundScrollArea::paintEvent(QPaintEvent *e)
3532
QPainterPath path;
3633
path.addRoundedRect(viewport()->rect(), m_radius, m_radius);
3734
painter.setClipPath(path);
38-
painter.fillPath(path, palette().window());
35+
painter.fillPath(path, Qt::transparent);
3936
}

0 commit comments

Comments
 (0)