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