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 ), d( new GeoDataBalloonStylePrivate( *other.d ) )
39{
40}
41
42GeoDataBalloonStyle &GeoDataBalloonStyle::operator=( const GeoDataBalloonStyle &other )
43{
44 GeoDataColorStyle::operator=(other);
45 *d = *other.d;
46 return *this;
47}
48
49bool GeoDataBalloonStyle::operator==( const GeoDataBalloonStyle &other ) const
50{
51 return equals(other) &&
52 d->m_bgColor == other.d->m_bgColor &&
53 d->m_mode == other.d->m_mode &&
54 d->m_text == other.d->m_text &&
55 d->m_textColor == other.d->m_textColor;
56}
57
58bool GeoDataBalloonStyle::operator!=( const GeoDataBalloonStyle &other ) const
59{
60 return !this->operator==(other);
61}
62
63GeoDataBalloonStyle::~GeoDataBalloonStyle()
64{
65 delete d;
66}
67
68const char *GeoDataBalloonStyle::nodeType() const
69{
70 return GeoDataTypes::GeoDataBalloonStyleType;
71}
72
73QColor GeoDataBalloonStyle::backgroundColor() const
74{
75 return d->m_bgColor;
76}
77
78void GeoDataBalloonStyle::setBackgroundColor( const QColor &color )
79{
80 d->m_bgColor = color;
81}
82
83QColor GeoDataBalloonStyle::textColor() const
84{
85 return d->m_textColor;
86}
87
88void GeoDataBalloonStyle::setTextColor( const QColor &color )
89{
90 d->m_textColor = color;
91}
92
93QString GeoDataBalloonStyle::text() const
94{
95 return d->m_text;
96}
97
98void GeoDataBalloonStyle::setText( const QString &text )
99{
100 d->m_text = text;
101}
102
103GeoDataBalloonStyle::DisplayMode GeoDataBalloonStyle::displayMode() const
104{
105 return d->m_mode;
106}
107
108void GeoDataBalloonStyle::setDisplayMode(DisplayMode mode)
109{
110 d->m_mode = mode;
111}
112
113void GeoDataBalloonStyle::pack( QDataStream& stream ) const
114{
115 GeoDataColorStyle::pack( stream );
116
117 stream << d->m_bgColor.name();
118 stream << d->m_textColor.name();
119 stream << d->m_text;
120}
121
122void GeoDataBalloonStyle::unpack( QDataStream& stream )
123{
124 GeoDataColorStyle::unpack( stream );
125
126 stream >> d->m_bgColor;
127 stream >> d->m_textColor;
128 stream >> d->m_text;
129}
130
131}
bool equals(const QVariant &lhs, const QVariant &rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.