QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskLabelData.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_LABEL_DATA_H
7#define QSK_LABEL_DATA_H
8
9#include "QskGlobal.h"
10#include "QskIcon.h"
11
12#include <qstring.h>
13#include <qstringlist.h>
14#include <qvector.h>
15#include <qmetatype.h>
16#include <qdebug.h>
17
18class QSK_EXPORT QskLabelData
19{
20 Q_GADGET
21
22 Q_PROPERTY( QString text READ text WRITE setText )
23 Q_PROPERTY( QUrl iconSource READ iconSource WRITE setIconSource )
24
25 public:
26 QskLabelData() = default;
27
28 QskLabelData( const char* );
29 QskLabelData( const QString& );
30 QskLabelData( const QskIcon& );
31 QskLabelData( const QString&, const QskIcon& );
32
33 bool operator==( const QskLabelData& ) const noexcept;
34 bool operator!=( const QskLabelData& ) const noexcept;
35
36 void setText( const QString& );
37 QString text() const noexcept;
38
39 void setIconSource( const QUrl& );
40 QUrl iconSource() const noexcept;
41
42 void setIcon( const QskIcon& );
43 QskIcon icon() const noexcept;
44
45 bool isEmpty() const;
46
47 QskHashValue hash( QskHashValue ) const;
48
49 private:
50 QString m_text;
51 QskIcon m_icon;
52};
53
54Q_DECLARE_METATYPE( QskLabelData )
55
56inline QString QskLabelData::text() const noexcept
57{
58 return m_text;
59}
60
61inline QskIcon QskLabelData::icon() const noexcept
62{
63 return m_icon;
64}
65
66inline QUrl QskLabelData::iconSource() const noexcept
67{
68 return m_icon.source();
69}
70
71inline bool QskLabelData::operator!=( const QskLabelData& other ) const noexcept
72{
73 return ( !( *this == other ) );
74}
75
76inline bool QskLabelData::isEmpty() const
77{
78 return m_text.isEmpty() && m_icon.isNull();
79}
80
81QSK_EXPORT QVector< QskLabelData > qskCreateLabelData( const QStringList& );
82
83#ifndef QT_NO_DEBUG_STREAM
84
85class QDebug;
86
87QSK_EXPORT QDebug operator<<( QDebug, const QskLabelData& );
88
89#endif
90
91#endif