QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsfloatingwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfloatingwidget.h
3
-------------------
4
begin : April 2016
5
copyright : (C) 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
#ifndef QGSFLOATINGWIDGET_H
16
#define QGSFLOATINGWIDGET_H
17
18
#include "qgis_gui.h"
19
#include "
qgis_sip.h
"
20
21
#include <QPointer>
22
#include <QWidget>
23
24
class
QgsFloatingWidgetEventFilter;
25
35
36
class
GUI_EXPORT
QgsFloatingWidget
:
public
QWidget
37
{
38
Q_OBJECT
39
Q_PROPERTY( QWidget *
anchorWidget
READ
anchorWidget
WRITE
setAnchorWidget
NOTIFY
anchorWidgetChanged
)
40
Q_PROPERTY(
AnchorPoint
anchorPoint
READ
anchorPoint
WRITE
setAnchorPoint
NOTIFY
anchorPointChanged
)
41
Q_PROPERTY(
AnchorPoint
anchorWidgetPoint
READ
anchorWidgetPoint
WRITE
setAnchorWidgetPoint
NOTIFY
anchorWidgetPointChanged
)
42
43
public:
45
enum
AnchorPoint
46
{
47
TopLeft
,
48
TopMiddle
,
49
TopRight
,
50
MiddleLeft
,
51
Middle
,
52
MiddleRight
,
53
BottomLeft
,
54
BottomMiddle
,
55
BottomRight
,
56
};
57
Q_ENUM(
AnchorPoint
)
58
59
63
QgsFloatingWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
64
71
void
setAnchorWidget( QWidget *widget );
72
78
QWidget *
anchorWidget
();
79
85
AnchorPoint
anchorPoint
()
const
{
return
mFloatAnchorPoint; }
86
93
void
setAnchorPoint(
AnchorPoint
point );
94
101
AnchorPoint
anchorWidgetPoint
()
const
{
return
mAnchorWidgetAnchorPoint; }
102
109
void
setAnchorWidgetPoint(
AnchorPoint
point );
110
111
signals:
112
114
void
anchorWidgetChanged
( QWidget *widget );
115
117
void
anchorPointChanged
(
QgsFloatingWidget::AnchorPoint
point );
118
120
void
anchorWidgetPointChanged
(
QgsFloatingWidget::AnchorPoint
point );
121
122
protected
:
123
void
showEvent
( QShowEvent *e )
override
;
124
void
paintEvent
( QPaintEvent *e )
override
;
125
void
resizeEvent
( QResizeEvent *e )
override
;
126
127
private
slots:
128
130
void
onAnchorPointChanged();
131
132
private
:
133
QPointer<QWidget> mAnchorWidget;
134
QgsFloatingWidgetEventFilter *mParentEventFilter =
nullptr
;
135
QgsFloatingWidgetEventFilter *mAnchorEventFilter =
nullptr
;
136
AnchorPoint
mFloatAnchorPoint =
BottomMiddle
;
137
AnchorPoint
mAnchorWidgetAnchorPoint =
TopMiddle
;
138
};
139
140
141
#ifndef SIP_RUN
142
144
145
class
QgsFloatingWidgetEventFilter :
public
QObject
146
{
147
Q_OBJECT
148
149
public
:
150
QgsFloatingWidgetEventFilter( QWidget *parent =
nullptr
);
151
152
bool
eventFilter( QObject *
object
, QEvent *event )
override
;
153
154
signals:
155
157
void
anchorPointChanged();
158
};
159
161
162
#endif
163
164
#endif
// QGSFLOATINGWIDGET_H
QgsFloatingWidget
A QWidget subclass for creating widgets which float outside of the normal Qt layout system.
Definition
qgsfloatingwidget.h:37
QgsFloatingWidget::anchorWidgetPointChanged
void anchorWidgetPointChanged(QgsFloatingWidget::AnchorPoint point)
Emitted when the anchor widget point changes.
QgsFloatingWidget::setAnchorWidget
void setAnchorWidget(QWidget *widget)
Sets the widget to "anchor" the floating widget to.
Definition
qgsfloatingwidget.cpp:39
QgsFloatingWidget::QgsFloatingWidget
QgsFloatingWidget(QWidget *parent=nullptr)
Constructor for QgsFloatingWidget.
Definition
qgsfloatingwidget.cpp:28
QgsFloatingWidget::setAnchorWidgetPoint
void setAnchorWidgetPoint(AnchorPoint point)
Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which t...
Definition
qgsfloatingwidget.cpp:79
QgsFloatingWidget::resizeEvent
void resizeEvent(QResizeEvent *e) override
Definition
qgsfloatingwidget.cpp:104
QgsFloatingWidget::anchorPointChanged
void anchorPointChanged(QgsFloatingWidget::AnchorPoint point)
Emitted when the anchor point changes.
QgsFloatingWidget::anchorWidget
QWidget * anchorWidget
Definition
qgsfloatingwidget.h:39
QgsFloatingWidget::anchorWidgetPoint
AnchorPoint anchorWidgetPoint() const
Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which t...
Definition
qgsfloatingwidget.h:101
QgsFloatingWidget::AnchorPoint
AnchorPoint
Reference points for anchoring widget position.
Definition
qgsfloatingwidget.h:46
QgsFloatingWidget::BottomMiddle
@ BottomMiddle
Bottom center of widget.
Definition
qgsfloatingwidget.h:54
QgsFloatingWidget::TopMiddle
@ TopMiddle
Top center of widget.
Definition
qgsfloatingwidget.h:48
QgsFloatingWidget::MiddleRight
@ MiddleRight
Middle right of widget.
Definition
qgsfloatingwidget.h:52
QgsFloatingWidget::MiddleLeft
@ MiddleLeft
Middle left of widget.
Definition
qgsfloatingwidget.h:50
QgsFloatingWidget::BottomRight
@ BottomRight
Bottom-right of widget.
Definition
qgsfloatingwidget.h:55
QgsFloatingWidget::BottomLeft
@ BottomLeft
Bottom-left of widget.
Definition
qgsfloatingwidget.h:53
QgsFloatingWidget::Middle
@ Middle
Middle of widget.
Definition
qgsfloatingwidget.h:51
QgsFloatingWidget::TopLeft
@ TopLeft
Top-left of widget.
Definition
qgsfloatingwidget.h:47
QgsFloatingWidget::TopRight
@ TopRight
Top-right of widget.
Definition
qgsfloatingwidget.h:49
QgsFloatingWidget::anchorPoint
AnchorPoint anchorPoint
Definition
qgsfloatingwidget.h:40
QgsFloatingWidget::paintEvent
void paintEvent(QPaintEvent *e) override
Definition
qgsfloatingwidget.cpp:95
QgsFloatingWidget::setAnchorPoint
void setAnchorPoint(AnchorPoint point)
Sets the floating widget's anchor point, which corresponds to the point on the widget which should re...
Definition
qgsfloatingwidget.cpp:69
QgsFloatingWidget::anchorWidgetPoint
AnchorPoint anchorWidgetPoint
Definition
qgsfloatingwidget.h:41
QgsFloatingWidget::anchorWidgetChanged
void anchorWidgetChanged(QWidget *widget)
Emitted when the anchor widget changes.
QgsFloatingWidget::anchorWidget
QWidget * anchorWidget()
Returns the widget that the floating widget is "anchored" tto.
QgsFloatingWidget::showEvent
void showEvent(QShowEvent *e) override
Definition
qgsfloatingwidget.cpp:89
QgsFloatingWidget::anchorPoint
AnchorPoint anchorPoint() const
Returns the floating widget's anchor point, which corresponds to the point on the widget which should...
Definition
qgsfloatingwidget.h:85
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
AnchorPoint
record about vertex coordinates and index of anchor to which it is snapped
Definition
qgsgeometrysnappersinglesource.cpp:30
Generated on
for QGIS API Documentation by
1.17.0