QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgslayoutmousehandles.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutmousehandles.h
3 -----------------------
4 begin : September 2017
5 copyright : (C) 2017 by Nyall Dawson
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSLAYOUTMOUSEHANDLES_H
18#define QGSLAYOUTMOUSEHANDLES_H
19
20// We don't want to expose this in the public API
21#define SIP_NO_FILE
22
23#include <memory>
24
25#include "qgis_gui.h"
27
28#include <QPointer>
29
30class QgsLayout;
31class QGraphicsView;
32class QgsLayoutView;
33class QgsLayoutItem;
34class QInputEvent;
36
38
48class GUI_EXPORT QgsLayoutMouseHandles : public QgsGraphicsViewMouseHandles
49{
50 Q_OBJECT
51 public:
52 QgsLayoutMouseHandles( QgsLayout *layout, QgsLayoutView *view );
53
58 void setLayout( QgsLayout *layout ) { mLayout = layout; }
59
64 QgsLayout *layout() { return mLayout; }
65
66 void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr ) override;
67
68 protected:
69 void setViewportCursor( Qt::CursorShape cursor ) override;
70 QList<QGraphicsItem *> sceneItemsAtPoint( QPointF scenePoint ) override;
71 QList<QGraphicsItem *> selectedSceneItems( bool includeLockedItems = true ) const override;
72 bool itemIsLocked( QGraphicsItem *item ) override;
73 bool itemIsGroupMember( QGraphicsItem *item ) override;
74 QRectF itemRect( QGraphicsItem *item ) const override;
75 void expandItemList( const QList<QGraphicsItem *> &items, QList<QGraphicsItem *> &collected ) const override;
76 void expandItemList( const QList<QgsLayoutItem *> &items, QList<QGraphicsItem *> &collected ) const;
77 void moveItem( QGraphicsItem *item, double deltaX, double deltaY ) override;
78 void rotateItem( QGraphicsItem *item, double deltaDegree, double deltaCenterX, double deltaCenterY ) override;
79 void setItemRect( QGraphicsItem *item, QRectF rect ) override;
80 void showStatusMessage( const QString &message ) override;
81 void hideAlignItems() override;
82 QPointF snapPoint( QPointF originalPoint, SnapGuideMode mode, bool snapHorizontal = true, bool snapVertical = true ) override;
83 void createItemCommand( QGraphicsItem *item ) override;
84 void endItemCommand( QGraphicsItem *item ) override;
85 void startMacroCommand( const QString &text ) override;
86 void endMacroCommand() override;
87
88
89 void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ) override;
90
91 public slots:
92
94 void selectionChanged();
95
96 private:
97 QgsLayout *mLayout = nullptr;
98 QPointer<QgsLayoutView> mView;
99
101 QGraphicsLineItem *mHorizontalSnapLine = nullptr;
102 QGraphicsLineItem *mVerticalSnapLine = nullptr;
103
104 std::unique_ptr<QgsAbstractLayoutUndoCommand> mItemCommand;
105};
106
108
109#endif // QGSLAYOUTMOUSEHANDLES_H
Base class for commands to undo/redo layout and layout object changes.
Base class for graphical items within a QgsLayout.
A graphical widget to display and interact with QgsLayouts.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition qgslayout.h:50