diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index dd2aa280e1f..cdf6d16d8e2 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -15,8 +16,14 @@ namespace Core { namespace Internal { +static QBitmap scaledBitmap(const QBitmap &other, qreal factor) +{ + QTransform trans = QTransform::fromScale(factor, factor); + return other.transformed(trans); +} + // cursor images / masks taken from qplatformcursor.cpp -static QCursor hsplitCursor() +static QCursor hsplitCursor(qreal ratio) { static const uchar hsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -42,14 +49,13 @@ static QCursor hsplitCursor() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - static QBitmap cursorImg = QBitmap::fromData({32, 32}, hsplit_bits); static QBitmap mask = QBitmap::fromData({32, 32}, hsplitm_bits); - static QCursor cursor(cursorImg, mask, 15, 15); - return cursor; + return QCursor(scaledBitmap(cursorImg, ratio), scaledBitmap(mask, ratio), + 15 * ratio, 15 * ratio); } -static QCursor vsplitCursor() +static QCursor vsplitCursor(qreal ratio) { static const uchar vsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -77,8 +83,8 @@ static QCursor vsplitCursor() 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static QBitmap cursorImg = QBitmap::fromData({32, 32}, vsplit_bits); static QBitmap mask = QBitmap::fromData({32, 32}, vsplitm_bits); - static QCursor cursor(cursorImg, mask, 15, 15); - return cursor; + return QCursor(scaledBitmap(cursorImg, ratio), scaledBitmap(mask, ratio), + 15 * ratio, 15 * ratio); } class MiniSplitterHandle : public QSplitterHandle @@ -109,10 +115,12 @@ using namespace Core::Internal; bool MiniSplitterHandle::event(QEvent *event) { if (generalSettings().provideSplitterCursors()) { - if (event->type() == QEvent::HoverEnter) - setCursor(orientation() == Qt::Horizontal ? hsplitCursor() : vsplitCursor()); - else if (event->type() == QEvent::HoverLeave) + if (event->type() == QEvent::HoverEnter) { + const qreal ratio = screen()->devicePixelRatio(); + setCursor(orientation() == Qt::Horizontal ? hsplitCursor(ratio) : vsplitCursor(ratio)); + } else if (event->type() == QEvent::HoverLeave) { unsetCursor(); + } } return QSplitterHandle::event(event); }