QGIS API Documentation  3.6.0-Noosa (5873452)
Public Types | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsFloatingWidget Class Reference

A QWidget subclass for creating widgets which float outside of the normal Qt layout system. More...

#include <qgsfloatingwidget.h>

Inheritance diagram for QgsFloatingWidget:
Inheritance graph
[legend]

Public Types

enum  AnchorPoint {
  TopLeft, TopMiddle, TopRight, MiddleLeft,
  Middle, MiddleRight, BottomLeft, BottomMiddle,
  BottomRight
}
 Reference points for anchoring widget position. More...
 

Signals

void anchorPointChanged (QgsFloatingWidget::AnchorPoint point)
 Emitted when the anchor point changes. More...
 
void anchorWidgetChanged (QWidget *widget)
 Emitted when the anchor widget changes. More...
 
void anchorWidgetPointChanged (QgsFloatingWidget::AnchorPoint point)
 Emitted when the anchor widget point changes. More...
 

Public Member Functions

 QgsFloatingWidget (QWidget *parent=nullptr)
 Constructor for QgsFloatingWidget. More...
 
AnchorPoint anchorPoint () const
 Returns the floating widget's anchor point, which corresponds to the point on the widget which should remain fixed in the same relative position whenever the widget's parent is resized or moved. More...
 
QWidget * anchorWidget ()
 Returns the widget that the floating widget is "anchored" tto. More...
 
AnchorPoint anchorWidgetPoint () const
 Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which the floating widget should "attach" to. More...
 
void setAnchorPoint (AnchorPoint point)
 Sets the floating widget's anchor point, which corresponds to the point on the widget which should remain fixed in the same relative position whenever the widget's parent is resized or moved. More...
 
void setAnchorWidget (QWidget *widget)
 Sets the widget to "anchor" the floating widget to. More...
 
void setAnchorWidgetPoint (AnchorPoint point)
 Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which the floating widget should "attach" to. More...
 

Protected Member Functions

void paintEvent (QPaintEvent *e) override
 
void resizeEvent (QResizeEvent *e) override
 
void showEvent (QShowEvent *e) override
 

Properties

AnchorPoint anchorPoint
 
QWidget anchorWidget
 
AnchorPoint anchorWidgetPoint
 

Detailed Description

A QWidget subclass for creating widgets which float outside of the normal Qt layout system.

Floating widgets use an "anchor widget" to determine how they are anchored within their parent widget.

Since
QGIS 3.0

Definition at line 33 of file qgsfloatingwidget.h.

Member Enumeration Documentation

◆ AnchorPoint

Reference points for anchoring widget position.

Enumerator
TopLeft 

Top-left of widget.

TopMiddle 

Top center of widget.

TopRight 

Top-right of widget.

MiddleLeft 

Middle left of widget.

Middle 

Middle of widget.

MiddleRight 

Middle right of widget.

BottomLeft 

Bottom-left of widget.

BottomMiddle 

Bottom center of widget.

BottomRight 

Bottom-right of widget.

Definition at line 43 of file qgsfloatingwidget.h.

Constructor & Destructor Documentation

◆ QgsFloatingWidget()

QgsFloatingWidget::QgsFloatingWidget ( QWidget *  parent = nullptr)

Constructor for QgsFloatingWidget.

Parameters
parentparent widget

Definition at line 25 of file qgsfloatingwidget.cpp.

Member Function Documentation

◆ anchorPoint()

AnchorPoint QgsFloatingWidget::anchorPoint ( ) const
inline

Returns the floating widget's anchor point, which corresponds to the point on the widget which should remain fixed in the same relative position whenever the widget's parent is resized or moved.

See also
setAnchorPoint()

Definition at line 83 of file qgsfloatingwidget.h.

◆ anchorPointChanged

void QgsFloatingWidget::anchorPointChanged ( QgsFloatingWidget::AnchorPoint  point)
signal

Emitted when the anchor point changes.

◆ anchorWidget()

QWidget* QgsFloatingWidget::anchorWidget ( )

Returns the widget that the floating widget is "anchored" tto.

The floating widget will be repositioned whenever the anchor widget moves or is resized so that it maintains the same relative position to the anchor widget.

See also
setAnchorWidget()

◆ anchorWidgetChanged

void QgsFloatingWidget::anchorWidgetChanged ( QWidget *  widget)
signal

Emitted when the anchor widget changes.

◆ anchorWidgetPoint()

AnchorPoint QgsFloatingWidget::anchorWidgetPoint ( ) const
inline

Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which the floating widget should "attach" to.

The floating widget should remain fixed in the same relative position to this anchor widget whenever the widget's parent is resized or moved.

See also
setAnchorWidgetPoint()

Definition at line 99 of file qgsfloatingwidget.h.

◆ anchorWidgetPointChanged

void QgsFloatingWidget::anchorWidgetPointChanged ( QgsFloatingWidget::AnchorPoint  point)
signal

Emitted when the anchor widget point changes.

◆ paintEvent()

void QgsFloatingWidget::paintEvent ( QPaintEvent *  e)
overrideprotected

Definition at line 92 of file qgsfloatingwidget.cpp.

◆ resizeEvent()

void QgsFloatingWidget::resizeEvent ( QResizeEvent *  e)
overrideprotected

Definition at line 101 of file qgsfloatingwidget.cpp.

◆ setAnchorPoint()

void QgsFloatingWidget::setAnchorPoint ( AnchorPoint  point)

Sets the floating widget's anchor point, which corresponds to the point on the widget which should remain fixed in the same relative position whenever the widget's parent is resized or moved.

Parameters
pointanchor point
See also
anchorPoint()

Definition at line 66 of file qgsfloatingwidget.cpp.

◆ setAnchorWidget()

void QgsFloatingWidget::setAnchorWidget ( QWidget *  widget)

Sets the widget to "anchor" the floating widget to.

The floating widget will be repositioned whenever the anchor widget moves or is resized so that it maintains the same relative position to the anchor widget.

Parameters
widgetanchor widget. Both the floating widget and the anchor widget must share some common parent.
See also
anchorWidget()

Definition at line 36 of file qgsfloatingwidget.cpp.

◆ setAnchorWidgetPoint()

void QgsFloatingWidget::setAnchorWidgetPoint ( AnchorPoint  point)

Returns the anchor widget's anchor point, which corresponds to the point on the anchor widget which the floating widget should "attach" to.

The floating widget should remain fixed in the same relative position to this anchor widget whenever the widget's parent is resized or moved.

See also
setAnchorWidgetPoint()

Definition at line 76 of file qgsfloatingwidget.cpp.

◆ showEvent()

void QgsFloatingWidget::showEvent ( QShowEvent *  e)
overrideprotected

Definition at line 86 of file qgsfloatingwidget.cpp.

Property Documentation

◆ anchorPoint

AnchorPoint QgsFloatingWidget::anchorPoint
readwrite

Definition at line 37 of file qgsfloatingwidget.h.

◆ anchorWidget

QWidget * QgsFloatingWidget::anchorWidget
readwrite

Definition at line 36 of file qgsfloatingwidget.h.

◆ anchorWidgetPoint

AnchorPoint QgsFloatingWidget::anchorWidgetPoint
readwrite

Definition at line 38 of file qgsfloatingwidget.h.


The documentation for this class was generated from the following files: