Add property to set default color/size of QuickImageProvider
This commit is contained in:
parent
4e15167f51
commit
860209ce7d
|
@ -6,7 +6,7 @@ set(META_APP_AUTHOR "Martchus")
|
||||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||||
set(META_VERSION_MAJOR 0)
|
set(META_VERSION_MAJOR 0)
|
||||||
set(META_VERSION_MINOR 0)
|
set(META_VERSION_MINOR 0)
|
||||||
set(META_VERSION_PATCH 2)
|
set(META_VERSION_PATCH 3)
|
||||||
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
||||||
set(META_VERSION_EXACT_SONAME ON) # while still on 0.x.x release
|
set(META_VERSION_EXACT_SONAME ON) # while still on 0.x.x release
|
||||||
set(META_PUBLIC_QT_MODULES Core Gui)
|
set(META_PUBLIC_QT_MODULES Core Gui)
|
||||||
|
|
|
@ -15,6 +15,9 @@ namespace QtForkAwesome {
|
||||||
class Renderer;
|
class Renderer;
|
||||||
|
|
||||||
class QT_QUICK_FORK_AWESOME_EXPORT QuickImageProvider : public QQuickImageProvider {
|
class QT_QUICK_FORK_AWESOME_EXPORT QuickImageProvider : public QQuickImageProvider {
|
||||||
|
Q_PROPERTY(QColor defaultColor defaultColor name WRITE setDefaultColor)
|
||||||
|
Q_PROPERTY(QSize defaultColor defaultSize name WRITE setDefaultSize)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QuickImageProvider(const Renderer &renderer, const QColor &defaultColor = QColor(), const QSize &defaultSize = QSize(64, 64),
|
QuickImageProvider(const Renderer &renderer, const QColor &defaultColor = QColor(), const QSize &defaultSize = QSize(64, 64),
|
||||||
QQuickImageProvider::ImageType type = QQuickImageProvider::Pixmap);
|
QQuickImageProvider::ImageType type = QQuickImageProvider::Pixmap);
|
||||||
|
@ -26,12 +29,39 @@ public:
|
||||||
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QColor defaultColor() const;
|
||||||
|
QSize defaultSize() const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setDefaultColor(const QColor &color);
|
||||||
|
void setDefaultSize(const QSize &size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Renderer &m_renderer;
|
const Renderer &m_renderer;
|
||||||
QColor m_defaultColor;
|
QColor m_defaultColor;
|
||||||
QSize m_defaultSize;
|
QSize m_defaultSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline QColor QuickImageProvider::defaultColor() const
|
||||||
|
{
|
||||||
|
return m_defaultColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QSize QuickImageProvider::defaultSize() const
|
||||||
|
{
|
||||||
|
return m_defaultSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QuickImageProvider::setDefaultColor(const QColor &color)
|
||||||
|
{
|
||||||
|
m_defaultColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QuickImageProvider::setDefaultSize(const QSize &size)
|
||||||
|
{
|
||||||
|
m_defaultSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QtForkAwesome
|
} // namespace QtForkAwesome
|
||||||
|
|
||||||
#endif // QT_FORK_AWESOME_QUICK_IMAGE_PROVIDER
|
#endif // QT_FORK_AWESOME_QUICK_IMAGE_PROVIDER
|
||||||
|
|
Loading…
Reference in New Issue