16#include <QApplication>
24 QCursor loadImpl(
const QString &cursorName,
int hotspotX,
int hotspotY,
int width,
int height) {
27 QPixmap cursorImage = QPixmap(
":/" + cursorName);
29 QPixmap cursorImage = QIcon(
":/" + cursorName).pixmap(width > -1? width: 32, height > -1? height: 32);
32 if (cursorImage.isNull()) {
33 qWarning() <<
"Could not load cursor from qrc, trying filesystem" << cursorName;
35 if (cursorImage.isNull()) {
36 qWarning() <<
"Could not load cursor from filesystem" << cursorName;
37 return Qt::ArrowCursor;
44 if (qEnvironmentVariable(
"QT_QPA_PLATFORM") ==
"xcb") {
45 hX = (hotspotX >= 0? hotspotX * cursorImage.devicePixelRatio(): (cursorImage.width() /2));
46 hY = (hotspotY >= 0? hotspotY * cursorImage.devicePixelRatio(): (cursorImage.height()/2));
50 return QCursor(cursorImage, hX, hY);
69 QCursor newCursor = loadImpl(cursorName, hotspotX, hotspotY, width, height);
70 cursorHash.insert(cursorName, QPair<QPoint, QCursor>(QPoint(hotspotX, hotspotY), newCursor));
Q_GLOBAL_STATIC(KisStoragePluginRegistry, s_instance)
QCursor load(const QString &cursorName, int width, int height, int hotspotX, int hotspotY)
static KisCursorCache * instance()
QHash< QString, QPair< QPoint, QCursor > > cursorHash
static QString findAsset(const QString &type, const QString &fileName)