Marble

GeoDataBalloonStyle.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Mohammed Nafees <nafees.technocool@gmail.com>
4//
5
6#include "GeoDataBalloonStyle.h"
7#include "GeoDataTypes.h"
8
9#include <QDataStream>
10
11namespace Marble
12{
13
14class GeoDataBalloonStylePrivate
15{
16public:
17 GeoDataBalloonStylePrivate();
18
19 QColor m_bgColor;
20 QColor m_textColor;
21 QString m_text;
22 GeoDataBalloonStyle::DisplayMode m_mode;
23};
24
25GeoDataBalloonStylePrivate::GeoDataBalloonStylePrivate()
26 : m_bgColor(Qt::white)
27 , m_textColor(Qt::black)
28 , m_mode(GeoDataBalloonStyle::Default)
29{
30}
31
32GeoDataBalloonStyle::GeoDataBalloonStyle()
33 : d(new GeoDataBalloonStylePrivate)
34{
35}
36
37GeoDataBalloonStyle::GeoDataBalloonStyle(const Marble::GeoDataBalloonStyle &other)
38 : GeoDataColorStyle(other)
39 , d(new GeoDataBalloonStylePrivate(*other.d))
40{
41}
42
43GeoDataBalloonStyle &GeoDataBalloonStyle::operator=(const GeoDataBalloonStyle &other)
44{
45 GeoDataColorStyle::operator=(other);
46 *d = *other.d;
47 return *this;
48}
49
50bool GeoDataBalloonStyle::operator==(const GeoDataBalloonStyle &other) const
51{
52 return equals(other) && d->m_bgColor == other.d->m_bgColor && d->m_mode == other.d->m_mode && d->m_text == other.d->m_text
53 && d->m_textColor == other.d->m_textColor;
54}
55
56bool GeoDataBalloonStyle::operator!=(const GeoDataBalloonStyle &other) const
57{
58 return !this->operator==(other);
59}
60
61GeoDataBalloonStyle::~GeoDataBalloonStyle()
62{
63 delete d;
64}
65
66const char *GeoDataBalloonStyle::nodeType() const
67{
68 return GeoDataTypes::GeoDataBalloonStyleType;
69}
70
71QColor GeoDataBalloonStyle::backgroundColor() const
72{
73 return d->m_bgColor;
74}
75
76void GeoDataBalloonStyle::setBackgroundColor(const QColor &color)
77{
78 d->m_bgColor = color;
79}
80
81QColor GeoDataBalloonStyle::textColor() const
82{
83 return d->m_textColor;
84}
85
86void GeoDataBalloonStyle::setTextColor(const QColor &color)
87{
88 d->m_textColor = color;
89}
90
91QString GeoDataBalloonStyle::text() const
92{
93 return d->m_text;
94}
95
96void GeoDataBalloonStyle::setText(const QString &text)
97{
98 d->m_text = text;
99}
100
101GeoDataBalloonStyle::DisplayMode GeoDataBalloonStyle::displayMode() const
102{
103 return d->m_mode;
104}
105
106void GeoDataBalloonStyle::setDisplayMode(DisplayMode mode)
107{
108 d->m_mode = mode;
109}
110
111void GeoDataBalloonStyle::pack(QDataStream &stream) const
112{
113 GeoDataColorStyle::pack(stream);
114
115 stream << d->m_bgColor.name();
116 stream << d->m_textColor.name();
117 stream << d->m_text;
118}
119
120void GeoDataBalloonStyle::unpack(QDataStream &stream)
121{
122 GeoDataColorStyle::unpack(stream);
123
124 stream >> d->m_bgColor;
125 stream >> d->m_textColor;
126 stream >> d->m_text;
127}
128
129}
bool equals(const QVariant &lhs, const QVariant &rhs)
bool operator==(const StyleDelim &l, const StyleDelim &r)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.