File indexing completed on 2025-01-05 03:59:17
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de> 0004 // 0005 0006 #ifndef MARBLE_SCREENGRAPHICSITEM_H 0007 #define MARBLE_SCREENGRAPHICSITEM_H 0008 0009 // Marble 0010 #include "MarbleGraphicsItem.h" 0011 #include "digikam_export.h" 0012 0013 // Qt 0014 #include <QVector> 0015 0016 namespace Marble 0017 { 0018 0019 class ScreenGraphicsItemPrivate; 0020 0021 class DIGIKAM_EXPORT ScreenGraphicsItem : public MarbleGraphicsItem 0022 { 0023 public: 0024 enum GraphicsItemFlag { 0025 ItemIsMovable = 0x1, 0026 ItemIsHideable = 0x2 0027 }; 0028 Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) 0029 0030 explicit ScreenGraphicsItem( MarbleGraphicsItem *parent = nullptr ); 0031 0032 ~ScreenGraphicsItem() override; 0033 0034 /** 0035 * @brief Set the position of the ScreenGraphicsItem 0036 * @param position Position 0037 * 0038 * Positive x-coordinates are counted left-aligned from the left border of the parent item. 0039 * Negative x-coordinates are counted right-aligned from the right border of the parent item. 0040 * 0041 * Positive y-coordinates are counted top-aligned from the top border of the parent item. 0042 * Negative y-coordinates are counted right-aligned from the bottom border of the parent item. 0043 */ 0044 void setPosition( const QPointF& position ); 0045 0046 /** 0047 * @brief Return the position of the ScreenGraphicsItem 0048 * 0049 * Positive x-coordinates are counted left-aligned from the left border of the parent item. 0050 * Negative x-coordinates are counted right-aligned from the right border of the parent item. 0051 * 0052 * Positive y-coordinates are counted top-aligned from the top border of the parent item. 0053 * Negative y-coordinates are counted right-aligned from the bottom border of the parent item. 0054 */ 0055 QPointF position() const; 0056 0057 /** 0058 * @brief Return the positive position of the ScreenGraphicsItem 0059 * 0060 * All coordinates are counted positive and depend on the current viewport. 0061 * 0062 * Positive x-coordinates are counted left-aligned from the left border of the parent item. 0063 * Positive y-coordinates are counted top-aligned from the top border of the parent item. 0064 */ 0065 QPointF positivePosition() const; 0066 0067 /** 0068 * @brief Return the absolute position of the ScreenGraphicsItem 0069 * 0070 * All coordinates are counted positive and depend on the current viewport. 0071 * 0072 * Positive x-coordinates are counted left-aligned from the left border of the map. 0073 * Positive y-coordinates are counted top-aligned from the top border of the map. 0074 * @since 0.26.0 0075 */ 0076 QVector<QPointF> absolutePositions() const; 0077 0078 /** 0079 * Returns the flags of the item. 0080 */ 0081 GraphicsItemFlags flags() const; 0082 0083 /** 0084 * Sets the flags to flags. All flags in flags will be enabled and all other flags will 0085 * be disabled. By default all flags are disabled. 0086 */ 0087 void setFlags( GraphicsItemFlags flags ); 0088 0089 protected: 0090 explicit ScreenGraphicsItem(ScreenGraphicsItemPrivate *dd); 0091 0092 bool eventFilter( QObject *, QEvent * ) override; 0093 0094 private: 0095 Q_DECLARE_PRIVATE(ScreenGraphicsItem) 0096 }; 0097 0098 } // Namespace Marble 0099 0100 #endif