QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Types | Public Slots | Signals | Public Member Functions | Properties | List of all members
QgsExtentGroupBox Class Reference

Collapsible group box for configuration of extent, typically for a save operation. More...

#include <qgsextentgroupbox.h>

Inheritance diagram for QgsExtentGroupBox:
Inheritance graph
[legend]

Public Types

enum  ExtentState {
  OriginalExtent , CurrentExtent , UserExtent , ProjectLayerExtent ,
  DrawOnCanvas
}
 Available states for the current extent selection in the widget. More...
 

Public Slots

void setOutputExtentFromCurrent ()
 Sets the output extent to be the same as current extent (may be transformed to output CRS). More...
 
void setOutputExtentFromDrawOnCanvas ()
 Sets the output extent by dragging on the canvas. More...
 
void setOutputExtentFromLayer (const QgsMapLayer *layer)
 Sets the output extent to match a layer's extent (may be transformed to output CRS). More...
 
void setOutputExtentFromOriginal ()
 Sets the output extent to be the same as original extent (may be transformed to output CRS). More...
 
void setOutputExtentFromUser (const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs)
 Sets the output extent to a custom extent (may be transformed to output CRS). More...
 
void setRatio (QSize ratio)
 Sets a fixed aspect ratio to be used when dragging extent onto the canvas. More...
 
- Public Slots inherited from QgsCollapsibleGroupBoxBasic
void checkClicked (bool ckd)
 
void checkToggled (bool ckd)
 
void setStyleSheet (const QString &style)
 Overridden to prepare base call and avoid crash due to specific QT versions. More...
 
void toggleCollapsed ()
 

Signals

void extentChanged (const QgsRectangle &r)
 Emitted when the widget's extent is changed. More...
 
- Signals inherited from QgsCollapsibleGroupBoxBasic
void collapsedStateChanged (bool collapsed)
 Signal emitted when groupbox collapsed/expanded state is changed, and when first shown. More...
 

Public Member Functions

 QgsExtentGroupBox (QWidget *parent=nullptr)
 Constructor for QgsExtentGroupBox. More...
 
QgsCoordinateReferenceSystem currentCrs () const
 Returns the coordinate reference system for the current extent set for the widget. More...
 
QgsRectangle currentExtent () const
 Returns the current extent set for the widget. More...
 
QgsExtentGroupBox::ExtentState extentState () const
 Returns the currently selected state for the widget's extent. More...
 
QgsCoordinateReferenceSystem originalCrs () const
 Returns the original coordinate reference system set for the widget. More...
 
QgsRectangle originalExtent () const
 Returns the original extent set for the widget. More...
 
QgsCoordinateReferenceSystem outputCrs () const
 Returns the current output CRS, used in the display. More...
 
QgsRectangle outputExtent () const
 Returns the extent shown in the widget - in output CRS coordinates. More...
 
QSize ratio () const
 Returns the current fixed aspect ratio to be used when dragging extent onto the canvas. More...
 
void setCurrentExtent (const QgsRectangle &currentExtent, const QgsCoordinateReferenceSystem &currentCrs)
 Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes). More...
 
void setMapCanvas (QgsMapCanvas *canvas, bool drawOnCanvasOption=true)
 Sets the map canvas to enable dragging of extent on a canvas. More...
 
void setOriginalExtent (const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs)
 Sets the original extent and coordinate reference system for the widget. More...
 
void setOutputCrs (const QgsCoordinateReferenceSystem &outputCrs)
 Sets the output CRS - may need to be used for transformation from original/current extent. More...
 
void setTitleBase (const QString &title)
 Sets the base part of title of the group box (will be appended with extent state) More...
 
QString titleBase () const
 Returns the base part of title of the group box (will be appended with extent state). More...
 
- Public Member Functions inherited from QgsCollapsibleGroupBox
 QgsCollapsibleGroupBox (const QString &title, QWidget *parent=nullptr, QgsSettings *settings=nullptr)
 
 QgsCollapsibleGroupBox (QWidget *parent=nullptr, QgsSettings *settings=nullptr)
 
 ~QgsCollapsibleGroupBox () override
 
bool saveCheckedState ()
 
bool saveCollapsedState ()
 
void setSaveCheckedState (bool save)
 Set this to true to save/restore checked state. More...
 
void setSaveCollapsedState (bool save)
 Sets this to false to not save/restore collapsed state. More...
 
void setSettingGroup (const QString &group)
 Sets this to a defined string to share save/restore states across different parent dialogs. More...
 
void setSettings (QgsSettings *settings)
 
QString settingGroup () const
 Returns the name of the setting group in which the collapsed state will be saved. More...
 
- Public Member Functions inherited from QgsCollapsibleGroupBoxBasic
 QgsCollapsibleGroupBoxBasic (const QString &title, QWidget *parent=nullptr)
 
 QgsCollapsibleGroupBoxBasic (QWidget *parent=nullptr)
 
