81 lines
2.1 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
*****************************************************************************/
2021-08-04 10:11:12 +02:00
#pragma once
2017-07-21 18:21:34 +02:00
#include "QskGlobal.h"
QSK_QT_PRIVATE_BEGIN
2017-07-21 18:21:34 +02:00
#ifndef emit
#define emit
#include <private/qquickimage_p.h>
#undef emit
2017-07-21 18:21:34 +02:00
#else
#include <private/qquickimage_p.h>
2017-07-21 18:21:34 +02:00
#endif
QSK_QT_PRIVATE_END
2017-07-21 18:21:34 +02:00
#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;
void setSourceSize( const QSize& ) override;
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:
2020-10-26 17:51:31 +01:00
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
void geometryChange( const QRectF&, const QRectF& ) override;
#else
2018-07-31 17:32:25 +02:00
void geometryChanged( const QRectF&, const QRectF& ) override;
2020-10-26 17:51:31 +01:00
#endif
2018-07-31 17:32:25 +02:00
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:
2020-10-26 17:51:31 +01:00
void adjustSourceSize( const QSizeF& );
2017-07-21 18:21:34 +02:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};