qskinny/src/controls/QskStatusIndicator.h

67 lines
1.7 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
2024-01-17 13:31:45 +00:00
* QSkinny - Copyright (C) The authors
2023-04-06 07:23:37 +00:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 16:21:34 +00:00
*****************************************************************************/
#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 12:49:57 +00:00
Q_PROPERTY( int graphicRole READ graphicRole
WRITE setGraphicRole RESET resetGraphicRole NOTIFY graphicRoleChanged )
2017-07-21 16:21:34 +00:00
using Inherited = QskControl;
2018-08-03 06:15:28 +00:00
public:
2017-07-21 16:21:34 +00:00
QSK_SUBCONTROLS( Graphic )
QskStatusIndicator( QQuickItem* parent = nullptr );
2018-07-31 15:32:25 +00:00
~QskStatusIndicator() override;
2017-07-21 16:21:34 +00:00
Q_INVOKABLE QUrl source( int status ) const;
Q_INVOKABLE void setSource( int status, const QUrl& url );
2022-02-08 07:59:34 +00:00
void setSource( int status, const QString& );
2017-07-21 16:21:34 +00:00
QskGraphic graphic( int status ) const;
void setGraphic( int status, const QskGraphic& );
2021-01-07 12:49:57 +00:00
void setGraphicRole( int role );
void resetGraphicRole();
int graphicRole() const;
2017-07-21 16:21:34 +00:00
virtual QskColorFilter graphicFilter( int status ) const;
virtual QskGraphic loadSource( const QUrl& ) const;
int status() const;
bool hasStatus( int status ) const;
2021-12-23 18:05:59 +00:00
QList< int > statusList() const;
2020-12-29 09:11:31 +00:00
2018-08-03 06:15:28 +00:00
public Q_SLOTS:
2017-07-21 16:21:34 +00:00
void setStatus( int status );
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
2017-07-21 16:21:34 +00:00
void statusChanged( int status );
2021-01-07 12:49:57 +00:00
void graphicRoleChanged( int );
2017-07-21 16:21:34 +00:00
2018-08-03 06:15:28 +00:00
protected:
2018-07-31 15:32:25 +00:00
void changeEvent( QEvent* ) override;
void updateLayout() override;
2017-07-21 16:21:34 +00:00
2018-08-03 06:15:28 +00:00
private:
2017-07-21 16:21:34 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
#endif