QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
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).
 
void setOutputExtentFromDrawOnCanvas ()
 Sets the output extent by dragging on the canvas.
 
void setOutputExtentFromLayer (const QgsMapLayer *layer)
 Sets the output extent to match a layer's extent (may be transformed to output CRS).
 
void setOutputExtentFromOriginal ()
 Sets the output extent to be the same as original extent (may be transformed to output CRS).
 
void setOutputExtentFromUser (const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs)
 Sets the output extent to a custom extent (may be transformed to output CRS).
 
void setRatio (QSize ratio)
 Sets a fixed aspect ratio to be used when dragging extent onto the canvas.
 
- 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.
 
void toggleCollapsed ()
 

Signals

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

Public Member Functions

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

Properties

QString titleBase
 
- Properties inherited from QgsCollapsibleGroupBox
bool saveCheckedState
 Shall the checked state of this group box be saved and loaded persistently in QgsSettings.
 
bool saveCollapsedState
 Shall the collapsed state of this group box be saved and loaded persistently in QgsSettings.
 
- Properties inherited from QgsCollapsibleGroupBoxBasic
bool collapsed
 The collapsed state of this group box.
 
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.
 
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.
 

Additional Inherited Members

- Protected Slots inherited from QgsCollapsibleGroupBox
void loadState ()
 Will load the collapsed and checked state.
 
void saveState () const
 Will save the collapsed and checked state.
 
- Protected Member Functions inherited from QgsCollapsibleGroupBox
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.
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void showEvent (QShowEvent *event) override
 
QRect titleRect () const
 
void updateStyle ()
 
- 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 20 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 68 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 63 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 178 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 53 of file qgsextentgroupbox.cpp.

◆ originalExtent()

QgsRectangle QgsExtentGroupBox::originalExtent ( ) const

Returns the original extent set for the widget.

See also
setOriginalExtent()
originalCrs()

Definition at line 48 of file qgsextentgroupbox.cpp.

◆ outputCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::outputCrs ( ) const

Returns the current output CRS, used in the display.

See also
outputExtent

Definition at line 173 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 165 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 199 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 58 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 194 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 43 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 73 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 106 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromDrawOnCanvas

void QgsExtentGroupBox::setOutputExtentFromDrawOnCanvas ( )
slot

Sets the output extent by dragging on the canvas.

Definition at line 126 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 121 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 111 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 116 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 131 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 183 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 189 of file qgsextentgroupbox.cpp.

Property Documentation

◆ titleBase

QString QgsExtentGroupBox::titleBase
readwrite

Definition at line 49 of file qgsextentgroupbox.h.


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