diff --git a/src/QuickEditor/QuickEditor.cpp b/src/QuickEditor/QuickEditor.cpp --- a/src/QuickEditor/QuickEditor.cpp +++ b/src/QuickEditor/QuickEditor.cpp @@ -272,9 +272,6 @@ } return newTopLeftX; - - - } int QuickEditor::boundsUp(int newTopLeftY, const bool mouse) @@ -485,12 +482,26 @@ void QuickEditor::paintEvent(QPaintEvent*) { + // Fix dual screen offset issue in X11 + int newX = x(); + int newY = y(); + if (newX < 0 || newY < 0) { + if (newX < 0) { + newX = 0; + } + if (newY < 0) { + newY = 0; + } + move(newX, newY); + } + QPainter painter(this); painter.setRenderHints(QPainter::Antialiasing); QBrush brush(mPixmap); brush.setTransform(QTransform().scale(dprI, dprI)); painter.setBackground(brush); - painter.eraseRect(geometry()); + // DON'T use geometry() because the widget position is not always (0, 0) + painter.eraseRect(QRect(0, 0, width(), height())); if (!mSelection.size().isEmpty() || mMouseDragState != MouseState::None) { painter.fillRect(mSelection, mStrokeColor); const QRectF innerRect = mSelection.adjusted(1, 1, -1, -1); @@ -754,7 +765,8 @@ void QuickEditor::drawMidHelpText(QPainter &painter) { - painter.fillRect(geometry(), mMaskColor); + // DON'T use geometry() because the widget position is not always (0, 0) + painter.fillRect(QRect(0, 0, width(), height()), mMaskColor); painter.setFont(mMidHelpTextFont); QRect textSize = painter.boundingRect(QRect(), Qt::AlignCenter, mMidHelpText); QPoint pos((mPrimaryScreenGeo.width() - textSize.width()) / 2 + mPrimaryScreenGeo.x(), (height() - textSize.height()) / 2);