QGIS API Documentation  3.2.0-Bonn (bc43194)
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 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)
 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 (QWidget *parent=nullptr, QgsSettings *settings=nullptr)
 
 QgsCollapsibleGroupBox (const QString &title, 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 (QWidget *parent=nullptr)
 
 QgsCollapsibleGroupBoxBasic (const QString &title, 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 widget, make sure to call setOriginalExtent(), setCurrentExtent() and setOutputCrs() during initialization.

Since
QGIS 2.4

Definition at line 47 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 55 of file qgsextentgroupbox.h.

Constructor & Destructor Documentation

◆ QgsExtentGroupBox()

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

Constructor for QgsExtentGroupBox.

Definition at line 29 of file qgsextentgroupbox.cpp.

Member Function Documentation

◆ currentCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::currentCrs ( ) const
inline

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 112 of file qgsextentgroupbox.h.

◆ currentExtent()

QgsRectangle QgsExtentGroupBox::currentExtent ( ) const
inline

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 104 of file qgsextentgroupbox.h.

◆ extentChanged

void QgsExtentGroupBox::extentChanged ( const QgsRectangle r)
signal

Emitted when the widget's extent is changed.

◆ extentState()

QgsExtentGroupBox::ExtentState QgsExtentGroupBox::extentState ( ) const
inline

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

Definition at line 137 of file qgsextentgroupbox.h.

◆ originalCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::originalCrs ( ) const
inline

Returns the original coordinate reference system set for the widget.

See also
originalExtent()
setOriginalExtent()

Definition at line 88 of file qgsextentgroupbox.h.

◆ originalExtent()

QgsRectangle QgsExtentGroupBox::originalExtent ( ) const
inline

Returns the original extent set for the widget.

See also
setOriginalExtent()
originalCrs()

Definition at line 81 of file qgsextentgroupbox.h.

◆ outputCrs()

QgsCoordinateReferenceSystem QgsExtentGroupBox::outputCrs ( ) const
inline

Returns the current output CRS, used in the display.

See also
outputExtent
Since
QGIS 3.0

Definition at line 132 of file qgsextentgroupbox.h.

◆ outputExtent()

QgsRectangle QgsExtentGroupBox::outputExtent ( ) const

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

See also
outputCrs

Definition at line 333 of file qgsextentgroupbox.cpp.

◆ ratio()

QSize QgsExtentGroupBox::ratio ( ) const
inline

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.

Since
QGIS 3.0

Definition at line 165 of file qgsextentgroupbox.h.

◆ 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 69 of file qgsextentgroupbox.cpp.

◆ setMapCanvas()

void QgsExtentGroupBox::setMapCanvas ( QgsMapCanvas canvas)

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

Parameters
canvasthe map canvas
Since
QGIS 3.0

Definition at line 353 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 60 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 77 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 255 of file qgsextentgroupbox.cpp.

◆ setOutputExtentFromDrawOnCanvas

void QgsExtentGroupBox::setOutputExtentFromDrawOnCanvas ( )
slot

Sets the output extent by dragging on the canvas.

Since
QGIS 3.0

Definition at line 292 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).

Since
QGIS 3.0

Definition at line 281 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 271 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 276 of file qgsextentgroupbox.cpp.

◆ setRatio

void QgsExtentGroupBox::setRatio ( QSize  ratio)
inlineslot

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
Since
QGIS 3.0

Definition at line 202 of file qgsextentgroupbox.h.

◆ 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()
Since
QGIS 2.12

Definition at line 342 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()
Since
QGIS 2.12

Property Documentation

◆ titleBase

QString QgsExtentGroupBox::titleBase
readwrite

Definition at line 50 of file qgsextentgroupbox.h.


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