OSDN Git Service

replace QCursorData::setBitmap() with its body
authorIvailo Monev <xakepa10@gmail.com>
Mon, 14 Nov 2022 12:28:50 +0000 (14:28 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 14 Nov 2022 12:28:50 +0000 (14:28 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/kernel/qcursor.cpp
src/gui/kernel/qcursor_p.h
src/gui/kernel/qcursor_x11.cpp

index 4c58bb2..9e03c43 100644 (file)
@@ -248,7 +248,23 @@ QDataStream &operator>>(QDataStream &s, QCursor &c)
 QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
     : d(nullptr)
 {
-    d = QCursorData::setBitmap(pixmap, pixmap.mask(), hotX, hotY);
+    const QBitmap mask = pixmap.mask();
+    if (Q_UNLIKELY(mask.depth() != 1 || pixmap.size() != mask.size())) {
+        qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
+        return;
+    }
+
+    d = new QCursorData(Qt::BitmapCursor);
+    d->px = pixmap;
+    d->bm = mask;
+    d->hx = (hotX >= 0 ? hotX : (pixmap.width() / 2));
+    d->hy = (hotY >= 0 ? hotY : (pixmap.height() / 2));
+    d->fg.red   = 0x0000;
+    d->fg.green = 0x0000;
+    d->fg.blue  = 0x0000;
+    d->bg.red   = 0xffff;
+    d->bg.green = 0xffff;
+    d->bg.blue  = 0xffff;
 }
 
 /*!
index 765c1c7..6a72f50 100644 (file)
@@ -65,8 +65,6 @@ public:
     Picture x11pic;
 #endif
 #endif
-
-    static QCursorData *setBitmap(const QPixmap &pixmap, const QBitmap &mask, int hotX, int hotY);
 };
 
 QT_END_NAMESPACE
index 84f977a..0b329c1 100644 (file)
@@ -102,27 +102,6 @@ QCursorData::~QCursorData()
     }
 }
 
-QCursorData *QCursorData::setBitmap(const QPixmap &pixmap, const QBitmap &mask, int hotX, int hotY)
-{
-    if (Q_UNLIKELY(mask.depth() != 1 || pixmap.size() != mask.size())) {
-        qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
-        return nullptr;
-    }
-    QCursorData *d = new QCursorData(Qt::BitmapCursor);
-
-    d->px = pixmap;
-    d->bm = mask;
-    d->hx = (hotX >= 0 ? hotX : (pixmap.width() / 2));
-    d->hy = (hotY >= 0 ? hotY : (pixmap.height() / 2));
-    d->fg.red   = 0x0000;
-    d->fg.green = 0x0000;
-    d->fg.blue  = 0x0000;
-    d->bg.red   = 0xffff;
-    d->bg.green = 0xffff;
-    d->bg.blue  = 0xffff;
-    return d;
-}
-
 QCursor::QCursor(Qt::HANDLE cursor)
     : d(new QCursorData(Qt::CustomCursor))
 {