QGIS API Documentation 3.99.0-Master (0c964c3d988)
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
22#include <memory>
23
24#include "qgis_gui.h"
26
27#include <QPointer>
28
29#define SIP_NO_FILE
30
31class QgsLayout;
32class QGraphicsView;
33class QgsLayoutView;
34class QgsLayoutItem;
35class QInputEvent;
37
39
49class GUI_EXPORT QgsLayoutMouseHandles : public QgsGraphicsViewMouseHandles
50{
51 Q_OBJECT
52 public:
53 QgsLayoutMouseHandles( QgsLayout *layout, QgsLayoutView *view );
54
59 void setLayout( QgsLayout *layout ) { mLayout = layout; }
60
65 QgsLayout *layout() { return mLayout; }
66
67 void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr ) override;
68
69 protected:
70 void setViewportCursor( Qt::CursorShape cursor ) override;
71 QList<QGraphicsItem *> sceneItemsAtPoint( QPointF scenePoint ) override;
72 QList<QGraphicsItem *> selectedSceneItems( bool includeLockedItems = true ) const override;
73 bool itemIsLocked( QGraphicsItem *item ) override;
74 bool itemIsGroupMember( QGraphicsItem *item ) override;
75 QRectF itemRect( QGraphicsItem *item ) const override;
76 void expandItemList( const QList<QGraphicsItem *> &items, QList<QGraphicsItem *> &collected ) const override;
77 void expandItemList( const QList<QgsLayoutItem *> &items, QList<QGraphicsItem *> &collected ) const;
78 void moveItem( QGraphicsItem *item, double deltaX, double deltaY ) override;
79 void rotateItem( QGraphicsItem *item, double deltaDegree, double deltaCenterX, double deltaCenterY ) override;
80 void setItemRect( QGraphicsItem *item, QRectF rect ) override;
81 void showStatusMessage( const QString &message ) override;
82 void hideAlignItems() override;
83 QPointF snapPoint( QPointF originalPoint, SnapGuideMode mode, bool snapHorizontal = true, bool snapVertical = true ) override;
84 void createItemCommand( QGraphicsItem *item ) override;
85 void endItemCommand( QGraphicsItem *item ) override;
86 void startMacroCommand( const QString &text ) override;
87 void endMacroCommand() override;
88
89
90 void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ) override;
91
92 public slots:
93
95 void selectionChanged();
96
97 private:
98 QgsLayout *mLayout = nullptr;
99 QPointer<QgsLayoutView> mView;
100
102 QGraphicsLineItem *mHorizontalSnapLine = nullptr;
103 QGraphicsLineItem *mVerticalSnapLine = nullptr;
104
105 std::unique_ptr<QgsAbstractLayoutUndoCommand> mItemCommand;
106};
107
109
110#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