qskinny/src/controls/QskStatusIndicator.h

67 lines
1.7 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 )
2021-01-07 13:49:57 +01:00
Q_PROPERTY( int graphicRole READ graphicRole
WRITE setGraphicRole RESET resetGraphicRole NOTIFY graphicRoleChanged )
2017-07-21 18:21:34 +02:00
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 );
2022-02-08 08:59:34 +01:00
void setSource( int status, const QString& );
2017-07-21 18:21:34 +02:00
QskGraphic graphic( int status ) const;
void setGraphic( int status, const QskGraphic& );
2021-01-07 13:49:57 +01:00
void setGraphicRole( int role );
void resetGraphicRole();
int graphicRole() const;
2017-07-21 18:21:34 +02:00
virtual QskColorFilter graphicFilter( int status ) const;
virtual QskGraphic loadSource( const QUrl& ) const;
int status() const;
bool hasStatus( int status ) const;
2021-12-23 19:05:59 +01:00
QList< int > statusList() const;
2020-12-29 10:11:31 +01:00
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 );
2021-01-07 13:49:57 +01:00
void graphicRoleChanged( int );
2017-07-21 18:21:34 +02:00
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
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif