Skip to content

Commit 93a6115

Browse files
authoredMar 28, 2018
[needs-docs] Use QgsTextRender to power up copyright decoration styling (#6684)
- we gain all of the styling capabilities of our text renderer engine (i.e. what powers the rendering of labels) - HTML support is gone for now, with virtually all of styling possibilities covered by the above text renderer
1 parent 721095e commit 93a6115

8 files changed

+202
-143
lines changed
 

‎python/core/qgstextrenderer.sip.in

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,13 @@ and background shapes.
14951495
%End
14961496
public:
14971497

1498+
enum DrawMode
1499+
{
1500+
Rect,
1501+
Point,
1502+
Label,
1503+
};
1504+
14981505
enum TextPart
14991506
{
15001507
Text,
@@ -1594,6 +1601,29 @@ with the text or background parts)
15941601
:param drawAsOutlines: set to false to render text as text. This allows outputs to
15951602
formats like SVG to maintain text as text objects, but at the cost of degraded
15961603
rendering and may result in side effects like misaligned text buffers.
1604+
%End
1605+
1606+
static double textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines,
1607+
QFontMetricsF *fontMetrics = 0 );
1608+
%Docstring
1609+
Returns the width of a text based on a given format.
1610+
1611+
:param context: render context
1612+
:param format: text format
1613+
:param textLines: list of lines of text to calculate width from
1614+
:param fontMetrics: font metrics
1615+
%End
1616+
1617+
static double textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode,
1618+
QFontMetricsF *fontMetrics = 0 );
1619+
%Docstring
1620+
Returns the height of a text based on a given format.
1621+
1622+
:param context: render context
1623+
:param format: text format
1624+
:param textLines: list of lines of text to calculate width from
1625+
:param mode: draw mode
1626+
:param fontMetrics: font metrics
15971627
%End
15981628

15991629
};

‎src/app/qgsdecorationcopyright.cpp

Lines changed: 94 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ email : tim@linfiniti.com
3131
#include "qgslogger.h"
3232
#include "qgsmapcanvas.h"
3333
#include "qgsproject.h"
34+
#include "qgsreadwritecontext.h"
3435
#include "qgssymbollayerutils.h"
3536

3637
#include <QPainter>
3738
#include <QMenu>
3839
#include <QDate>
39-
#include <QTextDocument>
40+
#include <QDomDocument>
4041
#include <QMatrix>
4142
#include <QFile>
4243

