mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Split QgsLabelingGui off into QgsTextFormatWidget
New widget allows for setting just the formatting properties of text
This commit is contained in:
parent
169b367c5b
commit
76c12ba94c
@ -156,11 +156,13 @@
|
||||
%Include qgsslider.sip
|
||||
%Include qgssourceselectdialog.sip
|
||||
%Include qgssublayersdialog.sip
|
||||
%Include qgssubstitutionlistwidget.sip
|
||||
%Include qgssvgannotationitem.sip
|
||||
%Include qgstablewidgetbase.sip
|
||||
%Include qgstabwidget.sip
|
||||
%Include qgstablewidgetitem.sip
|
||||
%Include qgstextannotationitem.sip
|
||||
%Include qgstextformatwidget.sip
|
||||
%Include qgstextpreview.sip
|
||||
%Include qgstrackedvectorlayertools.sip
|
||||
%Include qgstreewidgetitem.sip
|
||||
|
73
python/gui/qgssubstitutionlistwidget.sip
Normal file
73
python/gui/qgssubstitutionlistwidget.sip
Normal file
@ -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;
|
||||
|
||||
};
|
88
python/gui/qgstextformatwidget.sip
Normal file
88
python/gui/qgstextformatwidget.sip
Normal file
@ -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();
|
||||
};
|
@ -116,7 +116,6 @@ SET(QGIS_APP_SRCS
|
||||
qgsrelationadddlg.cpp
|
||||
qgsselectbyformdialog.cpp
|
||||
qgsstatisticalsummarydockwidget.cpp
|
||||
qgssubstitutionlistwidget.cpp
|
||||
qgstextannotationdialog.cpp
|
||||
qgssvgannotationdialog.cpp
|
||||
qgsundowidget.cpp
|
||||
@ -293,7 +292,6 @@ SET (QGIS_APP_MOC_HDRS
|
||||
qgsselectbyformdialog.h
|
||||
qgssponsors.h
|
||||
qgsstatisticalsummarydockwidget.h
|
||||
qgssubstitutionlistwidget.h
|
||||
qgssvgannotationdialog.h
|
||||
qgstextannotationdialog.h
|
||||
qgstipgui.h
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,26 +15,18 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QgsLabelingGUI_H
|
||||
#define QgsLabelingGUI_H
|
||||
#ifndef QGSLABELINGGUI_H
|
||||
#define QGSLABELINGGUI_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFontDatabase>
|
||||
#include <ui_qgslabelingguibase.h>
|
||||
#include "qgsstringutils.h"
|
||||
#include "qgspallabeling.h"
|
||||
#include "qgstextformatwidget.h"
|
||||
|
||||
class QgsVectorLayer;
|
||||
class QgsMapCanvas;
|
||||
class QgsCharacterSelectorDialog;
|
||||
|
||||
class APP_EXPORT QgsLabelingGui : public QWidget, private Ui::QgsLabelingGuiBase, private QgsExpressionContextGenerator
|
||||
class APP_EXPORT QgsLabelingGui : public QgsTextFormatWidget, private QgsExpressionContextGenerator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsPalLayerSettings* settings, QWidget* parent );
|
||||
~QgsLabelingGui();
|
||||
|
||||
QgsPalLayerSettings layerSettings();
|
||||
void writeSettingsToLayer();
|
||||
@ -48,111 +40,30 @@ class APP_EXPORT QgsLabelingGui : public QWidget, private Ui::QgsLabelingGuiBase
|
||||
|
||||
void setLabelMode( LabelMode mode );
|
||||
|
||||
signals:
|
||||
void widgetChanged();
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
|
||||
public slots:
|
||||
void setLayer( QgsMapLayer* layer );
|
||||
void setDockMode( bool enabled );
|
||||
void connectValueChanged( const QList<QWidget *> &widgets, const char* slot );
|
||||
|
||||
void init();
|
||||
void collapseSample( bool collapse );
|
||||
void apply();
|
||||
void changeTextColor( const QColor &color );
|
||||
void changeBufferColor( const QColor &color );
|
||||
|
||||
void updateUi();
|
||||
void updatePreview();
|
||||
void scrollPreview();
|
||||
void updatePlacementWidgets();
|
||||
void updateSvgWidgets( const QString& svgPath );
|
||||
|
||||
void on_mFontSizeSpinBox_valueChanged( double d );
|
||||
void on_mFontCapitalsComboBox_currentIndexChanged( int index );
|
||||
void on_mFontFamilyCmbBx_currentFontChanged( const QFont& f );
|
||||
void on_mFontStyleComboBox_currentIndexChanged( const QString & text );
|
||||
void on_mFontUnderlineBtn_toggled( bool ckd );
|
||||
void on_mFontStrikethroughBtn_toggled( bool ckd );
|
||||
void on_mFontWordSpacingSpinBox_valueChanged( double spacing );
|
||||
void on_mFontLetterSpacingSpinBox_valueChanged( double spacing );
|
||||
void on_mFontSizeUnitWidget_changed();
|
||||
void on_mFontMinPixelSpinBox_valueChanged( int px );
|
||||
void on_mFontMaxPixelSpinBox_valueChanged( int px );
|
||||
void on_mBufferUnitWidget_changed();
|
||||
void on_mCoordXDDBtn_dataDefinedActivated( bool active );
|
||||
void on_mCoordYDDBtn_dataDefinedActivated( bool active );
|
||||
|
||||
void on_mShapeTypeCmbBx_currentIndexChanged( int index );
|
||||
void on_mShapeRotationCmbBx_currentIndexChanged( int index );
|
||||
void on_mShapeSVGParamsBtn_clicked();
|
||||
void on_mShapeSVGSelectorBtn_clicked();
|
||||
|
||||
void on_mPreviewTextEdit_textChanged( const QString & text );
|
||||
void on_mPreviewTextBtn_clicked();
|
||||
void on_mPreviewBackgroundBtn_colorChanged( const QColor &color );
|
||||
void on_mDirectSymbLeftToolBtn_clicked();
|
||||
void on_mDirectSymbRightToolBtn_clicked();
|
||||
void on_mChkNoObstacle_toggled( bool active );
|
||||
void on_chkLineOrientationDependent_toggled( bool active );
|
||||
|
||||
void on_mToolButtonConfigureSubstitutes_clicked();
|
||||
|
||||
protected:
|
||||
void blockInitSignals( bool block );
|
||||
void blockFontChangeSignals( bool blk );
|
||||
void setPreviewBackground( const QColor& color );
|
||||
void syncDefinedCheckboxFrame( QgsDataDefinedButton* ddBtn, QCheckBox* chkBx, QFrame* f );
|
||||
void populateFontCapitalsComboBox();
|
||||
void populateFontStyleComboBox();
|
||||
void populatePlacementMethods();
|
||||
void populateFieldNames();
|
||||
void populateDataDefinedButtons( QgsPalLayerSettings& s );
|
||||
/** Sets data defined property attribute to map */
|
||||
void setDataDefinedProperty( const QgsDataDefinedButton* ddBtn, QgsPalLayerSettings::DataDefinedProperties p, QgsPalLayerSettings& lyr );
|
||||
void updateFont( const QFont& font );
|
||||
|
||||
private:
|
||||
QgsVectorLayer* mLayer;
|
||||
QgsMapCanvas* mMapCanvas;
|
||||
const QgsPalLayerSettings* mSettings;
|
||||
LabelMode mMode;
|
||||
QFontDatabase mFontDB;
|
||||
QgsCharacterSelectorDialog* mCharDlg;
|
||||
|
||||
QButtonGroup* mQuadrantBtnGrp;
|
||||
QButtonGroup* mDirectSymbBtnGrp;
|
||||
QButtonGroup* mUpsidedownBtnGrp;
|
||||
|
||||
QButtonGroup* mPlacePointBtnGrp;
|
||||
QButtonGroup* mPlaceLineBtnGrp;
|
||||
QButtonGroup* mPlacePolygonBtnGrp;
|
||||
|
||||
// background reference font
|
||||
QFont mRefFont;
|
||||
bool mDockMode;
|
||||
int mPreviewSize;
|
||||
|
||||
int mMinPixelLimit;
|
||||
|
||||
bool mLoadSvgParams;
|
||||
|
||||
QgsStringReplacementCollection mSubstitutions;
|
||||
|
||||
void enableDataDefinedAlignment( bool enable );
|
||||
|
||||
QgsExpressionContext createExpressionContext() const override;
|
||||
|
||||
private slots:
|
||||
void optionsStackedWidget_CurrentChanged( int indx );
|
||||
void showBackgroundRadius( bool show );
|
||||
void showBackgroundPenStyle( bool show );
|
||||
void on_mShapeSVGPathLineEdit_textChanged( const QString& text );
|
||||
void updateLinePlacementOptions();
|
||||
void onSubstitutionsChanged( const QgsStringReplacementCollection& substitutions );
|
||||
void previewScaleChanged( double scale );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // QGSLABELINGGUI_H
|
||||
|
||||
|
||||
|
@ -302,12 +302,14 @@ SET(QGIS_GUI_SRCS
|
||||
qgsshortcutsmanager.cpp
|
||||
qgsslider.cpp
|
||||
qgssublayersdialog.cpp
|
||||
qgssubstitutionlistwidget.cpp
|
||||
qgssqlcomposerdialog.cpp
|
||||
qgssvgannotationitem.cpp
|
||||
qgstablewidgetbase.cpp
|
||||
qgstabwidget.cpp
|
||||
qgstablewidgetitem.cpp
|
||||
qgstextannotationitem.cpp
|
||||
qgstextformatwidget.cpp
|
||||
qgstextpreview.cpp
|
||||
qgstrackedvectorlayertools.cpp
|
||||
qgstreewidgetitem.cpp
|
||||
@ -460,8 +462,10 @@ SET(QGIS_GUI_MOC_HDRS
|
||||
qgsslider.h
|
||||
qgssqlcomposerdialog.h
|
||||
qgssublayersdialog.h
|
||||
qgssubstitutionlistwidget.h
|
||||
qgstablewidgetbase.h
|
||||
qgstabwidget.h
|
||||
qgstextformatwidget.h
|
||||
qgstextpreview.h
|
||||
qgstreewidgetitem.h
|
||||
qgsunitselectionwidget.h
|
||||
|
@ -24,13 +24,13 @@
|
||||
#include "qgsstringutils.h"
|
||||
|
||||
/** \class QgsSubstitutionListWidget
|
||||
* \ingroup app
|
||||
* \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 APP_EXPORT QgsSubstitutionListWidget : public QgsPanelWidget, private Ui::QgsSubstitutionListWidgetBase
|
||||
class GUI_EXPORT QgsSubstitutionListWidget : public QgsPanelWidget, private Ui::QgsSubstitutionListWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( QgsStringReplacementCollection substitutions READ substitutions WRITE setSubstitutions NOTIFY substitutionsChanged )
|
||||
@ -73,12 +73,13 @@ class APP_EXPORT QgsSubstitutionListWidget : public QgsPanelWidget, private Ui::
|
||||
};
|
||||
|
||||
/** \class QgsSubstitutionListDialog
|
||||
* \ingroup app
|
||||
* \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.
|
||||
* \note added in QGIS 3.0
|
||||
* \see QgsSubstitutionListWidget
|
||||
*/
|
||||
class APP_EXPORT QgsSubstitutionListDialog : public QDialog
|
||||
class GUI_EXPORT QgsSubstitutionListDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( QgsStringReplacementCollection substitutions READ substitutions WRITE setSubstitutions )
|
1378
src/gui/qgstextformatwidget.cpp
Normal file
1378
src/gui/qgstextformatwidget.cpp
Normal file
File diff suppressed because it is too large
Load Diff
198
src/gui/qgstextformatwidget.h
Normal file
198
src/gui/qgstextformatwidget.h
Normal file
@ -0,0 +1,198 @@
|
||||
/***************************************************************************
|
||||
qgstextformatwidget.h
|
||||
---------------------
|
||||
begin : June 2009
|
||||
copyright : (C) Martin Dobias
|
||||
email : wonder dot sk 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 QGSTEXTFORMATWIDGET_H
|
||||
#define QGSTEXTFORMATWIDGET_H
|
||||
|
||||
#include <ui_qgstextformatwidgetbase.h>
|
||||
#include "qgstextrenderer.h"
|
||||
#include "qgsstringutils.h"
|
||||
#include <QFontDatabase>
|
||||
|
||||
class QgsMapCanvas;
|
||||
class QgsCharacterSelectorDialog;
|
||||
|
||||
|
||||
/** \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 GUI_EXPORT QgsTextFormatWidget : public QWidget, protected Ui::QgsTextFormatWidgetBase
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( QgsTextFormat format READ format )
|
||||
|
||||
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 = 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 = 0, //!< 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, 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 );
|
||||
|
||||
//! Text substitution list
|
||||
QgsStringReplacementCollection mSubstitutions;
|
||||
//! Quadrant button group
|
||||
QButtonGroup* mQuadrantBtnGrp;
|
||||
//! Symbol direction button group
|
||||
QButtonGroup* mDirectSymbBtnGrp;
|
||||
//! Upside down labels button group
|
||||
QButtonGroup* mUpsidedownBtnGrp;
|
||||
//! Point placement button group
|
||||
QButtonGroup* mPlacePointBtnGrp;
|
||||
//! Line placement button group
|
||||
QButtonGroup* mPlaceLineBtnGrp;
|
||||
//! Polygon placement button group
|
||||
QButtonGroup* mPlacePolygonBtnGrp;
|
||||
//! Pixel size font limit
|
||||
int mMinPixelLimit;
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
Mode mWidgetMode;
|
||||
QgsMapCanvas* mMapCanvas;
|
||||
QgsCharacterSelectorDialog* mCharDlg;
|
||||
|
||||
QFontDatabase mFontDB;
|
||||
|
||||
// background reference font
|
||||
QFont mRefFont;
|
||||
bool mDockMode;
|
||||
|
||||
bool mLoadSvgParams;
|
||||
|
||||
void initWidget();
|
||||
void setWidgetMode( Mode mode );
|
||||
void toggleDDButtons( bool visible );
|
||||
void blockFontChangeSignals( bool blk );
|
||||
void populateFontCapitalsComboBox();
|
||||
void populateFontStyleComboBox();
|
||||
void updateFont( const QFont& font );
|
||||
void connectValueChanged( const QList<QWidget *> &widgets, const char* slot );
|
||||
|
||||
private slots:
|
||||
void optionsStackedWidget_CurrentChanged( int indx );
|
||||
void showBackgroundRadius( bool show );
|
||||
void showBackgroundPenStyle( bool show );
|
||||
void on_mShapeSVGPathLineEdit_textChanged( const QString& text );
|
||||
void onSubstitutionsChanged( const QgsStringReplacementCollection& substitutions );
|
||||
void previewScaleChanged( double scale );
|
||||
void on_mFontSizeSpinBox_valueChanged( double d );
|
||||
void on_mFontCapitalsComboBox_currentIndexChanged( int index );
|
||||
void on_mFontFamilyCmbBx_currentFontChanged( const QFont& f );
|
||||
void on_mFontStyleComboBox_currentIndexChanged( const QString & text );
|
||||
void on_mFontUnderlineBtn_toggled( bool ckd );
|
||||
void on_mFontStrikethroughBtn_toggled( bool ckd );
|
||||
void on_mFontWordSpacingSpinBox_valueChanged( double spacing );
|
||||
void on_mFontLetterSpacingSpinBox_valueChanged( double spacing );
|
||||
void on_mFontSizeUnitWidget_changed();
|
||||
void on_mFontMinPixelSpinBox_valueChanged( int px );
|
||||
void on_mFontMaxPixelSpinBox_valueChanged( int px );
|
||||
void on_mBufferUnitWidget_changed();
|
||||
void on_mCoordXDDBtn_dataDefinedActivated( bool active );
|
||||
void on_mCoordYDDBtn_dataDefinedActivated( bool active );
|
||||
void on_mShapeTypeCmbBx_currentIndexChanged( int index );
|
||||
void on_mShapeRotationCmbBx_currentIndexChanged( int index );
|
||||
void on_mShapeSVGParamsBtn_clicked();
|
||||
void on_mShapeSVGSelectorBtn_clicked();
|
||||
void on_mPreviewTextEdit_textChanged( const QString & text );
|
||||
void on_mPreviewTextBtn_clicked();
|
||||
void on_mPreviewBackgroundBtn_colorChanged( const QColor &color );
|
||||
void on_mDirectSymbLeftToolBtn_clicked();
|
||||
void on_mDirectSymbRightToolBtn_clicked();
|
||||
void on_mChkNoObstacle_toggled( bool active );
|
||||
void on_chkLineOrientationDependent_toggled( bool active );
|
||||
void on_mToolButtonConfigureSubstitutes_clicked();
|
||||
void collapseSample( bool collapse );
|
||||
void changeTextColor( const QColor &color );
|
||||
void changeBufferColor( const QColor &color );
|
||||
void updatePreview();
|
||||
void scrollPreview();
|
||||
void updateSvgWidgets( const QString& svgPath );
|
||||
};
|
||||
|
||||
#endif //QGSTEXTFORMATWIDGET_H
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsLabelingGuiBase</class>
|
||||
<widget class="QWidget" name="QgsLabelingGuiBase">
|
||||
<class>QgsTextFormatWidgetBase</class>
|
||||
<widget class="QWidget" name="QgsTextFormatWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -29,7 +29,7 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="6" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QFrame" name="mLabelingFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -335,7 +335,7 @@
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
@ -664,86 +664,6 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="mFontStyleComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Available typeface styles</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="mFontLetterSpacingLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>letter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDoubleSpinBox" name="mFontLetterSpacingSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Space in pixels or map units, relative to size unit choice</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDataDefinedButton" name="mFontLetterSpacingDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mFontLabel_2">
|
||||
<property name="sizePolicy">
|
||||
@ -760,6 +680,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QgsColorButton" name="btnTextColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="mFontCapitalsLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type case</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="mFontTranspLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Transparency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="mFontColorLabel">
|
||||
<property name="sizePolicy">
|
||||
@ -776,102 +741,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontColorDDBtn">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="mFontWordSpacingLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>word</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDoubleSpinBox" name="mFontWordSpacingSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Space in pixels or map units, relative to size unit choice</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDataDefinedButton" name="mFontWordSpacingDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="mFontSizeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontSizeDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontUnitsDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontBlendModeDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QgsUnitSelectionWidget" name="mFontSizeUnitWidget" native="true"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QgsDoubleSpinBox" name="mFontSizeSpinBox">
|
||||
<property name="sizePolicy">
|
||||
@ -897,186 +773,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Spacing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mFontLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontTranspDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QgsColorButton" name="btnTextColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QgsBlendModeComboBox" name="comboBlendMode"/>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="mCheckBoxSubstituteText">
|
||||
<property name="toolTip">
|
||||
<string>If enabled, the label text will automatically be modified using a preset list of substitutes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply label text substitutes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFontComboBox" name="mFontFamilyCmbBx">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="mFontCapitalsComboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Capitalization style of text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<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>
|
||||
<widget class="QSlider" name="mFontTranspSlider">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsSpinBox" name="mFontTranspSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> %</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="mFontTranspLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Transparency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontStyleDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QToolButton" name="mFontUnderlineBtn">
|
||||
@ -1249,33 +946,33 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDataDefinedButton" name="mFontItalicDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontCaseDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="mFontStyleComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="labelBlendMode">
|
||||
<property name="text">
|
||||
<string>Blend mode</string>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Available typeface styles</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1317,8 +1014,129 @@ font-style: italic;</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="mFontCapitalsLabel">
|
||||
<item row="13" column="1">
|
||||
<widget class="QgsBlendModeComboBox" name="comboBlendMode"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mFontLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontStyleDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontSizeDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontBlendModeDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontItalicDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontColorDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontLetterSpacingDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QgsUnitSelectionWidget" name="mFontSizeUnitWidget" native="true"/>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontCaseDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFontComboBox" name="mFontFamilyCmbBx">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontUnitsDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="labelBlendMode">
|
||||
<property name="text">
|
||||
<string>Blend mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="mFontCapitalsComboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Capitalization style of text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="mFontSizeLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -1326,7 +1144,14 @@ font-style: italic;</string>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type case</string>
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontTranspDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1343,19 +1168,221 @@ font-style: italic;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2">
|
||||
<widget class="QToolButton" name="mToolButtonConfigureSubstitutes">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Configure substitutes</string>
|
||||
<item row="8" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_23">
|
||||
<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>
|
||||
<widget class="QSlider" name="mFontTranspSlider">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsSpinBox" name="mFontTranspSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> %</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QgsDataDefinedButton" name="mFontWordSpacingDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<widget class="QLabel" name="mFontWordSpacingLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>word</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDoubleSpinBox" name="mFontWordSpacingSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Space in pixels or map units, relative to size unit choice</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<item>
|
||||
<widget class="QLabel" name="mFontLetterSpacingLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>letter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDoubleSpinBox" name="mFontLetterSpacingSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Space in pixels or map units, relative to size unit choice</string>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="3">
|
||||
<widget class="QFrame" name="mSubstitutionsFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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>
|
||||
<widget class="QCheckBox" name="mCheckBoxSubstituteText">
|
||||
<property name="toolTip">
|
||||
<string>If enabled, the label text will automatically be modified using a preset list of substitutes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply label text substitutes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="mToolButtonConfigureSubstitutes">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Configure substitutes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -6292,9 +6319,9 @@ font-style: italic;</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frameLabelWith">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_19">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -6412,6 +6439,12 @@ font-style: italic;</string>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgsscalewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>scrollArea_mPreview</tabstop>
|
||||
@ -6431,7 +6464,6 @@ font-style: italic;</string>
|
||||
<tabstop>mFontBoldBtn</tabstop>
|
||||
<tabstop>mFontBoldDDBtn</tabstop>
|
||||
<tabstop>mFontItalicBtn</tabstop>
|
||||
<tabstop>mFontItalicDDBtn</tabstop>
|
||||
<tabstop>mFontSizeSpinBox</tabstop>
|
||||
<tabstop>mFontSizeDDBtn</tabstop>
|
||||
<tabstop>mFontUnitsDDBtn</tabstop>
|
||||
@ -6443,9 +6475,7 @@ font-style: italic;</string>
|
||||
<tabstop>mFontCapitalsComboBox</tabstop>
|
||||
<tabstop>mFontCaseDDBtn</tabstop>
|
||||
<tabstop>mFontLetterSpacingSpinBox</tabstop>
|
||||
<tabstop>mFontLetterSpacingDDBtn</tabstop>
|
||||
<tabstop>mFontWordSpacingSpinBox</tabstop>
|
||||
<tabstop>mFontWordSpacingDDBtn</tabstop>
|
||||
<tabstop>comboBlendMode</tabstop>
|
||||
<tabstop>mFontBlendModeDDBtn</tabstop>
|
||||
<tabstop>scrollArea_5</tabstop>
|
@ -104,6 +104,7 @@ ADD_PYTHON_TEST(PyQgsSyntacticSugar test_syntactic_sugar.py)
|
||||
ADD_PYTHON_TEST(PyQgsStringUtils test_qgsstringutils.py)
|
||||
ADD_PYTHON_TEST(PyQgsSymbol test_qgssymbol.py)
|
||||
ADD_PYTHON_TEST(PyQgsSymbolLayerUtils test_qgssymbollayerutils.py)
|
||||
ADD_PYTHON_TEST(PyQgsTextFormatWidget test_qgstextformatwidget.py)
|
||||
ADD_PYTHON_TEST(PyQgsTreeWidgetItem test_qgstreewidgetitem.py)
|
||||
ADD_PYTHON_TEST(PyQgsUnitTypes test_qgsunittypes.py)
|
||||
ADD_PYTHON_TEST(PyQgsVectorColorRamp test_qgsvectorcolorramp.py)
|
||||
|
189
tests/src/python/test_qgstextformatwidget.py
Normal file
189
tests/src/python/test_qgstextformatwidget.py
Normal file
@ -0,0 +1,189 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""QGIS Unit tests for QgsTextFormatWidget.
|
||||
|
||||
.. note:: 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.
|
||||
"""
|
||||
__author__ = 'Nyall Dawson'
|
||||
__date__ = '2016-09'
|
||||
__copyright__ = 'Copyright 2016, The QGIS Project'
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
import qgis # NOQA
|
||||
import os
|
||||
|
||||
from qgis.core import (QgsTextBufferSettings,
|
||||
QgsTextBackgroundSettings,
|
||||
QgsTextShadowSettings,
|
||||
QgsTextFormat,
|
||||
QgsUnitTypes,
|
||||
QgsMapUnitScale)
|
||||
from qgis.gui import (QgsTextFormatWidget)
|
||||
from qgis.PyQt.QtGui import (QColor, QPainter, QFont, QImage, QBrush, QPen)
|
||||
from qgis.PyQt.QtCore import (Qt, QSizeF, QPointF, QRectF, QDir)
|
||||
from qgis.testing import unittest, start_app
|
||||
from utilities import getTestFont, svgSymbolsPath
|
||||
|
||||
start_app()
|
||||
|
||||
|
||||
class PyQgsTextFormatWidget(unittest.TestCase):
|
||||
|
||||
def createBufferSettings(self):
|
||||
s = QgsTextBufferSettings()
|
||||
s.setEnabled(True)
|
||||
s.setSize(5)
|
||||
s.setSizeUnit(QgsUnitTypes.RenderPixels)
|
||||
s.setSizeMapUnitScale(QgsMapUnitScale(1, 2))
|
||||
s.setColor(QColor(255, 0, 0))
|
||||
s.setFillBufferInterior(True)
|
||||
s.setOpacity(0.5)
|
||||
s.setJoinStyle(Qt.RoundJoin)
|
||||
s.setBlendMode(QPainter.CompositionMode_Difference)
|
||||
return s
|
||||
|
||||
def checkBufferSettings(self, s):
|
||||
""" test QgsTextBufferSettings """
|
||||
self.assertTrue(s.enabled())
|
||||
self.assertEqual(s.size(), 5)
|
||||
self.assertEqual(s.sizeUnit(), QgsUnitTypes.RenderPixels)
|
||||
self.assertEqual(s.sizeMapUnitScale(), QgsMapUnitScale(1, 2))
|
||||
self.assertEqual(s.color(), QColor(255, 0, 0))
|
||||
self.assertTrue(s.fillBufferInterior())
|
||||
self.assertEqual(s.opacity(), 0.5)
|
||||
self.assertEqual(s.joinStyle(), Qt.RoundJoin)
|
||||
self.assertEqual(s.blendMode(), QPainter.CompositionMode_Difference)
|
||||
|
||||
def createBackgroundSettings(self):
|
||||
s = QgsTextBackgroundSettings()
|
||||
s.setEnabled(True)
|
||||
s.setType(QgsTextBackgroundSettings.ShapeEllipse)
|
||||
s.setSvgFile('svg.svg')
|
||||
s.setSizeType(QgsTextBackgroundSettings.SizeFixed)
|
||||
s.setSize(QSizeF(1, 2))
|
||||
s.setSizeUnit(QgsUnitTypes.RenderPixels)
|
||||
s.setSizeMapUnitScale(QgsMapUnitScale(1, 2))
|
||||
s.setRotationType(QgsTextBackgroundSettings.RotationFixed)
|
||||
s.setRotation(45)
|
||||
s.setOffset(QPointF(3, 4))
|
||||
s.setOffsetUnit(QgsUnitTypes.RenderMapUnits)
|
||||
s.setOffsetMapUnitScale(QgsMapUnitScale(5, 6))
|
||||
s.setRadii(QSizeF(11, 12))
|
||||
s.setRadiiUnit(QgsUnitTypes.RenderPixels)
|
||||
s.setRadiiMapUnitScale(QgsMapUnitScale(15, 16))
|
||||
s.setFillColor(QColor(255, 0, 0))
|
||||
s.setBorderColor(QColor(0, 255, 0))
|
||||
s.setOpacity(0.5)
|
||||
s.setJoinStyle(Qt.RoundJoin)
|
||||
s.setBlendMode(QPainter.CompositionMode_Difference)
|
||||
s.setBorderWidth(7)
|
||||
s.setBorderWidthUnit(QgsUnitTypes.RenderMapUnits)
|
||||
s.setBorderWidthMapUnitScale(QgsMapUnitScale(QgsMapUnitScale(25, 26)))
|
||||
return s
|
||||
|
||||
def checkBackgroundSettings(self, s):
|
||||
""" test QgsTextBackgroundSettings """
|
||||
self.assertTrue(s.enabled())
|
||||
self.assertEqual(s.type(), QgsTextBackgroundSettings.ShapeEllipse)
|
||||
self.assertEqual(s.svgFile(), 'svg.svg')
|
||||
self.assertEqual(s.sizeType(), QgsTextBackgroundSettings.SizeFixed)
|
||||
self.assertEqual(s.size(), QSizeF(1, 2))
|
||||
self.assertEqual(s.sizeUnit(), QgsUnitTypes.RenderPixels)
|
||||
self.assertEqual(s.sizeMapUnitScale(), QgsMapUnitScale(1, 2))
|
||||
self.assertEqual(s.rotationType(), QgsTextBackgroundSettings.RotationFixed)
|
||||
self.assertEqual(s.rotation(), 45)
|
||||
self.assertEqual(s.offset(), QPointF(3, 4))
|
||||
self.assertEqual(s.offsetUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(s.offsetMapUnitScale(), QgsMapUnitScale(5, 6))
|
||||
self.assertEqual(s.radii(), QSizeF(11, 12))
|
||||
self.assertEqual(s.radiiUnit(), QgsUnitTypes.RenderPixels)
|
||||
self.assertEqual(s.radiiMapUnitScale(), QgsMapUnitScale(15, 16))
|
||||
self.assertEqual(s.fillColor(), QColor(255, 0, 0))
|
||||
self.assertEqual(s.borderColor(), QColor(0, 255, 0))
|
||||
self.assertEqual(s.opacity(), 0.5)
|
||||
self.assertEqual(s.joinStyle(), Qt.RoundJoin)
|
||||
self.assertEqual(s.blendMode(), QPainter.CompositionMode_Difference)
|
||||
self.assertEqual(s.borderWidth(), 7)
|
||||
self.assertEqual(s.borderWidthUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(s.borderWidthMapUnitScale(), QgsMapUnitScale(25, 26))
|
||||
|
||||
def createShadowSettings(self):
|
||||
s = QgsTextShadowSettings()
|
||||
s.setEnabled(True)
|
||||
s.setShadowPlacement(QgsTextShadowSettings.ShadowBuffer)
|
||||
s.setOffsetAngle(45)
|
||||
s.setOffsetDistance(75)
|
||||
s.setOffsetUnit(QgsUnitTypes.RenderMapUnits)
|
||||
s.setOffsetMapUnitScale(QgsMapUnitScale(5, 6))
|
||||
s.setOffsetGlobal(True)
|
||||
s.setBlurRadius(11)
|
||||
s.setBlurRadiusUnit(QgsUnitTypes.RenderMapUnits)
|
||||
s.setBlurRadiusMapUnitScale(QgsMapUnitScale(15, 16))
|
||||
s.setBlurAlphaOnly(True)
|
||||
s.setColor(QColor(255, 0, 0))
|
||||
s.setOpacity(0.5)
|
||||
s.setScale(123)
|
||||
s.setBlendMode(QPainter.CompositionMode_Difference)
|
||||
return s
|
||||
|
||||
def checkShadowSettings(self, s):
|
||||
""" test QgsTextShadowSettings """
|
||||
self.assertTrue(s.enabled())
|
||||
self.assertEqual(s.shadowPlacement(), QgsTextShadowSettings.ShadowBuffer)
|
||||
self.assertEqual(s.offsetAngle(), 45)
|
||||
self.assertEqual(s.offsetDistance(), 75)
|
||||
self.assertEqual(s.offsetUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(s.offsetMapUnitScale(), QgsMapUnitScale(5, 6))
|
||||
self.assertTrue(s.offsetGlobal())
|
||||
self.assertEqual(s.blurRadius(), 11)
|
||||
self.assertEqual(s.blurRadiusUnit(), QgsUnitTypes.RenderMapUnits)
|
||||
self.assertEqual(s.blurRadiusMapUnitScale(), QgsMapUnitScale(15, 16))
|
||||
self.assertTrue(s.blurAlphaOnly())
|
||||
self.assertEqual(s.color(), QColor(255, 0, 0))
|
||||
self.assertEqual(s.opacity(), 0.5)
|
||||
self.assertEqual(s.scale(), 123)
|
||||
self.assertEqual(s.blendMode(), QPainter.CompositionMode_Difference)
|
||||
|
||||
def createFormatSettings(self):
|
||||
s = QgsTextFormat()
|
||||
s.setBuffer(self.createBufferSettings())
|
||||
s.setBackground(self.createBackgroundSettings())
|
||||
s.setShadow(self.createShadowSettings())
|
||||
s.setFont(getTestFont())
|
||||
s.setNamedStyle('Roman')
|
||||
s.setSize(5)
|
||||
s.setSizeUnit(QgsUnitTypes.RenderPoints)
|
||||
s.setSizeMapUnitScale(QgsMapUnitScale(1, 2))
|
||||
s.setColor(QColor(255, 0, 0))
|
||||
s.setOpacity(0.5)
|
||||
s.setBlendMode(QPainter.CompositionMode_Difference)
|
||||
s.setLineHeight(5)
|
||||
return s
|
||||
|
||||
def checkTextFormat(self, s):
|
||||
""" test QgsTextFormat """
|
||||
self.checkBufferSettings(s.buffer())
|
||||
self.checkShadowSettings(s.shadow())
|
||||
self.checkBackgroundSettings(s.background())
|
||||
self.assertEqual(s.font().family(), 'QGIS Vera Sans')
|
||||
self.assertEqual(s.namedStyle(), 'Roman')
|
||||
self.assertEqual(s.size(), 5)
|
||||
self.assertEqual(s.sizeUnit(), QgsUnitTypes.RenderPoints)
|
||||
self.assertEqual(s.sizeMapUnitScale(), QgsMapUnitScale(1, 2))
|
||||
self.assertEqual(s.color(), QColor(255, 0, 0))
|
||||
self.assertEqual(s.opacity(), 0.5)
|
||||
self.assertEqual(s.blendMode(), QPainter.CompositionMode_Difference)
|
||||
self.assertEqual(s.lineHeight(), 5)
|
||||
|
||||
def testSettings(self):
|
||||
# test that widget correctly sets and returns matching settings
|
||||
s = self.createFormatSettings()
|
||||
w = QgsTextFormatWidget(s)
|
||||
self.checkTextFormat(w.format())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user