75 lines
1.9 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
2019-06-20 12:02:28 +02:00
* This file may be used under the terms of the 3-clause BSD License
2017-07-21 18:21:34 +02:00
*****************************************************************************/
2017-12-07 14:59:29 +01:00
#ifndef IMAGE_H
#define IMAGE_H
2017-07-21 18:21:34 +02:00
#include "QskGlobal.h"
#ifdef QT_NO_KEYWORDS
// qquickimage_p.h uses emit
#define emit Q_EMIT
#include <private/qquickimage_p.h>
#undef emit
#else
#include <private/qquickimage_p.h>
#endif
#include <memory>
class Image : public QQuickImage
2017-07-21 18:21:34 +02:00
{
Q_OBJECT
Q_PROPERTY( bool sourceSizeAdjustment READ sourceSizeAdjustment
WRITE setSourceSizeAdjustment NOTIFY sourceSizeAdjustmentChanged FINAL )
Q_PROPERTY( bool deferredUpdates READ deferredUpdates
WRITE setDeferredUpdates NOTIFY deferredUpdatesChanged FINAL )
using Inherited = QQuickImage;
2018-08-03 08:15:28 +02:00
public:
Image( QQuickItem* parent = nullptr );
2018-07-31 17:32:25 +02:00
~Image() override;
2017-07-21 18:21:34 +02:00
void setSourceSizeAdjustment( bool );
bool sourceSizeAdjustment() const;
void setDeferredUpdates( bool );
bool deferredUpdates() const;
Q_INVOKABLE virtual bool hasHeightForWidth() const;
Q_INVOKABLE virtual qreal heightForWidth( qreal width ) const;
Q_INVOKABLE virtual bool hasWidthForHeight() const;
Q_INVOKABLE virtual qreal widthForHeight( qreal height ) const;
2018-08-03 08:15:28 +02:00
public Q_SLOTS:
2017-07-21 18:21:34 +02:00
void show();
void hide();
void setVisible( bool );
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2017-07-21 18:21:34 +02:00
void sourceSizeAdjustmentChanged();
void deferredUpdatesChanged();
2018-08-03 08:15:28 +02:00
protected:
2018-07-31 17:32:25 +02:00
void geometryChanged( const QRectF&, const QRectF& ) override;
void itemChange( ItemChange, const ItemChangeData& ) override;
void componentComplete() override;
2017-07-21 18:21:34 +02:00
2018-07-31 17:32:25 +02:00
QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override;
void updatePolish() override;
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif