1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 07:13:21 +02:00
GPXSee/src/map/IMG/label.h

41 lines
787 B
C
Raw Normal View History

2021-04-10 15:27:40 +02:00
#ifndef IMG_LABEL_H
#define IMG_LABEL_H
2019-06-30 20:39:22 +02:00
#include <QString>
#include <QDebug>
2021-04-10 15:27:40 +02:00
#include "shield.h"
2019-06-30 20:39:22 +02:00
2021-04-10 15:27:40 +02:00
namespace IMG {
2019-07-13 14:42:44 +02:00
2019-06-30 20:39:22 +02:00
class Label {
public:
Label() {}
Label(const QString &text, const Shield &shield = Shield())
: _text(text), _shield(shield) {}
const Shield &shield() const {return _shield;}
const QString &text() const {return _text;}
bool isValid() const {return _shield.isValid() || !_text.isEmpty();}
void setText(const QString &text) {_text = text;}
private:
QString _text;
Shield _shield;
};
}
#ifndef QT_NO_DEBUG
2021-04-10 15:27:40 +02:00
inline QDebug operator<<(QDebug dbg, const IMG::Label &label)
2019-06-30 20:39:22 +02:00
{
dbg.nospace() << "Label(";
if (label.shield().isValid())
dbg << label.shield() << ", ";
dbg << label.text() << ")";
return dbg.space();
}
#endif // QT_NO_DEBUG
2021-04-10 15:27:40 +02:00
#endif // IMG_LABEL_H