@@ -59,25 +60,43 @@ void QgsDecorationCopyright::projectRead()
5960
{
6061
QgsDecorationItem::projectRead();
6162

62-
// there is no font setting in the UI, so just use the Qt/QGIS default font (what mQFont gets when created)
63-
// mQFont.setFamily( QgsProject::instance()->readEntry( "CopyrightLabel", "/FontName", "Sans Serif" ) );
64-
// mQFont.setPointSize( QgsProject::instance()->readNumEntry( "CopyrightLabel", "/FontSize", 9 ) );
65-
6663
mLabelText = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Label" ), QString() );
6764
mMarginHorizontal = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginH" ), 0 );
6865
mMarginVertical = QgsProject::instance()->readNumEntry( mNameConfig, QStringLiteral( "/MarginV" ), 0 );
69-
mColor = QgsSymbolLayerUtils::decodeColor( QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Color" ), QStringLiteral( "#000000" ) ) );
66+
67+
QDomDocument doc;
68+
QDomElement elem;
69+
QString textXml = QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Font" ) );
70+
if ( !textXml.isEmpty() )
71+
{
72+
doc.setContent( textXml );
73+
elem = doc.documentElement();
74+
QgsReadWriteContext rwContext;
75+
rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
76+
mTextFormat.readXml( elem, rwContext );
77+
}
78+
79+
// Migratation for pre QGIS 3.2 settings
80+
QColor oldColor = QgsSymbolLayerUtils::decodeColor( QgsProject::instance()->readEntry( mNameConfig, QStringLiteral( "/Color" ) ) );
81+
if ( oldColor.isValid() )
82+
{
83+
mTextFormat.setColor( oldColor );
84+
}
7085
}
7186

7287
void QgsDecorationCopyright::saveToProject()
7388
{
7489
QgsDecorationItem::saveToProject();
75-
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/FontName" ), mQFont.family() );
76-
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/FontSize" ), mQFont.pointSize() );
7790
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/Label" ), mLabelText );
78-
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/Color" ), QgsSymbolLayerUtils::encodeColor( mColor ) );
7991
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/MarginH" ), mMarginHorizontal );
8092
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/MarginV" ), mMarginVertical );
93+
94+
QDomDocument textDoc;
95+
QgsReadWriteContext rwContext;
96+
rwContext.setPathResolver( QgsProject::instance()->pathResolver() );
97+
QDomElement textElem = mTextFormat.writeXml( textDoc, rwContext );
98+
textDoc.appendChild( textElem );
99+
QgsProject::instance()->writeEntry( mNameConfig, QStringLiteral( "/Font" ), textDoc.toString() );
81100
}
82101

83102
// Slot called when the buffer menu item is activated
@@ -91,77 +110,82 @@ void QgsDecorationCopyright::run()
91110
void QgsDecorationCopyright::render( const QgsMapSettings &mapSettings, QgsRenderContext &context )
92111
{
93112
Q_UNUSED( mapSettings );
94-
//Large IF statement to enable/disable copyright label
95-
if ( enabled() )
96-
{
97-
QString displayString = QgsExpression::replaceExpressionText( mLabelText, &context.expressionContext() );
113+
if ( !enabled() )
114+
return;
98115

99-
// need width/height of paint device
100-
int myHeight = context.painter()->device()->height();
101-
int myWidth = context.painter()->device()->width();
116+
context.painter()->save();
117+
context.painter()->setRenderHint( QPainter::Antialiasing, true );
102118

103-
QTextDocument text;
104-
text.setDefaultFont( mQFont );
105-
// To set the text color in a QTextDocument we use a CSS style
119+
QString displayString = QgsExpression::replaceExpressionText( mLabelText, &context.expressionContext() );
120+
QStringList displayStringList = displayString.split( "\n" );
106121

107-
QString style = "<style type=\"text/css\"> p {color: " +
108-
QStringLiteral( "rgba( %1, %2, %3, %4 )" ).arg( mColor.red() ).arg( mColor.green() ).arg( mColor.blue() ).arg( QString::number( mColor.alphaF(), 'f', 2 ) ) + "}</style>";
109-
text.setHtml( style + "<p>" + displayString + "</p>" );
110-
QSizeF size = text.size();
122+
QFontMetricsF fm( mTextFormat.scaledFont( context ) );
123+
double textWidth = QgsTextRenderer::textWidth( context, mTextFormat, displayStringList, &fm );
124+
double textHeight = QgsTextRenderer::textHeight( context, mTextFormat, displayStringList, QgsTextRenderer::Point, &fm );
111125

112-
float myXOffset( 0 ), myYOffset( 0 );
126+
int deviceHeight = context.painter()->device()->height();
127+
int deviceWidth = context.painter()->device()->width();
113128

114-
// Set margin according to selected units
115-
switch ( mMarginUnit )
129+
float xOffset( 0 ), yOffset( 0 );
130+
131+
// Set margin according to selected units
132+
switch ( mMarginUnit )
133+
{
134+
case QgsUnitTypes::RenderMillimeters:
135+
{
136+
int pixelsInchX = context.painter()->device()->logicalDpiX();
137+
int pixelsInchY = context.painter()->device()->logicalDpiY();
138+
xOffset = pixelsInchX * INCHES_TO_MM * mMarginHorizontal;
139+
yOffset = pixelsInchY * INCHES_TO_MM * mMarginVertical;
140+
break;
141+
}
142+
case QgsUnitTypes::RenderPixels:
116143
{
117-
case QgsUnitTypes::RenderMillimeters:
118-
{
119-
int myPixelsInchX = context.painter()->device()->logicalDpiX();
120-
int myPixelsInchY = context.painter()->device()->logicalDpiY();
121-
myXOffset = myPixelsInchX * INCHES_TO_MM * mMarginHorizontal;
122-
myYOffset = myPixelsInchY * INCHES_TO_MM * mMarginVertical;
123-
break;
124-
}
125-
126-
case QgsUnitTypes::RenderPixels:
127-
myXOffset = mMarginHorizontal;
128-
myYOffset = mMarginVertical;
129-
break;
130-
131-
case QgsUnitTypes::RenderPercentage:
132-
myXOffset = ( ( myWidth - size.width() ) / 100. ) * mMarginHorizontal;
133-
myYOffset = ( ( myHeight - size.height() ) / 100. ) * mMarginVertical;
134-
break;
135-
136-
default: // Use default of top left
137-
break;
144+
xOffset = mMarginHorizontal;
145+
yOffset = mMarginVertical;
146+
break;
138147
}
139-
//Determine placement of label from form combo box
140-
switch ( mPlacement )
148+
case QgsUnitTypes::RenderPercentage:
141149
{
142-
case BottomLeft: // Bottom Left. myXOffset is set above
143-
myYOffset = myHeight - myYOffset - size.height();
144-
break;
145-
case TopLeft: // Top left. Already setup above
146-
break;
147-
case TopRight: // Top Right. myYOffset is set above
148-
myXOffset = myWidth - myXOffset - size.width();
149-
break;
150-
case BottomRight: // Bottom Right
151-
//Define bottom right hand corner start point
152-
myYOffset = myHeight - myYOffset - size.height();
153-
myXOffset = myWidth - myXOffset - size.width();
154-
break;
155-
default:
156-
QgsDebugMsg( QString( "Unknown placement index of %1" ).arg( static_cast<int>( mPlacement ) ) );
150+
xOffset = ( ( deviceWidth - textWidth ) / 100. ) * mMarginHorizontal;
151+
yOffset = ( ( deviceHeight - textHeight ) / 100. ) * mMarginVertical;
152+
break;
157153
}
154+
case QgsUnitTypes::RenderMapUnits:
155+
case QgsUnitTypes::RenderPoints:
156+
case QgsUnitTypes::RenderInches:
157+
case QgsUnitTypes::RenderUnknownUnit:
158+
case QgsUnitTypes::RenderMetersInMapUnits:
159+
break;
160+
}
158161

159-
//Paint label to canvas
160-
QMatrix worldMatrix = context.painter()->worldMatrix();
161-
context.painter()->translate( myXOffset, myYOffset );
162-
text.drawContents( context.painter() );
163-
// Put things back how they were
164-
context.painter()->setWorldMatrix( worldMatrix );
162+
// Determine placement of label from form combo box
163+
QgsTextRenderer::HAlignment horizontalAlignment = QgsTextRenderer::AlignLeft;
164+
switch ( mPlacement )
165+
{
166+
case BottomLeft: // Bottom Left, xOffset is set above
167+
yOffset = deviceHeight - yOffset;
168+
break;
169+
case TopLeft: // Top left, xOffset is set above
170+
yOffset = yOffset + textHeight;
171+
break;
172+
case TopRight: // Top Right
173+
yOffset = yOffset + textHeight;
174+
xOffset = deviceWidth - xOffset;
175+
horizontalAlignment = QgsTextRenderer::AlignRight;
176+
break;
177+
case BottomRight: // Bottom Right
178+
yOffset = deviceHeight - yOffset;
179+
xOffset = deviceWidth - xOffset;
180+
horizontalAlignment = QgsTextRenderer::AlignRight;
181+
break;
182+
default:
183+
QgsDebugMsg( QString( "Unknown placement index of %1" ).arg( static_cast<int>( mPlacement ) ) );
165184
}
185+
186+
//Paint label to canvas
187+
QgsTextRenderer::drawText( QPointF( xOffset, yOffset ), 0.0, horizontalAlignment, displayStringList, context, mTextFormat );
188+
189+
context.painter()->restore();
166190
}
167191

‎src/app/qgsdecorationcopyright.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define QGSCOPYRIGHTLABELPLUGIN
2121

2222
#include "qgsdecorationitem.h"
23+
#include "qgstextrenderer.h"
2324

2425
#include <QColor>
2526
#include <QFont>
@@ -49,19 +50,32 @@ class APP_EXPORT QgsDecorationCopyright : public QgsDecorationItem
4950
//! render the copyright label
5051
void render( const QgsMapSettings &mapSettings, QgsRenderContext &context ) override;
5152

53+
/**
54+
* Returns the text format for extent labels.
55+
* \see setTextFormat()
56+
* \see labelExtents()
57+
* \since QGIS 3.2
58+
*/
59+
QgsTextFormat textFormat() const { return mTextFormat; }
60+
61+
/**
62+
* Sets the text \a format for extent labels.
63+
* \see textFormat()
64+
* \see setLabelExtents()
65+
* \since QGIS 3.2
66+
*/
67+
void setTextFormat( const QgsTextFormat &format ) { mTextFormat = format; }
68+
5269
private:
53-
//! This is the font that will be used for the copyright label
54-
QFont mQFont;
5570
//! This is the string that will be used for the copyright label
5671
QString mLabelText;
5772

58-
//! This is the color for the copyright label
59-
QColor mColor;
60-
6173
//! enable or disable use of position percentage for placement
6274
int mMarginHorizontal = 0;
6375
int mMarginVertical = 0;
6476

77+
QgsTextFormat mTextFormat;
78+
6579
friend class QgsDecorationCopyrightDialog;
6680
};
6781

‎src/app/qgsdecorationcopyrightdialog.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
3636
connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsDecorationCopyrightDialog::buttonBox_accepted );
3737
connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsDecorationCopyrightDialog::buttonBox_rejected );
3838
connect( mInsertExpressionButton, &QPushButton::clicked, this, &QgsDecorationCopyrightDialog::mInsertExpressionButton_clicked );
39-
connect( pbnColorChooser, &QgsColorButton::colorChanged, this, &QgsDecorationCopyrightDialog::pbnColorChooser_colorChanged );
4039
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsDecorationCopyrightDialog::showHelp );
4140

4241
QgsSettings settings;
@@ -48,6 +47,7 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
4847
grpEnable->setChecked( mDeco.enabled() );
4948

5049
// label text
50+
txtCopyrightText->setAcceptRichText( false );
5151
if ( !mDeco.enabled() && mDeco.mLabelText.isEmpty() )
5252
{
5353
QDate now = QDate::currentDate();
@@ -70,16 +70,10 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
7070
wgtUnitSelection->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderPercentage << QgsUnitTypes::RenderPixels );
7171
wgtUnitSelection->setUnit( mDeco.mMarginUnit );
7272

73-
// color
74-
pbnColorChooser->setAllowOpacity( true );
75-
pbnColorChooser->setColor( mDeco.mColor );
76-
pbnColorChooser->setContext( QStringLiteral( "gui" ) );
77-
pbnColorChooser->setColorDialogTitle( tr( "Select Text color" ) );
78-
79-
QTextCursor cursor = txtCopyrightText->textCursor();
80-
txtCopyrightText->selectAll();
81-
txtCopyrightText->setTextColor( mDeco.mColor );
82-
txtCopyrightText->setTextCursor( cursor );
73+
// font settings
74+
mButtonFontStyle->setDialogTitle( tr( "Copyright Label Text Format" ) );
75+
mButtonFontStyle->setMapCanvas( QgisApp::instance()->mapCanvas() );
76+
mButtonFontStyle->setTextFormat( mDeco.textFormat() );
8377
}
8478

8579
QgsDecorationCopyrightDialog::~QgsDecorationCopyrightDialog()
@@ -120,19 +114,10 @@ void QgsDecorationCopyrightDialog::mInsertExpressionButton_clicked()
120114
}
121115
}
122116

123-
void QgsDecorationCopyrightDialog::pbnColorChooser_colorChanged( const QColor &c )
124-
{
125-
QTextCursor cursor = txtCopyrightText->textCursor();
126-
txtCopyrightText->selectAll();
127-
txtCopyrightText->setTextColor( c );
128-
txtCopyrightText->setTextCursor( cursor );
129-
}
130-
131117
void QgsDecorationCopyrightDialog::apply()
132118
{
133-
mDeco.mQFont = txtCopyrightText->currentFont();
119+
mDeco.setTextFormat( mButtonFontStyle->textFormat() );
134120
mDeco.mLabelText = txtCopyrightText->toPlainText();
135-
mDeco.mColor = pbnColorChooser->color();
136121
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->currentData().toInt() ) );
137122
mDeco.mMarginUnit = wgtUnitSelection->unit();
138123
mDeco.mMarginHorizontal = spnHorizontal->value();

‎src/app/qgsdecorationcopyrightdialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class APP_EXPORT QgsDecorationCopyrightDialog : public QDialog, private Ui::QgsD
3333
void buttonBox_rejected();
3434
void mInsertExpressionButton_clicked();
3535
void showHelp();
36-
void pbnColorChooser_colorChanged( const QColor &c );
3736
void apply();
3837

3938
protected:

‎src/core/qgstextrenderer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,35 +1897,35 @@ void QgsTextRenderer::drawBuffer( QgsRenderContext &context, const QgsTextRender
18971897
p->restore();
18981898
}
18991899

1900-
double QgsTextRenderer::textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, QFontMetricsF *fm )
1900+
double QgsTextRenderer::textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, QFontMetricsF *fontMetrics )
19011901
{
19021902
//calculate max width of text lines
19031903
std::unique_ptr< QFontMetricsF > newFm;
1904-
if ( !fm )
1904+
if ( !fontMetrics )
19051905
{
19061906
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
1907-
fm = newFm.get();
1907+
fontMetrics = newFm.get();
19081908
}
19091909

19101910
double maxWidth = 0;
19111911
Q_FOREACH ( const QString &line, textLines )
19121912
{
1913-
maxWidth = std::max( maxWidth, fm->width( line ) );
1913+
maxWidth = std::max( maxWidth, fontMetrics->width( line ) );
19141914
}
19151915
return maxWidth;
19161916
}
19171917

1918-
double QgsTextRenderer::textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode, QFontMetricsF *fm )
1918+
double QgsTextRenderer::textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode, QFontMetricsF *fontMetrics )
19191919
{
19201920
//calculate max width of text lines
19211921
std::unique_ptr< QFontMetricsF > newFm;
1922-
if ( !fm )
1922+
if ( !fontMetrics )
19231923
{
19241924
newFm.reset( new QFontMetricsF( format.scaledFont( context ) ) );
1925-
fm = newFm.get();
1925+
fontMetrics = newFm.get();
19261926
}
19271927

1928-
double labelHeight = fm->ascent() + fm->descent(); // ignore +1 for baseline
1928+
double labelHeight = fontMetrics->ascent() + fontMetrics->descent(); // ignore +1 for baseline
19291929

19301930
switch ( mode )
19311931
{
@@ -1938,7 +1938,7 @@ double QgsTextRenderer::textHeight( const QgsRenderContext &context, const QgsTe
19381938
case Rect:
19391939
case Point:
19401940
// standard rendering - designed to exactly replicate QPainter's drawText method
1941-
return labelHeight + ( textLines.size() - 1 ) * fm->lineSpacing() * format.lineHeight();
1941+
return labelHeight + ( textLines.size() - 1 ) * fontMetrics->lineSpacing() * format.lineHeight();
19421942
}
19431943

19441944
return 0;

‎src/core/qgstextrenderer.h

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,14 @@ class CORE_EXPORT QgsTextRenderer
12771277
{
12781278
public:
12791279

1280+
//! Draw mode to calculate width and height
1281+
enum DrawMode
1282+
{
1283+
Rect = 0, //!< Text within rectangle draw mode
1284+
Point, //!< Text at point of origin draw mode
1285+
Label, //!< Label-specific draw mode
1286+
};
1287+
12801288
//! Components of text
12811289
enum TextPart
12821290
{
@@ -1374,14 +1382,28 @@ class CORE_EXPORT QgsTextRenderer
13741382
QgsRenderContext &context, const QgsTextFormat &format,
13751383
TextPart part, bool drawAsOutlines = true );
13761384

1377-
private:
1385+
/**
1386+
* Returns the width of a text based on a given format.
1387+
* \param context render context
1388+
* \param format text format
1389+
* \param textLines list of lines of text to calculate width from
1390+
* \param fontMetrics font metrics
1391+
*/
1392+
static double textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines,
1393+
QFontMetricsF *fontMetrics = nullptr );
13781394

1379-
enum DrawMode
1380-
{
1381-
Rect = 0,
1382-
Point,
1383-
Label,
1384-
};
1395+
/**
1396+
* Returns the height of a text based on a given format.
1397+
* \param context render context
1398+
* \param format text format
1399+
* \param textLines list of lines of text to calculate width from
1400+
* \param mode draw mode
1401+
* \param fontMetrics font metrics
1402+
*/
1403+
static double textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode,
1404+
QFontMetricsF *fontMetrics = nullptr );
1405+
1406+
private:
13851407

13861408
struct Component
13871409
{
@@ -1448,11 +1470,6 @@ class CORE_EXPORT QgsTextRenderer
14481470

14491471
static QgsTextFormat updateShadowPosition( const QgsTextFormat &format );
14501472

1451-
static double textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines,
1452-
QFontMetricsF *fm = nullptr );
1453-
static double textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode,
1454-
QFontMetricsF *fm = nullptr );
1455-
14561473

