qskinny/src/common/QskLabelData.h

84 lines
1.8 KiB
C
Raw Normal View History

2023-03-09 14:30:40 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_LABEL_DATA_H
#define QSK_LABEL_DATA_H
#include "QskGlobal.h"
#include "QskIcon.h"
#include <qstring.h>
2023-03-10 11:46:19 +00:00
#include <qvector.h>
2023-03-09 14:30:40 +00:00
#include <qmetatype.h>
#include <qdebug.h>
class QSK_EXPORT QskLabelData
{
Q_GADGET
Q_PROPERTY( QString text READ text WRITE setText )
Q_PROPERTY( QUrl iconSource READ iconSource WRITE setIconSource )
public:
QskLabelData() = default;
2023-03-09 16:59:54 +00:00
QskLabelData( const char* );
2023-03-09 14:30:40 +00:00
QskLabelData( const QString& );
QskLabelData( const QskIcon& );
QskLabelData( const QString&, const QskIcon& );
bool operator==( const QskLabelData& ) const noexcept;
bool operator!=( const QskLabelData& ) const noexcept;
void setText( const QString& );
QString text() const noexcept;
void setIconSource( const QUrl& );
QUrl iconSource() const noexcept;
void setIcon( const QskIcon& );
QskIcon icon() const noexcept;
QskHashValue hash( QskHashValue ) const;
private:
QString m_text;
QskIcon m_icon;
};
Q_DECLARE_METATYPE( QskLabelData )
inline QString QskLabelData::text() const noexcept
{
return m_text;
}
inline QskIcon QskLabelData::icon() const noexcept
{
return m_icon;
}
inline QUrl QskLabelData::iconSource() const noexcept
{
return m_icon.source();
}
inline bool QskLabelData::operator!=( const QskLabelData& other ) const noexcept
{
return ( !( *this == other ) );
}
2023-03-10 11:46:19 +00:00
QSK_EXPORT QVector< QskLabelData > qskCreateLabelData( const QVector< QString >& );
2023-03-09 14:30:40 +00:00
#ifndef QT_NO_DEBUG_STREAM
class QDebug;
QSK_EXPORT QDebug operator<<( QDebug, const QskLabelData& );
#endif
#endif