bool isCollapsed () const
 Returns the current collapsed state of this group box. More...
 
bool scrollOnExpand ()
 If this is set to false the parent QScrollArea will not be automatically scrolled to this widget's contents when expanded. More...
 
void setCollapsed (bool collapse)
 Collapse or uncollapse this groupbox. More...
 
void setScrollOnExpand (bool scroll)
 Sets this to false to not automatically scroll parent QScrollArea to this widget's contents when expanded. More...
 
void setSyncGroup (const QString &grp)
 Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key. More...
 
QString syncGroup () const
 Named group which synchronizes collapsing action when triangle is clicked while holding alt modifier key. More...
 

Properties

QString titleBase
 
- Properties inherited from QgsCollapsibleGroupBox
bool saveCheckedState
 Shall the checked state of this group box be saved and loaded persistently in QgsSettings. More...
 
bool saveCollapsedState
 Shall the collapsed state of this group box be saved and loaded persistently in QgsSettings. More...
 
- Properties inherited from QgsCollapsibleGroupBoxBasic
bool collapsed
 The collapsed state of this group box. More...
 
bool scrollOnExpand
 If this property is set to true, a parent scroll area will try to make sure that the whole group box is visible when uncollapsing it. More...
 
QString syncGroup
 An optional group to be collapsed and uncollapsed in sync with this group box if the Alt-modifier is pressed while collapsing / uncollapsing. More...
 

Additional Inherited Members

- Protected Slots inherited from QgsCollapsibleGroupBox
void loadState ()
 Will load the collapsed and checked state. More...
 
void saveState () const
 Will save the collapsed and checked state. More...
 
- Protected Member Functions inherited from QgsCollapsibleGroupBox
void init ()
 
QString saveKey () const
 
void showEvent (QShowEvent *event) override
 
- Protected Member Functions inherited from QgsCollapsibleGroupBoxBasic
void changeEvent (QEvent *event) override
 
void clearModifiers ()
 
void collapseExpandFixes ()
 Visual fixes for when group box is collapsed/expanded. More...
 
void init ()
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void showEvent (QShowEvent *event) override
 
QRect titleRect () const
 
void updateStyle ()
 
- Protected Attributes inherited from QgsCollapsibleGroupBox
bool mDelSettings
 
bool mSaveCheckedState
 
bool mSaveCollapsedState
 
QString mSettingGroup
 
QPointer< QgsSettingsmSettings
 
- Protected Attributes inherited from QgsCollapsibleGroupBoxBasic
bool mAltDown
 
QgsGroupBoxCollapseButtonmCollapseButton = nullptr
 
bool mCollapsed
 
QIcon mCollapseIcon
 
QIcon mExpandIcon
 
bool mInitFlat
 
bool mInitFlatChecked
 
QScrollArea * mParentScrollArea = nullptr
 
bool mScrollOnExpand
 
bool mShiftDown
 
bool mShown
 
QString mSyncGroup
 
QWidget * mSyncParent = nullptr
 
bool mTitleClicked
 

Detailed Description

Collapsible group box for configuration of extent, typically for a save operation.

Besides allowing the user to enter the extent manually, it comes with options to use original extent or extent defined by the current view in map canvas.

When using the group box, make sure to call setOriginalExtent(), setCurrentExtent() and setOutputCrs() during initialization.

See also
QgsExtentWidget

Definition at line 46 of file qgsextentgroupbox.h.

Member Enumeration Documentation

◆ ExtentState

Available states for the current extent selection in the widget.

Enumerator
OriginalExtent 

Layer's extent.

CurrentExtent 

Map canvas extent.

UserExtent 

Extent manually entered/modified by the user.

ProjectLayerExtent 

Extent taken from a layer within the project.

DrawOnCanvas 

Extent taken from a rectangled drawn onto the map canvas.

Definition at line 56 of file qgsextentgroupbox.h.

Constructor & Destructor Documentation

◆ QgsExtentGroupBox()

QgsExtentGroupBox::QgsExtentGroupBox ( QWidget *  parent = nullptr)
explicit

Constructor for QgsExtentGroupBox.

Definition at line 19 of file qgsextentgroupbox.cpp.

Member Function Documentation

◆ currentCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::currentCrs ( ) const

Returns the coordinate reference system for the current extent set for the widget.

The current extent and CRS usually reflects the map canvas extent and CRS.

See also
setCurrentExtent()
currentExtent()

Definition at line 67 of file qgsextentgroupbox.cpp.

◆ currentExtent()

QgsRectangle QgsExtentGroupBox::currentExtent ( ) const

Returns the current extent set for the widget.

The current extent is usually set to match the current map canvas extent.

See also
setCurrentExtent()
currentCrs()

Definition at line 62 of file qgsextentgroupbox.cpp.

◆ extentChanged

void QgsExtentGroupBox::extentChanged ( const QgsRectangle r)
signal

Emitted when the widget's extent is changed.