14571474
};
14581475

‎src/ui/qgsdecorationcopyrightdialog.ui

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,6 @@
134134
</item>
135135
<item row="1" column="0" colspan="3">
136136
<widget class="QTextEdit" name="txtCopyrightText">
137-
<property name="html">
138-
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
139-
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
140-
p, li { white-space: pre-wrap; }
141-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
142-
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Verdana'; font-size:10pt;&quot;&gt;© QGIS 2016&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
143-
</property>
144137
</widget>
145138
</item>
146139
<item row="4" column="0">
@@ -181,28 +174,25 @@ p, li { white-space: pre-wrap; }
181174
</size>
182175
</property>
183176
<property name="text">
184-
<string>Color</string>
177+
<string>Font</string>
185178
</property>
186179
</widget>
187180
</item>
188181
<item row="3" column="1" colspan="2">
189182
<layout class="QHBoxLayout" name="horizontalLayout">
190-
<item>
191-
<widget class="QgsColorButton" name="pbnColorChooser">
192-
<property name="minimumSize">
193-
<size>
194-
<width>150</width>
195-
<height>0</height>
196-
</size>
183+
<item row="3" column="1" colspan="2">
184+
<widget class="QgsFontButton" name="mButtonFontStyle">
185+
<property name="enabled">
186+
<bool>true</bool>
197187
</property>
198-
<property name="maximumSize">
199-
<size>
200-
<width>120</width>
201-
<height>16777215</height>
202-
</size>
188+
<property name="sizePolicy">
189+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
190+
<horstretch>0</horstretch>
191+
<verstretch>0</verstretch>
192+
</sizepolicy>
203193
</property>
204194
<property name="text">
205-
<string/>
195+
<string>Font</string>
206196
</property>
207197
</widget>
208198
</item>
@@ -229,10 +219,9 @@ p, li { white-space: pre-wrap; }
229219
<layoutdefault spacing="6" margin="11"/>
230220
<customwidgets>
231221
<customwidget>
232-
<class>QgsColorButton</class>
222+
<class>QgsSymbolButton</class>
233223
<extends>QToolButton</extends>
234-
<header>qgscolorbutton.h</header>
235-
<container>1</container>
224+
<header>qgssymbolbutton.h</header>
236225
</customwidget>
237226
<customwidget>
238227
<class>QgsSpinBox</class>
@@ -249,7 +238,8 @@ p, li { white-space: pre-wrap; }
249238
<tabstops>
250239
<tabstop>grpEnable</tabstop>
251240
<tabstop>txtCopyrightText</tabstop>
252-
<tabstop>pbnColorChooser</tabstop>
241+
<tabstop>mInsertExpressionButton</tabstop>
242+
<tabstop>mButtonFontStyle</tabstop>
253243
<tabstop>cboPlacement</tabstop>
254244
<tabstop>spnHorizontal</tabstop>
255245
<tabstop>spnVertical</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.