fix: render residue on openSUSE - #383
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR addresses artifact rendering on openSUSE by introducing a paintEvent override in PluginItem: it clears the widget’s background with a transparent fill using QPainter before delegating to the base implementation and exposes this override in the class header. Class diagram for updated PluginItem paintEvent overrideclassDiagram
class PluginItem {
+void enterEvent(QEnterEvent *event)
+void leaveEvent(QEvent *event)
+void moveEvent(QMoveEvent *e)
+void paintEvent(QPaintEvent *event) // newly added override
+QWidget *centralWidget()
+QMenu *pluginContextMenu()
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
340313f to
85e4d62
Compare
deepin pr auto review我来对这个代码变更进行审查:
改进建议: void PluginItem::paintEvent(QPaintEvent *event)
{
#ifdef QT_VERSION_CHECK
// 只在特定Qt版本或平台上执行特殊绘制逻辑
#if QT_VERSION >= QT_VERSION_CHECK(6,8,0) || defined(Q_OS_OPENSUSE)
QPainter painter(this);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(rect(), Qt::transparent);
#endif
#endif
QWidget::paintEvent(event);
}或者: void PluginItem::paintEvent(QPaintEvent *event)
{
// 检查是否需要特殊处理
static bool needsSpecialPaint = []() {
// 检查平台或Qt版本的逻辑
return true; // 替换为实际的检查逻辑
}();
if (needsSpecialPaint) {
QPainter painter(this);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(rect(), Qt::transparent);
}
QWidget::paintEvent(event);
}这些改进可以:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, tsic404 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
winId() forces creation of the underlying native window. Qt::WA_Translucent- Background selects the surface format (an ARGB visual) and therefore has to be set before that window exists; setting it afterwards leaves the already-created surface opaque. The result on Qt 6.11 is that every tray plugin paints its background rectangle at all times instead of only on hover, tinted by whatever shows through from the desktop behind the dock. Latent on Qt 6.8, which is what deepin 25 ships -- as already anticipated by the comment added in linuxdeepin#383. Verified by A/B on Arch Linux with Qt 6.11.1, X11, swapping only this binary.
winId() forces creation of the underlying native window. Qt::WA_Translucent- Background selects the surface format (an ARGB visual) and therefore has to be set before that window exists; setting it afterwards leaves the already-created surface opaque. The result on Qt 6.11 is that every tray plugin paints its background rectangle at all times instead of only on hover, tinted by whatever shows through from the desktop behind the dock. Latent on Qt 6.8, which is what deepin 25 ships -- as already anticipated by the comment added in linuxdeepin#383. Verified by A/B on Arch Linux with Qt 6.11.1, X11, swapping only this binary.
winId() forces creation of the underlying native window. Qt::WA_Translucent- Background selects the surface format (an ARGB visual) and therefore has to be set before that window exists; setting it afterwards leaves the already-created surface opaque. The result on Qt 6.11 is that every tray plugin paints its background rectangle at all times instead of only on hover, tinted by whatever shows through from the desktop behind the dock. Latent on Qt 6.8, which is what deepin 25 ships -- as already anticipated by the comment added in #383. Verified by A/B on Arch Linux with Qt 6.11.1, X11, swapping only this binary.
Summary by Sourcery
Bug Fixes: