Skip to content
Permalink
Browse files

Add QgsTextFormatPanelWidget for text format control inside panel

  • Loading branch information
nyalldawson committed Oct 24, 2016
1 parent 8fa8167 commit f6a344c2c159aa98f5d6d87eb84749d6b15e693c
Showing with 86 additions and 0 deletions.
  1. +33 −0 python/gui/qgstextformatwidget.sip
  2. +18 −0 src/gui/qgstextformatwidget.cpp
  3. +35 −0 src/gui/qgstextformatwidget.h
@@ -119,3 +119,36 @@ class QgsTextFormatDialog : QDialog
*/
QgsTextFormat format() const;
};

/** \class QgsTextFormatPanelWidget
* \ingroup gui
* A panel widget for customising text formatting settings.
*
* QgsTextFormatPanelWidget provides a panel widget for controlling the appearance of text rendered
* using QgsTextRenderer. The dialog includes all settings contained within
* a QgsTextFormat, including shadow, background and buffer.
*
* @note Added in QGIS 3.0
*/

class QgsTextFormatPanelWidget : QgsPanelWidgetWrapper
{
%TypeHeaderCode
#include <qgstextformatwidget.h>
%End
public:

/** Constructor for QgsTextFormatPanelWidget.
* @param format initial format settings to show in dialog
* @param mapCanvas optional associated map canvas
* @param parent parent widget
*/
QgsTextFormatPanelWidget( const QgsTextFormat& format, QgsMapCanvas* mapCanvas = nullptr, QWidget* parent /TransferThis/ = nullptr );

/** Returns the current formatting settings defined by the widget.
*/
QgsTextFormat format() const;

virtual void setDockMode( bool dockMode );

};
@@ -1413,3 +1413,21 @@ QgsTextFormat QgsTextFormatDialog::format() const
{
return mFormatWidget->format();
}

QgsTextFormatPanelWidget::QgsTextFormatPanelWidget( const QgsTextFormat& format, QgsMapCanvas* mapCanvas, QWidget* parent )
: QgsPanelWidgetWrapper( new QgsTextFormatWidget( format, mapCanvas ), parent )
{
mFormatWidget = qobject_cast< QgsTextFormatWidget* >( widget() );
connect( mFormatWidget, SIGNAL( widgetChanged() ), this, SIGNAL( widgetChanged() ) );
}

QgsTextFormat QgsTextFormatPanelWidget::format() const
{
return mFormatWidget->format();
}

void QgsTextFormatPanelWidget::setDockMode( bool dockMode )
{
mFormatWidget->setDockMode( dockMode );
QgsPanelWidgetWrapper::setDockMode( dockMode );
}
@@ -231,6 +231,41 @@ class GUI_EXPORT QgsTextFormatDialog : public QDialog
QgsTextFormatWidget* mFormatWidget;
};

/** \class QgsTextFormatPanelWidget
* \ingroup gui
* A panel widget for customising text formatting settings.
*
* QgsTextFormatPanelWidget provides a panel widget for controlling the appearance of text rendered
* using QgsTextRenderer. The dialog includes all settings contained within
* a QgsTextFormat, including shadow, background and buffer.
*
* @note Added in QGIS 3.0
*/

class GUI_EXPORT QgsTextFormatPanelWidget : public QgsPanelWidgetWrapper
{
Q_OBJECT

public:

/** Constructor for QgsTextFormatPanelWidget.
* @param format initial format settings to show in dialog
* @param mapCanvas optional associated map canvas
* @param parent parent widget
*/
QgsTextFormatPanelWidget( const QgsTextFormat& format, QgsMapCanvas* mapCanvas = nullptr, QWidget* parent = nullptr );

/** Returns the current formatting settings defined by the widget.
*/
QgsTextFormat format() const;

virtual void setDockMode( bool dockMode ) override;

private:

QgsTextFormatWidget* mFormatWidget;
};

#endif //QGSTEXTFORMATWIDGET_H


0 comments on commit f6a344c

Please sign in to comment.
You can’t perform that action at this time.