Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add QgsAnnotationItemCommonPropertiesWidget widget for controlling
common properties of annotation items (e.g. reference scale, z order) And include this in the point text item configuration widget
- Loading branch information
1 parent
d602f77
commit adcd793
Showing
10 changed files
with
289 additions
and
4 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
python/gui/auto_generated/annotations/qgsannotationitemcommonpropertieswidget.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/annotations/qgsannotationitemcommonpropertieswidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsAnnotationItemCommonPropertiesWidget: QWidget | ||
{ | ||
%Docstring(signature="appended") | ||
|
||
A widget for configuring common properties for :py:class:`QgsAnnotationItems` | ||
|
||
.. versionadded:: 3.22 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsannotationitemcommonpropertieswidget.h" | ||
%End | ||
public: | ||
|
||
QgsAnnotationItemCommonPropertiesWidget( QWidget *parent /TransferThis/ ); | ||
%Docstring | ||
Constructor for QgsAnnotationItemCommonPropertiesWidget. | ||
%End | ||
|
||
void setItem( QgsAnnotationItem *item ); | ||
%Docstring | ||
Sets the ``item`` whose properties should be shown in the widget. | ||
%End | ||
|
||
void updateItem( QgsAnnotationItem *item ); | ||
%Docstring | ||
Updates an ``item``, setting the properties defined in the widget. | ||
%End | ||
|
||
signals: | ||
|
||
void itemChanged(); | ||
%Docstring | ||
Emitted when the annotation item definition in the widget is changed by the user. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/annotations/qgsannotationitemcommonpropertieswidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/gui/annotations/qgsannotationitemcommonpropertieswidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*************************************************************************** | ||
qgsannotationitemcommonpropertieswidget.cpp | ||
------------------------ | ||
Date : September 2021 | ||
Copyright : (C) 2021 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsannotationitemcommonpropertieswidget.h" | ||
#include "qgsannotationitem.h" | ||
|
||
QgsAnnotationItemCommonPropertiesWidget::QgsAnnotationItemCommonPropertiesWidget( QWidget *parent ) | ||
: QWidget( parent ) | ||
{ | ||
setupUi( this ); | ||
|
||
connect( mSpinZIndex, qOverload<int>( &QSpinBox::valueChanged ), this, [ = ] | ||
{ | ||
if ( !mBlockChangedSignal ) | ||
emit itemChanged(); | ||
} ); | ||
mSpinZIndex->setClearValue( 0 ); | ||
|
||
connect( mReferenceScaleGroup, &QGroupBox::toggled, this, [ = ] | ||
{ | ||
if ( !mBlockChangedSignal ) | ||
emit itemChanged(); | ||
} ); | ||
connect( mReferenceScaleWidget, &QgsScaleWidget::scaleChanged, this, [ = ] | ||
{ | ||
if ( !mBlockChangedSignal ) | ||
emit itemChanged(); | ||
} ); | ||
} | ||
|
||
void QgsAnnotationItemCommonPropertiesWidget::setItem( QgsAnnotationItem *item ) | ||
{ | ||
mSpinZIndex->setValue( item->zIndex() ); | ||
mReferenceScaleGroup->setChecked( item->useSymbologyReferenceScale() ); | ||
mReferenceScaleWidget->setScale( item->symbologyReferenceScale() ); | ||
} | ||
|
||
void QgsAnnotationItemCommonPropertiesWidget::updateItem( QgsAnnotationItem *item ) | ||
{ | ||
item->setZIndex( mSpinZIndex->value() ); | ||
item->setUseSymbologyReferenceScale( mReferenceScaleGroup->isChecked() ); | ||
item->setSymbologyReferenceScale( mReferenceScaleWidget->scale() ); | ||
} |
67 changes: 67 additions & 0 deletions
67
src/gui/annotations/qgsannotationitemcommonpropertieswidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*************************************************************************** | ||
qgsannotationitemcommonpropertieswidget.h | ||
------------------------ | ||
Date : September 2021 | ||
Copyright : (C) 2021 Nyall Dawson | ||
Email : nyall dot dawson at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSANNOTATIONITEMCOMMONPROPERTIESWIDGET_H | ||
#define QGSANNOTATIONITEMCOMMONPROPERTIESWIDGET_H | ||
|
||
#include "qgis_gui.h" | ||
#include "qgis_sip.h" | ||
|
||
#include "ui_qgsannotationcommonpropertieswidgetbase.h" | ||
|
||
class QgsAnnotationItem; | ||
|
||
/** | ||
* \class QgsAnnotationItemCommonPropertiesWidget | ||
* \ingroup gui | ||
* | ||
* \brief A widget for configuring common properties for QgsAnnotationItems | ||
* | ||
* \since QGIS 3.22 | ||
*/ | ||
class GUI_EXPORT QgsAnnotationItemCommonPropertiesWidget: public QWidget, private Ui::QgsAnnotationCommonPropertiesWidgetBase | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsAnnotationItemCommonPropertiesWidget. | ||
*/ | ||
QgsAnnotationItemCommonPropertiesWidget( QWidget *parent SIP_TRANSFERTHIS ); | ||
|
||
/** | ||
* Sets the \a item whose properties should be shown in the widget. | ||
*/ | ||
void setItem( QgsAnnotationItem *item ); | ||
|
||
/** | ||
* Updates an \a item, setting the properties defined in the widget. | ||
*/ | ||
void updateItem( QgsAnnotationItem *item ); | ||
|
||
signals: | ||
|
||
/** | ||
* Emitted when the annotation item definition in the widget is changed by the user. | ||
*/ | ||
void itemChanged(); | ||
|
||
private: | ||
|
||
bool mBlockChangedSignal = false; | ||
|
||
}; | ||
|
||
#endif // QGSANNOTATIONITEMCOMMONPROPERTIESWIDGET_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/ui/annotations/qgsannotationcommonpropertieswidgetbase.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsAnnotationCommonPropertiesWidgetBase</class> | ||
<widget class="QWidget" name="QgsAnnotationCommonPropertiesWidgetBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>321</width> | ||
<height>325</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Annotation Properties</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item row="0" column="0"> | ||
<widget class="QGroupBox" name="mReferenceScaleGroup"> | ||
<property name="title"> | ||
<string>Reference Scale</string> | ||
</property> | ||
<property name="checkable"> | ||
<bool>true</bool> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QgsScaleWidget" name="mReferenceScaleWidget" native="true"> | ||
<property name="focusPolicy"> | ||
<enum>Qt::StrongFocus</enum> | ||
</property> | ||
<property name="toolTip"> | ||
<string>Minimum scale, i.e. most "zoomed out".</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QGroupBox" name="groupBox"> | ||
<property name="title"> | ||
<string>Rendering</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,2"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Z-index</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QgsSpinBox" name="mSpinZIndex"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>QgsScaleWidget</class> | ||
<extends>QWidget</extends> | ||
<header>qgsscalewidget.h</header> | ||
</customwidget> | ||
<customwidget> | ||
<class>QgsSpinBox</class> | ||
<extends>QSpinBox</extends> | ||
<header>qgsspinbox.h</header> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters