Marble

ScreenGraphicsItem.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
4//
5
6#ifndef MARBLE_SCREENGRAPHICSITEM_H
7#define MARBLE_SCREENGRAPHICSITEM_H
8
9// Marble
10#include "MarbleGraphicsItem.h"
11#include "marble_export.h"
12
13// Qt
14#include <QList>
15
16namespace Marble
17{
18
19class ScreenGraphicsItemPrivate;
20
21class MARBLE_EXPORT ScreenGraphicsItem : public MarbleGraphicsItem
22{
23public:
24 enum GraphicsItemFlag {
25 ItemIsMovable = 0x1,
26 ItemIsHideable = 0x2
27 };
28 Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag)
29
30 explicit ScreenGraphicsItem(MarbleGraphicsItem *parent = nullptr);
31
32 ~ScreenGraphicsItem() override;
33
34 /**
35 * @brief Set the position of the ScreenGraphicsItem
36 * @param position Position
37 *
38 * Positive x-coordinates are counted left-aligned from the left border of the parent item.
39 * Negative x-coordinates are counted right-aligned from the right border of the parent item.
40 *
41 * Positive y-coordinates are counted top-aligned from the top border of the parent item.
42 * Negative y-coordinates are counted right-aligned from the bottom border of the parent item.
43 */
44 void setPosition(const QPointF &position);
45
46 /**
47 * @brief Return the position of the ScreenGraphicsItem
48 *
49 * Positive x-coordinates are counted left-aligned from the left border of the parent item.
50 * Negative x-coordinates are counted right-aligned from the right border of the parent item.
51 *
52 * Positive y-coordinates are counted top-aligned from the top border of the parent item.
53 * Negative y-coordinates are counted right-aligned from the bottom border of the parent item.
54 */
55 QPointF position() const;
56
57 /**
58 * @brief Return the positive position of the ScreenGraphicsItem
59 *
60 * All coordinates are counted positive and depend on the current viewport.
61 *
62 * Positive x-coordinates are counted left-aligned from the left border of the parent item.
63 * Positive y-coordinates are counted top-aligned from the top border of the parent item.
64 */
65 QPointF positivePosition() const;
66
67 /**
68 * @brief Return the absolute position of the ScreenGraphicsItem
69 *
70 * All coordinates are counted positive and depend on the current viewport.
71 *
72 * Positive x-coordinates are counted left-aligned from the left border of the map.
73 * Positive y-coordinates are counted top-aligned from the top border of the map.
74 * @since 0.26.0
75 */
76 QList<QPointF> absolutePositions() const;
77
78 /**
79 * Returns the flags of the item.
80 */
81 GraphicsItemFlags flags() const;
82
83 /**
84 * Sets the flags to flags. All flags in flags will be enabled and all other flags will
85 * be disabled. By default all flags are disabled.
86 */
87 void setFlags(GraphicsItemFlags flags);
88
89protected:
90 explicit ScreenGraphicsItem(ScreenGraphicsItemPrivate *dd);
91
92 bool eventFilter(QObject *, QEvent *) override;
93
94private:
95 Q_DECLARE_PRIVATE(ScreenGraphicsItem)
96};
97
98} // Namespace Marble
99
100#endif
KCRASH_EXPORT void setFlags(KCrash::CrashFlags flags)
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:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.