17#include "CursorImageInfo.h"
19CursorImageInfo::CursorImageInfo(QObject *parent)
24void CursorImageInfo::setCursorName(
const QString &cursorName)
26 if (cursorName != m_cursorName) {
27 m_cursorName = cursorName;
29 Q_EMIT cursorNameChanged();
33void CursorImageInfo::setCursorHeight(qreal cursorHeight)
35 if (cursorHeight != m_cursorHeight) {
36 m_cursorHeight = cursorHeight;
38 Q_EMIT cursorHeightChanged();
42void CursorImageInfo::setThemeName(
const QString &themeName)
44 if (m_themeName != themeName) {
45 m_themeName = themeName;
47 Q_EMIT themeNameChanged();
51void CursorImageInfo::update()
53 m_cursorImage = CursorImageProvider::instance()->fetchCursor(m_themeName, m_cursorName, (
int) m_cursorHeight);
55 Q_EMIT hotspotChanged();
56 Q_EMIT frameWidthChanged();
57 Q_EMIT frameHeightChanged();
58 Q_EMIT frameCountChanged();
59 Q_EMIT frameDurationChanged();
60 Q_EMIT imageSourceChanged();
63QPoint CursorImageInfo::hotspot()
const
66 return m_cursorImage->hotspot;
72qreal CursorImageInfo::frameWidth()
const
75 return m_cursorImage->frameWidth;
81qreal CursorImageInfo::frameHeight()
const
84 return m_cursorImage->frameHeight;
90int CursorImageInfo::frameCount()
const
93 return m_cursorImage->frameCount;
99int CursorImageInfo::frameDuration()
const
102 return m_cursorImage->frameDuration;
108QUrl CursorImageInfo::imageSource()
const
110 auto urlString = QString(
"image://cursor/%1/%2/%3")
111 .arg(m_themeName, m_cursorName)
112 .arg(m_cursorHeight);
114 return QUrl(urlString);