diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index 4c854e0b5..472950c00 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -239,8 +239,8 @@ void AppSnapshot::paintEvent(QPaintEvent *e) // draw image const QImage &im = m_snapshot; - const qreal offset_x = width() / 2.0 - m_snapshotSrcRect.width() / ratio / 2 - m_snapshotSrcRect.left(); - const qreal offset_y = height() / 2.0 - m_snapshotSrcRect.height() / ratio / 2 - m_snapshotSrcRect.top(); + const qreal offset_x = width() / 2.0 - m_snapshotSrcRect.width() / ratio / 2 - m_snapshotSrcRect.left() / ratio; + const qreal offset_y = height() / 2.0 - m_snapshotSrcRect.height() / ratio / 2 - m_snapshotSrcRect.top() / ratio; DStyleHelper dstyle(style()); const int radius = dstyle.pixelMetric(DStyle::PM_FrameRadius); @@ -249,8 +249,9 @@ void AppSnapshot::paintEvent(QPaintEvent *e) brush.setTextureImage(im); painter.setBrush(brush); painter.setPen(Qt::NoPen); - painter.translate(QPoint(offset_x, offset_y)); - painter.drawRoundedRect(m_snapshotSrcRect, radius, radius); + painter.scale(1 / ratio, 1 / ratio); + painter.translate(QPoint(offset_x * ratio, offset_y * ratio)); + painter.drawRoundedRect(m_snapshotSrcRect, radius * ratio, radius * ratio); } void AppSnapshot::resizeEvent(QResizeEvent *e) diff --git a/frame/item/components/floatingpreview.cpp b/frame/item/components/floatingpreview.cpp index 1052acad2..dbe7ce35d 100644 --- a/frame/item/components/floatingpreview.cpp +++ b/frame/item/components/floatingpreview.cpp @@ -119,8 +119,8 @@ void FloatingPreview::paintEvent(QPaintEvent *e) const QRectF r = rect().marginsRemoved(QMargins(BORDER_MARGIN, BORDER_MARGIN, BORDER_MARGIN, BORDER_MARGIN)); const auto ratio = devicePixelRatioF(); - const qreal offset_x = width() / 2.0 - snapshot_geometry.width() / ratio / 2 - snapshot_geometry.left(); - const qreal offset_y = height() / 2.0 - snapshot_geometry.height() / ratio / 2 - snapshot_geometry.top(); + const qreal offset_x = width() / 2.0 - snapshot_geometry.width() / ratio / 2 - snapshot_geometry.left() / ratio; + const qreal offset_y = height() / 2.0 - snapshot_geometry.height() / ratio / 2 - snapshot_geometry.top() / ratio; DStyleHelper dstyle(style()); const int radius = dstyle.pixelMetric(DStyle::PM_FrameRadius); @@ -130,9 +130,11 @@ void FloatingPreview::paintEvent(QPaintEvent *e) brush.setTextureImage(snapshot); painter.setBrush(brush); painter.setPen(Qt::NoPen); - painter.translate(QPoint(offset_x, offset_y)); - painter.drawRoundedRect(snapshot_geometry, radius, radius); - painter.translate(QPoint(-offset_x, -offset_y)); + painter.scale(1 / ratio, 1 / ratio); + painter.translate(QPoint(offset_x * ratio, offset_y * ratio)); + painter.drawRoundedRect(snapshot_geometry, radius * ratio, radius * ratio); + painter.translate(QPoint(-offset_x * ratio, -offset_y * ratio)); + painter.scale(ratio, ratio); // 选中外框 QPen pen; diff --git a/plugins/trash/popupcontrolwidget.cpp b/plugins/trash/popupcontrolwidget.cpp index 438d8494e..9ab4b83e2 100644 --- a/plugins/trash/popupcontrolwidget.cpp +++ b/plugins/trash/popupcontrolwidget.cpp @@ -115,7 +115,6 @@ void PopupControlWidget::clearTrashFloder() d.addButton(buttonTexts[0], true, DDialog::ButtonNormal); d.addButton(buttonTexts[1], false, DDialog::ButtonWarning); d.setDefaultButton(1); - d.getButton(1)->setFocus(); d.moveToCenter(); execCode = d.exec(); } diff --git a/plugins/trash/popupcontrolwidget.h b/plugins/trash/popupcontrolwidget.h index a391697b8..6569a89f6 100644 --- a/plugins/trash/popupcontrolwidget.h +++ b/plugins/trash/popupcontrolwidget.h @@ -30,8 +30,6 @@ #include #include -#include - class PopupControlWidget : public QWidget { Q_OBJECT diff --git a/plugins/trash/trashwidget.cpp b/plugins/trash/trashwidget.cpp index 6ea5f0682..be351ba10 100644 --- a/plugins/trash/trashwidget.cpp +++ b/plugins/trash/trashwidget.cpp @@ -34,8 +34,6 @@ #include #include -DWIDGET_USE_NAMESPACE - TrashWidget::TrashWidget(QWidget *parent) : QWidget(parent),