◆ extentState()

QgsExtentGroupBox::ExtentState QgsExtentGroupBox::extentState ( ) const

Returns the currently selected state for the widget's extent.

Definition at line 177 of file qgsextentgroupbox.cpp.

◆ originalCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::originalCrs ( ) const

Returns the original coordinate reference system set for the widget.

See also
originalExtent()
setOriginalExtent()

Definition at line 52 of file qgsextentgroupbox.cpp.

◆ originalExtent()

QgsRectangle QgsExtentGroupBox::originalExtent ( ) const

Returns the original extent set for the widget.

See also
setOriginalExtent()
originalCrs()

Definition at line 47 of file qgsextentgroupbox.cpp.

◆ outputCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::outputCrs ( ) const

Returns the current output CRS, used in the display.

See also
outputExtent

Definition at line 172 of file qgsextentgroupbox.cpp.

◆ outputExtent()

QgsRectangle QgsExtentGroupBox::outputExtent ( ) const

Returns the extent shown in the widget - in output CRS coordinates.

See also
outputCrs

Definition at line 164 of file qgsextentgroupbox.cpp.

◆ ratio()

QSize QgsExtentGroupBox::ratio ( ) const

Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.

If the aspect ratio isn't fixed, the width and height will be set to zero.

Definition at line 198 of file qgsextentgroupbox.cpp.

◆ setCurrentExtent()

void QgsExtentGroupBox::setCurrentExtent ( const QgsRectangle currentExtent,
const QgsCoordinateReferenceSystem currentCrs 
)

Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes).

The current extent is usually set to match the current map canvas extent.

See also
currentExtent()
currentCrs()

Definition at line 57 of file qgsextentgroupbox.cpp.

◆ setMapCanvas()

void QgsExtentGroupBox::setMapCanvas ( QgsMapCanvas canvas,
bool  drawOnCanvasOption = true 
)

Sets the map canvas to enable dragging of extent on a canvas.

Parameters
canvasthe map canvas
drawOnCanvasOptionset to false to disable to draw on canvas option

Definition at line 193 of file qgsextentgroupbox.cpp.

◆ setOriginalExtent()

void QgsExtentGroupBox::setOriginalExtent ( const QgsRectangle originalExtent,
const QgsCoordinateReferenceSystem originalCrs 
)

Sets the original extent and coordinate reference system for the widget.

This should be called as part of initialization.

See also
originalExtent()
originalCrs()

Definition at line 42 of file qgsextentgroupbox.cpp.

◆ setOutputCrs()

void QgsExtentGroupBox::setOutputCrs ( const QgsCoordinateReferenceSystem outputCrs)

Sets the output CRS - may need to be used for transformation from original/current extent.

Should be called as part of initialization and whenever the the output CRS is changed. The current extent will be reprojected into the new output CRS.

Definition at line 72 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromCurrent

void QgsExtentGroupBox::setOutputExtentFromCurrent ( )
slot

Sets the output extent to be the same as current extent (may be transformed to output CRS).

Definition at line 105 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromDrawOnCanvas

void QgsExtentGroupBox::setOutputExtentFromDrawOnCanvas ( )
slot

Sets the output extent by dragging on the canvas.

Definition at line 125 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromLayer

void QgsExtentGroupBox::setOutputExtentFromLayer ( const QgsMapLayer layer)
slot

Sets the output extent to match a layer's extent (may be transformed to output CRS).

Definition at line 120 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromOriginal

void QgsExtentGroupBox::setOutputExtentFromOriginal ( )
slot

Sets the output extent to be the same as original extent (may be transformed to output CRS).

Definition at line 110 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromUser

void QgsExtentGroupBox::setOutputExtentFromUser ( const QgsRectangle extent,
const QgsCoordinateReferenceSystem crs 
)
slot

Sets the output extent to a custom extent (may be transformed to output CRS).

Definition at line 115 of file qgsextentgroupbox.cpp.

◆ setRatio

void QgsExtentGroupBox::setRatio ( QSize  ratio)
slot

Sets a fixed aspect ratio to be used when dragging extent onto the canvas.

To unset a fixed aspect ratio, set the width and height to zero.

Parameters
ratioaspect ratio's width and height

Definition at line 130 of file qgsextentgroupbox.cpp.

◆ setTitleBase()

void QgsExtentGroupBox::setTitleBase ( const QString &  title)

Sets the base part of title of the group box (will be appended with extent state)

See also
titleBase()

Definition at line 182 of file qgsextentgroupbox.cpp.

◆ titleBase()

QString QgsExtentGroupBox::titleBase ( ) const

Returns the base part of title of the group box (will be appended with extent state).

See also
setTitleBase()

Definition at line 188 of file qgsextentgroupbox.cpp.

Property Documentation

◆ titleBase

QString QgsExtentGroupBox::titleBase
readwrite

Definition at line 1 of file qgsextentgroupbox.h.


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