QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsmodelgraphicitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmodelgraphicitem.h
3 ----------------------------------
4 Date : February 2020
5 Copyright : (C) 2020 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSMODELGRAPHICITEM_H
17#define QGSMODELGRAPHICITEM_H
18
19#include "qgis.h"
20#include "qgis_gui.h"
21#include <QGraphicsObject>
22#include <QPicture>
23
24class QgsModelGraphicsView;
26
28
29
36class GUI_EXPORT QgsModelDesignerFlatButtonGraphicItem : public QGraphicsObject
37{
38 Q_OBJECT
39 public:
46 QgsModelDesignerFlatButtonGraphicItem( QGraphicsItem *parent SIP_TRANSFERTHIS, const QPicture &picture, const QPointF &position, const QSizeF &size = QSizeF( 16, 16 ) );
47
48 void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr ) override;
49 QRectF boundingRect() const override;
50 void hoverEnterEvent( QGraphicsSceneHoverEvent *event ) override;
51 void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ) override;
52 void mousePressEvent( QGraphicsSceneMouseEvent *event ) override;
53
54#ifndef SIP_RUN
55
59 virtual void modelHoverEnterEvent( QgsModelViewMouseEvent *event );
60
64 virtual void modelHoverLeaveEvent( QgsModelViewMouseEvent *event );
65
69 virtual void modelPressEvent( QgsModelViewMouseEvent *event );
70#endif
71
75 void setPosition( const QPointF &position );
76
80 QgsModelGraphicsView *view();
81
82 signals:
83
87 void clicked();
88
89 protected:
93 void setPicture( const QPicture &picture );
94
95 private:
96 QPicture mPicture;
97 QPointF mPosition;
98 QSizeF mSize;
99 bool mHoverState = false;
100};
101
102
109class GUI_EXPORT QgsModelDesignerFoldButtonGraphicItem : public QgsModelDesignerFlatButtonGraphicItem
110{
111 Q_OBJECT
112 public:
121 QgsModelDesignerFoldButtonGraphicItem( QGraphicsItem *parent SIP_TRANSFERTHIS, bool folded, const QPointF &position, const QSizeF &size = QSizeF( 11, 11 ) );
122
123 void mousePressEvent( QGraphicsSceneMouseEvent *event ) override;
124#ifndef SIP_RUN
125 void modelPressEvent( QgsModelViewMouseEvent *event ) override;
126#endif
127
128 signals:
129
135 void folded( bool folded );
136
137 private:
138 QPicture mPlusPicture;
139 QPicture mMinusPicture;
140 bool mFolded = false;
141};
142
144
145#endif // QGSMODELGRAPHICITEM_H
A QgsModelViewMouseEvent is the result of a user interaction with the mouse on a QgsModelGraphicsView...
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53