QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
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). | |
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 ¤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). | |
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 |
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 46 of file qgsextentgroupbox.h.
Available states for the current extent selection in the widget.
Definition at line 56 of file qgsextentgroupbox.h.
|
explicit |
Constructor for QgsExtentGroupBox.
Definition at line 20 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 68 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 63 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 178 of file qgsextentgroupbox.cpp.
QgsCoordinateReferenceSystem QgsExtentGroupBox::originalCrs | ( | ) | const |
Returns the original coordinate reference system set for the widget.
Definition at line 53 of file qgsextentgroupbox.cpp.
QgsRectangle QgsExtentGroupBox::originalExtent | ( | ) | const |
Returns the original extent set for the widget.
Definition at line 48 of file qgsextentgroupbox.cpp.
QgsCoordinateReferenceSystem QgsExtentGroupBox::outputCrs | ( | ) | const |
Returns the current output CRS, used in the display.
Definition at line 173 of file qgsextentgroupbox.cpp.
QgsRectangle QgsExtentGroupBox::outputExtent | ( | ) | const |
Returns the extent shown in the widget - in output CRS coordinates.
Definition at line 165 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 199 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 58 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 194 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 43 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 73 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 106 of file qgsextentgroupbox.cpp.
|
slot |
Sets the output extent by dragging on the canvas.
Definition at line 126 of file qgsextentgroupbox.cpp.
|
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.
|
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.
|
slot |
Sets the output extent to a custom extent (may be transformed to output CRS).
Definition at line 116 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 131 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 183 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 189 of file qgsextentgroupbox.cpp.
|
readwrite |
Definition at line 49 of file qgsextentgroupbox.h.