Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split QgsLabelingGui off into QgsTextFormatWidget
New widget allows for setting just the formatting properties of text
- Loading branch information
1 parent
169b367
commit 76c12ba
Showing
14 changed files
with
2,471 additions
and
1,896 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** \class QgsSubstitutionListWidget | ||
* \ingroup gui | ||
* A widget which allows users to specify a list of substitutions to apply to a string, with | ||
* options for exporting and importing substitution lists. | ||
* \note added in QGIS 3.0 | ||
* \see QgsSubstitutionListDialog | ||
*/ | ||
|
||
class QgsSubstitutionListWidget : public QgsPanelWidget | ||
{ | ||
%TypeHeaderCode | ||
#include <qgssubstitutionlistwidget.h> | ||
%End | ||
|
||
public: | ||
|
||
/** Constructor for QgsSubstitutionListWidget. | ||
* @param parent parent widget | ||
*/ | ||
QgsSubstitutionListWidget( QWidget* parent /TransferThis/ = nullptr ); | ||
|
||
/** Sets the list of substitutions to show in the widget. | ||
* @param substitutions substitution list | ||
* @see substitutions() | ||
*/ | ||
void setSubstitutions( const QgsStringReplacementCollection& substitutions ); | ||
|
||
/** Returns the list of substitutions currently defined by the widget. | ||
* @see setSubstitutions() | ||
*/ | ||
QgsStringReplacementCollection substitutions() const; | ||
|
||
signals: | ||
|
||
//! Emitted when the substitution definitions change. | ||
void substitutionsChanged( const QgsStringReplacementCollection& substitutions ); | ||
|
||
}; | ||
|
||
|
||
|
||
/** \class QgsSubstitutionListDialog | ||
* \ingroup gui | ||
* A dialog which allows users to specify a list of substitutions to apply to a string, with | ||
* options for exporting and importing substitution lists. | ||
* \see QgsSubstitutionListWidget | ||
*/ | ||
|
||
class QgsSubstitutionListDialog : public QDialog | ||
{ | ||
%TypeHeaderCode | ||
#include <qgssubstitutionlistwidget.h> | ||
%End | ||
|
||
public: | ||
|
||
/** Constructor for QgsSubstitutionListDialog. | ||
* @param parent parent widget | ||
*/ | ||
QgsSubstitutionListDialog( QWidget* parent /TransferThis/ = nullptr ); | ||
|
||
/** Sets the list of substitutions to show in the dialog. | ||
* @param substitutions substitution list | ||
* @see substitutions() | ||
*/ | ||
void setSubstitutions( const QgsStringReplacementCollection& substitutions ); | ||
|
||
/** Returns the list of substitutions currently defined by the dialog. | ||
* @see setSubstitutions() | ||
*/ | ||
QgsStringReplacementCollection substitutions() const; | ||
|
||
}; |
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,88 @@ | ||
/** \class QgsTextFormatWidget | ||
* \ingroup gui | ||
* A widget for customising text formatting settings. | ||
* | ||
* QgsTextFormatWidget provides a widget for controlling the appearance of text rendered | ||
* using QgsTextRenderer. The preview includes all settings contained within | ||
* a QgsTextFormat, including shadow, background and buffer. | ||
* | ||
* Additionally, the widget can handle labeling settings due to the large overlap between | ||
* the text renderer settings and the labeling settings. This mode is possible by | ||
* subclassing QgsTextFormatWidget and calling the protected constructor with a mode | ||
* of Labeling. | ||
* | ||
* @note Added in QGIS 3.0 | ||
*/ | ||
|
||
class QgsTextFormatWidget : public QgsPanelWidget | ||
{ | ||
%TypeHeaderCode | ||
#include <qgstextformatwidget.h> | ||
%End | ||
|
||
public: | ||
|
||
/** Constructor for QgsTextFormatWidget. | ||
* @param format initial formatting settings to show in widget | ||
* @param mapCanvas associated map canvas | ||
* @param parent parent widget | ||
*/ | ||
QgsTextFormatWidget( const QgsTextFormat& format = QgsTextFormat(), QgsMapCanvas* mapCanvas = nullptr, QWidget* parent /TransferThis/ = nullptr ); | ||
|
||
~QgsTextFormatWidget(); | ||
|
||
/** Returns the current formatting settings defined by the widget. | ||
*/ | ||
QgsTextFormat format() const; | ||
|
||
public slots: | ||
|
||
/** Sets whether the widget should be shown in a compact dock mode. | ||
* @param enabled set to true to show in dock mode. | ||
*/ | ||
void setDockMode( bool enabled ); | ||
|
||
signals: | ||
|
||
//! Emitted when the text format defined by the widget changes | ||
void widgetChanged(); | ||
|
||
protected: | ||
|
||
//! Widget mode | ||
enum Mode | ||
{ | ||
Text, //!< Default mode, show text formatting settings only | ||
Labeling, //!< Show labeling settings in addition to text formatting settings | ||
}; | ||
|
||
/** Constructor for QgsTextFormatWidget. | ||
* @param mapCanvas associated map canvas | ||
* @param parent parent widget | ||
* @param mode widget mode | ||
*/ | ||
QgsTextFormatWidget( QgsMapCanvas* mapCanvas, QWidget* parent /TransferThis/, Mode mode ); | ||
|
||
/** Updates the widget's state to reflect the settings in a QgsTextFormat. | ||
* @param format source format | ||
*/ | ||
void updateWidgetForFormat( const QgsTextFormat& format ); | ||
|
||
/** Sets the background color for the text preview widget. | ||
* @param color background color | ||
*/ | ||
void setPreviewBackground( const QColor& color ); | ||
|
||
/** Controls whether data defined alignment buttons are enabled. | ||
* @param enable set to true to enable alignment controls | ||
*/ | ||
void enableDataDefinedAlignment( bool enable ); | ||
|
||
protected slots: | ||
|
||
//! Updates line placement options to reflect current state of widget | ||
void updateLinePlacementOptions(); | ||
|
||
//! Updates label placement options to reflect current state of widget | ||
void updatePlacementWidgets(); | ||
}; |
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
Oops, something went wrong.