QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Collapsible group box for configuration of extent, typically for a save operation. More...
#include <qgsextentgroupbox.h>
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 ¤tExtent, const QgsCoordinateReferenceSystem ¤tCrs) |
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< QgsSettings > | mSettings |
Protected Attributes inherited from QgsCollapsibleGroupBoxBasic | |
bool | mAltDown |
QgsGroupBoxCollapseButton * | mCollapseButton = 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 |
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.
Definition at line 47 of file qgsextentgroupbox.h.
Available states for the current extent selection in the widget.
Definition at line 57 of file qgsextentgroupbox.h.
|
explicit |
Constructor for QgsExtentGroupBox.
Definition at line 19 of file qgsextentgroupbox.cpp.
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.
Definition at line 63 of file qgsextentgroupbox.cpp.
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.
Definition at line 58 of file qgsextentgroupbox.cpp.
|
signal |
Emitted when the widget's extent is changed.
QgsExtentGroupBox::ExtentState QgsExtentGroupBox::extentState | ( | ) | const |
Returns the currently selected state for the widget's extent.
Definition at line 173 of file qgsextentgroupbox.cpp.
QgsCoordinateReferenceSystem QgsExtentGroupBox::originalCrs | ( | ) | const |
Returns the original coordinate reference system set for the widget.
Definition at line 48 of file qgsextentgroupbox.cpp.
QgsRectangle QgsExtentGroupBox::originalExtent | ( | ) | const |
Returns the original extent set for the widget.
Definition at line 43 of file qgsextentgroupbox.cpp.
QgsCoordinateReferenceSystem QgsExtentGroupBox::outputCrs | ( | ) | const |
Returns the current output CRS, used in the display.
Definition at line 168 of file qgsextentgroupbox.cpp.
QgsRectangle QgsExtentGroupBox::outputExtent | ( | ) | const |
Returns the extent shown in the widget - in output CRS coordinates.
Definition at line 160 of file qgsextentgroupbox.cpp.
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 194 of file qgsextentgroupbox.cpp.
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.
Definition at line 53 of file qgsextentgroupbox.cpp.
void QgsExtentGroupBox::setMapCanvas | ( | QgsMapCanvas * | canvas, |
bool | drawOnCanvasOption = true |
||
) |
Sets the map canvas to enable dragging of extent on a canvas.
canvas | the map canvas |
drawOnCanvasOption | set to false to disable to draw on canvas option |
Definition at line 189 of file qgsextentgroupbox.cpp.
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.
Definition at line 38 of file qgsextentgroupbox.cpp.
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 68 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent to be the same as current extent (may be transformed to output CRS).
Definition at line 101 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent by dragging on the canvas.
Definition at line 121 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent to match a layer's extent (may be transformed to output CRS).
Definition at line 116 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent to be the same as original extent (may be transformed to output CRS).
Definition at line 106 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent to a custom extent (may be transformed to output CRS).
Definition at line 111 of file qgsextentgroupbox.cpp.
|
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.
ratio | aspect ratio's width and height |
Definition at line 126 of file qgsextentgroupbox.cpp.
void QgsExtentGroupBox::setTitleBase | ( | const QString & | title | ) |
Sets the base part of title of the group box (will be appended with extent state)
Definition at line 178 of file qgsextentgroupbox.cpp.
QString QgsExtentGroupBox::titleBase | ( | ) | const |
Returns the base part of title of the group box (will be appended with extent state).
Definition at line 184 of file qgsextentgroupbox.cpp.
|
readwrite |
Definition at line 1 of file qgsextentgroupbox.h.