File indexing completed on 2024-05-12 16:02:26

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Michael Abrahams <miabraha@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_CURSOR_CACHE_H
0008 #define KIS_CURSOR_CACHE_H
0009 
0010 #include <QString>
0011 #include <QCursor>
0012 #include <QObject>
0013 #include <QPair>
0014 #include <QPoint>
0015 #include <QHash>
0016 
0017 // KisCursorCache implements a global static database of cursors. This allows
0018 // Krita to load cursor data only once.
0019 
0020 class KisCursorCache: public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     static KisCursorCache* instance();
0025     KisCursorCache();
0026 
0027     QCursor load(const QString & cursorName, int hotspotX, int hotspotY);
0028 
0029 private:
0030 
0031     // Stores cursor hash
0032     QHash<QString, QPair<QPoint, QCursor>> cursorHash;
0033 };
0034 
0035 #endif