qskinny/src/controls/QskStatusIndicator.h

64 lines
1.6 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_STATUS_INDICATOR_H
#define QSK_STATUS_INDICATOR_H
#include "QskControl.h"
class QskGraphic;
class QskColorFilter;
class QUrl;
class QSK_EXPORT QskStatusIndicator : public QskControl
{
Q_OBJECT
Q_PROPERTY( int status READ status() WRITE setStatus NOTIFY statusChanged )
using Inherited = QskControl;
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
QSK_SUBCONTROLS( Graphic )
QskStatusIndicator( QQuickItem* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskStatusIndicator() override;
2017-07-21 18:21:34 +02:00
Q_INVOKABLE QUrl source( int status ) const;
Q_INVOKABLE void setSource( int status, const QUrl& url );
QskGraphic graphic( int status ) const;
void setGraphic( int status, const QskGraphic& );
virtual QskColorFilter graphicFilter( int status ) const;
virtual QskGraphic loadSource( const QUrl& ) const;
2018-07-31 17:32:25 +02:00
qreal heightForWidth( qreal width ) const override;
qreal widthForHeight( qreal height ) const override;
2017-07-21 18:21:34 +02:00
2018-07-31 17:32:25 +02:00
QSizeF contentsSizeHint() const override;
2017-07-21 18:21:34 +02:00
int status() const;
bool hasStatus( int status ) const;
2018-08-03 08:15:28 +02:00
public Q_SLOTS:
2017-07-21 18:21:34 +02:00
void setStatus( int status );
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2017-07-21 18:21:34 +02:00
void statusChanged( int status );
2018-08-03 08:15:28 +02:00
protected:
2018-07-31 17:32:25 +02:00
void changeEvent( QEvent* ) override;
void updateLayout() 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
qreal sizeConstraint( Qt::Orientation, qreal ) const;
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif