Skip to content

Commit a8a1ef7

Browse files
author
telwertowski
committedDec 13, 2006
Add QgsColorButton class to display a color which can be altered using QColorDialog::getColor. Fix for bug #407.
A subclass of QToolButton is needed to draw the button content because some platforms such as Mac OS X and Windows XP enforce a consistent GUI look by always using the button color of the current style and not allowing button backgrounds to be changed on a button by button basis. This class is a simplified version of QtColorButton, an internal class used by Qt Designer to do the same thing. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6251 c8812cc2-4d05-0410-92ff-de0c093fc19c

19 files changed

+259
-409
lines changed
 

‎src/gui/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ libqgis_guiHEADERS = \
7676
qgsattributetable.h \
7777
qgsbookmarks.h \
7878
qgsclipboard.h \
79+
qgscolorbutton.h \
7980
qgscontinuouscolordialog.h \
8081
qgscontinuouscolorrenderer.h \
81-
qgscsexception.h \
8282
qgscoordinatetransform.h \
83+
qgscsexception.h \
8384
qgscustomprojectiondialog.h \
8485
qgscursors.h \
8586
qgsdelattrdialog.h \
@@ -199,13 +200,14 @@ libqgis_gui_la_SOURCES = \
199200
qgisinterface.cpp \
200201
qgsabout.cpp \
201202
qgsaddattrdialog.cpp \
202-
qgsattributeaction.cpp \
203+
qgsattributeaction.cpp \
203204
qgsattributeactiondialog.cpp \
204205
qgsattributedialog.cpp \
205206
qgsattributetable.cpp \
206207
qgsattributetabledisplay.cpp \
207208
qgsbookmarks.cpp \
208209
qgsclipboard.cpp \
210+
qgscolorbutton.cpp \
209211
qgscontinuouscolordialog.cpp \
210212
qgscoordinatetransform.cpp \
211213
qgscontinuouscolorrenderer.cpp \

‎src/gui/qgscolorbutton.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/***************************************************************************
2+
qgscolorbutton.cpp - Button which displays a color
3+
--------------------------------------
4+
Date : 12-Dec-2006
5+
Copyright : (C) 2006 by Tom Elwertowski
6+
Email : telwertowski at users dot sourceforge dot net
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
/* $Id$ */
16+
17+
#include "qgscolorbutton.h"
18+
#include <QPainter>
19+
20+
/*!
21+
\class QgsColorButton
22+
23+
\brief The QgsColorButton class provides a tool button widget displaying
24+
a color which can be altered by calling QColorDialog::getColor.
25+
26+
A subclass of QToolButton is needed to draw the button content because
27+
some platforms such as Mac OS X and Windows XP enforce a consistent
28+
GUI look by always using the button color of the current style and
29+
not allowing button backgrounds to be changed on a button by button basis.
30+
31+
This class is a simplified version of QtColorButton, an internal class used
32+
by Qt Designer to do the same thing.
33+
*/
34+
35+
QgsColorButton::QgsColorButton(QWidget *parent)
36+
: QToolButton(parent)
37+
{}
38+
39+
QgsColorButton::~QgsColorButton()
40+
{}
41+
42+
/*!
43+
Paints button in response to a paint event.
44+
*/
45+
void QgsColorButton::paintEvent(QPaintEvent *e)
46+
{
47+
QToolButton::paintEvent(e);
48+
if (isEnabled())
49+
{
50+
QPainter p(this);
51+
int margin = 2; // Leave some space for highlighting
52+
QRect r = rect().adjusted(margin, margin, -margin, -margin);
53+
p.fillRect(r, mColor);
54+
}
55+
}

‎src/gui/qgscolorbutton.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/***************************************************************************
2+
qgscolorbutton.h - Color button
3+
--------------------------------------
4+
Date : 12-Dec-2006
5+
Copyright : (C) 2006 by Tom Elwertowski
6+
Email : telwertowski at users dot sourceforge dot net
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
/* $Id$ */
16+
#ifndef QGSCOLORBUTTON_H
17+
#define QGSCOLORBUTTON_H
18+
19+
#include <QToolButton>
20+
21+
class QgsColorButton: public QToolButton
22+
{
23+
public:
24+
QgsColorButton(QWidget *parent = 0);
25+
~QgsColorButton();
26+
27+
void setColor(const QColor &color) { mColor = color; }
28+
QColor color() const { return mColor; }
29+
30+
protected:
31+
void paintEvent(QPaintEvent *e);
32+
33+
private:
34+
QColor mColor;
35+
};
36+
37+
#endif

‎src/gui/qgscontinuouscolordialog.cpp

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@ QgsContinuousColorDialog::QgsContinuousColorDialog(QgsVectorLayer * layer)
6565
return;
6666
}
6767

68-
// new Qt4 idiom
69-
#ifdef Q_WS_WIN
70-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
71-
btnMinValue->setStyle(&mWindowsStyle);
72-
btnMaxValue->setStyle(&mWindowsStyle);
73-
#endif
74-
7568
//restore the correct colors for minimum and maximum values
7669

7770
const QgsContinuousColorRenderer* renderer = dynamic_cast < const QgsContinuousColorRenderer * >(layer->renderer());;
@@ -98,23 +91,15 @@ QgsContinuousColorDialog::QgsContinuousColorDialog(QgsVectorLayer * layer)
9891
const QgsSymbol* maxsymbol = renderer->maximumSymbol();
9992

10093
if (mVectorLayer->vectorType() == QGis::Line || mVectorLayer->vectorType() == QGis::Point)
101-
{
102-
// old Qt3 idiom
103-
// lblMinValue->setPaletteBackgroundColor(minsymbol->pen().color());
104-
// lblMaxValue->setPaletteBackgroundColor(maxsymbol->pen().color());
105-
// new Qt4 idiom
106-
btnMinValue->setPalette( minsymbol->pen().color() );
107-
btnMaxValue->setPalette( maxsymbol->pen().color() );
94+
{
95+
btnMinValue->setColor( minsymbol->pen().color() );
96+
btnMaxValue->setColor( maxsymbol->pen().color() );
10897
}
10998
else
110-
{
111-
// old Qt3 idiom
112-
// lblMinValue->setPaletteBackgroundColor(minsymbol->brush().color());
113-
// lblMaxValue->setPaletteBackgroundColor(maxsymbol->brush().color());
114-
// new Qt4 idiom
115-
btnMinValue->setPalette( minsymbol->brush().color() );
116-
btnMaxValue->setPalette( maxsymbol->brush().color() );
117-
}
99+
{
100+
btnMinValue->setColor( minsymbol->brush().color() );
101+
btnMaxValue->setColor( maxsymbol->brush().color() );
102+
}
118103

119104
outlinewidthspinbox->setMinValue(0);
120105
outlinewidthspinbox->setValue(minsymbol->pen().width());
@@ -133,8 +118,8 @@ QgsContinuousColorDialog::QgsContinuousColorDialog(QgsVectorLayer * layer)
133118
if (mVectorLayer->vectorType() != QGis::Polygon)
134119
cb_polygonOutline->setVisible(false);
135120

136-
btnMinValue->setPalette(Qt::black);
137-
btnMaxValue->setPalette(Qt::white);
121+
btnMinValue->setColor(Qt::black);
122+
btnMaxValue->setColor(Qt::white);
138123

139124
}
140125
// Ensure that the state of other widgets is appropriate for the
@@ -189,22 +174,22 @@ void QgsContinuousColorDialog::apply()
189174
QgsSymbol* minsymbol = new QgsSymbol(mVectorLayer->vectorType(), QString::number(minimum, 'f'), "", "");
190175
if (mVectorLayer->vectorType() == QGis::Line || mVectorLayer->vectorType() == QGis::Point)
191176
{
192-
minsymbol->setPen(QPen(btnMinValue->paletteBackgroundColor(),outlinewidthspinbox->value()));
177+
minsymbol->setPen(QPen(btnMinValue->color(), outlinewidthspinbox->value()));
193178
}
194179
else
195180
{
196-
minsymbol->setBrush(QBrush(btnMinValue->paletteBackgroundColor()));
181+
minsymbol->setBrush(QBrush(btnMinValue->color()));
197182
minsymbol->setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
198183
}
199184

200185
QgsSymbol* maxsymbol = new QgsSymbol(mVectorLayer->vectorType(), QString::number(maximum, 'f'), "", "");
201186
if (mVectorLayer->vectorType() == QGis::Line || mVectorLayer->vectorType() == QGis::Point)
202187
{
203-
maxsymbol->setPen(QPen(btnMaxValue->paletteBackgroundColor(),outlinewidthspinbox->value()));
188+
maxsymbol->setPen(QPen(btnMaxValue->color(), outlinewidthspinbox->value()));
204189
}
205190
else
206191
{
207-
maxsymbol->setBrush(QBrush(btnMaxValue->paletteBackgroundColor()));
192+
maxsymbol->setBrush(QBrush(btnMaxValue->color()));
208193
maxsymbol->setPen(QPen(QColor(0, 0, 0), outlinewidthspinbox->value()));
209194
}
210195

@@ -222,26 +207,20 @@ void QgsContinuousColorDialog::apply()
222207

223208
void QgsContinuousColorDialog::selectMinimumColor()
224209
{
225-
QColor mincolor = QColorDialog::getColor(btnMinValue->paletteBackgroundColor(), this);
210+
QColor mincolor = QColorDialog::getColor(btnMinValue->color(), this);
226211
if(mincolor.isValid())
227212
{
228-
// old Qt3 idiom
229-
// lblMinValue->setPaletteBackgroundColor(mincolor);
230-
// new Qt4 idiom
231-
btnMinValue->setPalette(mincolor);
213+
btnMinValue->setColor(mincolor);
232214
}
233215
setActiveWindow();
234216
}
235217

236218
void QgsContinuousColorDialog::selectMaximumColor()
237219
{
238-
QColor maxcolor = QColorDialog::getColor(btnMaxValue->paletteBackgroundColor(), this);
220+
QColor maxcolor = QColorDialog::getColor(btnMaxValue->color(), this);
239221
if(maxcolor.isValid())
240222
{
241-
// old Qt3 idiom
242-
// lblMaxValue->setPaletteBackgroundColor(maxcolor);
243-
// new Qt4 idiom
244-
btnMaxValue->setPalette(maxcolor);
223+
btnMaxValue->setColor(maxcolor);
245224
}
246225
setActiveWindow();
247226
}

‎src/gui/qgscontinuouscolordialog.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
#include "ui_qgscontinuouscolordialogbase.h"
2424
#include <map>
2525

26-
#ifdef Q_WS_WIN
27-
#include <QWindowsStyle>
28-
#endif
29-
3026
class QgsVectorLayer;
3127

3228

@@ -56,11 +52,6 @@ class QgsContinuousColorDialog: public QDialog, private Ui::QgsContinuousColorDi
5652
/** Default constructor is private, do not use this */
5753
QgsContinuousColorDialog();
5854

59-
#ifdef Q_WS_WIN
60-
//! Holds the classic Windows style that is used to render labels with a background color
61-
QWindowsStyle mWindowsStyle;
62-
#endif
63-
6455
};
6556

6657
#endif

‎src/gui/qgsoptions.cpp

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,13 @@ QgsOptions::QgsOptions(QWidget *parent, Qt::WFlags fl) :
115115
int myRed = settings.value("/qgis/default_selection_color_red",255).toInt();
116116
int myGreen = settings.value("/qgis/default_selection_color_green",255).toInt();
117117
int myBlue = settings.value("/qgis/default_selection_color_blue",0).toInt();
118-
// old Qt3 idiom
119-
// pbnSelectionColour->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
120-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
121-
#ifdef Q_WS_WIN
122-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
123-
pbnSelectionColour->setStyle(&mWindowsStyle);
124-
#endif
125-
pbnSelectionColour->setPalette( QColor(myRed,myGreen,myBlue) );
118+
pbnSelectionColour->setColor( QColor(myRed,myGreen,myBlue) );
126119

127120
//set the default color for canvas background
128121
myRed = settings.value("/qgis/default_canvas_color_red",255).toInt();
129122
myGreen = settings.value("/qgis/default_canvas_color_green",255).toInt();
130123
myBlue = settings.value("/qgis/default_canvas_color_blue",255).toInt();
131-
// old Qt3 idiom
132-
// pbnCanvasColor->setPaletteBackgroundColor(QColor(myRed,myGreen,myBlue));
133-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
134-
#ifdef Q_WS_WIN
135-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
136-
pbnCanvasColor->setStyle(&mWindowsStyle);
137-
#endif
138-
pbnCanvasColor->setPalette( QColor(myRed,myGreen,myBlue) );
124+
pbnCanvasColor->setColor( QColor(myRed,myGreen,myBlue) );
139125

140126
capitaliseCheckBox->setChecked(settings.value("qgis/capitaliseLayerName", QVariant(false)).toBool());
141127

@@ -150,33 +136,19 @@ QgsOptions::~QgsOptions(){}
150136

151137
void QgsOptions::on_pbnSelectionColour_clicked()
152138
{
153-
// old Qt3 idiom
154-
// QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
155-
// new Qt4 idiom
156-
QPalette palSelectionColour = pbnSelectionColour->palette();
157-
QColor color = QColorDialog::getColor( palSelectionColour.color(QPalette::Window), this );
139+
QColor color = QColorDialog::getColor(pbnSelectionColour->color(), this);
158140
if (color.isValid())
159141
{
160-
// old Qt3 idiom
161-
// pbnSelectionColour->setPaletteBackgroundColor(color);
162-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
163-
pbnSelectionColour->setPalette(color);
142+
pbnSelectionColour->setColor(color);
164143
}
165144
}
166145

167146
void QgsOptions::on_pbnCanvasColor_clicked()
168147
{
169-
// old Qt3 idiom
170-
// QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
171-
// new Qt4 idiom
172-
QPalette palCanvasColor = pbnCanvasColor->palette();
173-
QColor color = QColorDialog::getColor( palCanvasColor.color(QPalette::Window), this );
148+
QColor color = QColorDialog::getColor(pbnCanvasColor->color(), this);
174149
if (color.isValid())
175150
{
176-
// old Qt3 idiom
177-
// pbnCanvasColor->setPaletteBackgroundColor(color);
178-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
179-
pbnCanvasColor->setPalette(color);
151+
pbnCanvasColor->setColor(color);
180152
}
181153
}
182154
void QgsOptions::themeChanged(const QString &newThemeName)
@@ -231,19 +203,13 @@ void QgsOptions::saveOptions()
231203
settings.writeEntry("/qgis/measure/ellipsoid", getEllipsoidAcronym(cmbEllipsoid->currentText()));
232204

233205
//set the colour for selections
234-
// old Qt3 idiom
235-
// QColor myColor = pbnSelectionColour->paletteBackgroundColor();
236-
// new Qt4 idiom
237-
QColor myColor = pbnSelectionColour->palette().color(QPalette::Window);
206+
QColor myColor = pbnSelectionColour->color();
238207
int myRed = settings.writeEntry("/qgis/default_selection_color_red",myColor.red());
239208
int myGreen = settings.writeEntry("/qgis/default_selection_color_green",myColor.green());
240209
int myBlue = settings.writeEntry("/qgis/default_selection_color_blue",myColor.blue());
241210

242211
//set the default color for canvas background
243-
// old Qt3 idiom
244-
// myColor = pbnCanvasColor->paletteBackgroundColor();
245-
// new Qt4 idiom
246-
myColor = pbnCanvasColor->palette().color(QPalette::Window);
212+
myColor = pbnCanvasColor->color();
247213
myRed = settings.writeEntry("/qgis/default_canvas_color_red",myColor.red());
248214
myGreen = settings.writeEntry("/qgis/default_canvas_color_green",myColor.green());
249215
myBlue = settings.writeEntry("/qgis/default_canvas_color_blue",myColor.blue());

‎src/gui/qgsoptions.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
#include "ui_qgsoptionsbase.h"
2323
#include "qgisgui.h"
2424

25-
#ifdef Q_WS_WIN
26-
#include <QWindowsStyle>
27-
#endif
28-
29-
3025

3126
/**
3227
* \class QgsOptions
@@ -91,11 +86,6 @@ class QgsOptions :public QDialog, private Ui::QgsOptionsBase
9186
//!Global default projection used for new layers added that have no projection
9287
long mGlobalSRSID;
9388

94-
#ifdef Q_WS_WIN
95-
//! Holds the classic Windows style that is used to render buttons with a background color
96-
QWindowsStyle mWindowsStyle;
97-
#endif
98-
9989
};
10090

10191
#endif // #ifndef QGSOPTIONS_H

‎src/gui/qgsprojectproperties.cpp

Lines changed: 12 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -106,43 +106,22 @@
106106
int myGreenInt = QgsProject::instance()->readNumEntry("Digitizing","/LineColorGreenPart",0);
107107
int myBlueInt = QgsProject::instance()->readNumEntry("Digitizing","/LineColorBluePart",0);
108108
QColor myColour = QColor(myRedInt,myGreenInt,myBlueInt);
109-
// old Qt3 idiom
110-
// pbnDigitisedLineColour->setPaletteBackgroundColor (myColour);
111-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
112-
#ifdef Q_WS_WIN
113-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
114-
pbnDigitisedLineColour->setStyle(&mWindowsStyle);
115-
#endif
116-
pbnDigitisedLineColour->setPalette(myColour);
109+
pbnDigitisedLineColour->setColor(myColour);
117110

118111

119112
//get the colour selections and set the button colour accordingly
120113
myRedInt = QgsProject::instance()->readNumEntry("Gui","/SelectionColorRedPart",255);
121114
myGreenInt = QgsProject::instance()->readNumEntry("Gui","/SelectionColorGreenPart",255);
122115
myBlueInt = QgsProject::instance()->readNumEntry("Gui","/SelectionColorBluePart",0);
123116
myColour = QColor(myRedInt,myGreenInt,myBlueInt);
124-
// old Qt3 idiom
125-
// pbnSelectionColour->setPaletteBackgroundColor (myColour);
126-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
127-
#ifdef Q_WS_WIN
128-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
129-
pbnSelectionColour->setStyle(&mWindowsStyle);
130-
#endif
131-
pbnSelectionColour->setPalette(myColour);
117+
pbnSelectionColour->setColor(myColour);
132118

133119
//get the colour for map canvas background and set button colour accordingly (default white)
134120
myRedInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorRedPart",255);
135121
myGreenInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorGreenPart",255);
136122
myBlueInt = QgsProject::instance()->readNumEntry("Gui","/CanvasColorBluePart",255);
137123
myColour = QColor(myRedInt,myGreenInt,myBlueInt);
138-
// old Qt3 idiom
139-
// pbnCanvasColor->setPaletteBackgroundColor (myColour);
140-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
141-
#ifdef Q_WS_WIN
142-
// Coloured buttons do not work under the Windows XP style - use plain Windows instead
143-
pbnCanvasColor->setStyle(&mWindowsStyle);
144-
#endif
145-
pbnCanvasColor->setPalette(myColour);
124+
pbnCanvasColor->setColor(myColour);
146125
}
147126

148127
QgsProjectProperties::~QgsProjectProperties()
@@ -287,29 +266,20 @@ void QgsProjectProperties::apply()
287266
QgsProject::instance()->writeEntry("Digitizing","/LineWidth",spinDigitisedLineWidth->value());
288267

289268
//set the colour of digitising lines
290-
// old Qt3 idiom
291-
// QColor myColour = pbnDigitisedLineColour->paletteBackgroundColor();
292-
// new Qt4 idiom
293-
QColor myColour = pbnDigitisedLineColour->palette().color(QPalette::Window);
269+
QColor myColour = pbnDigitisedLineColour->color();
294270
QgsProject::instance()->writeEntry("Digitizing","/LineColorRedPart",myColour.red());
295271
QgsProject::instance()->writeEntry("Digitizing","/LineColorGreenPart",myColour.green());
296272
QgsProject::instance()->writeEntry("Digitizing","/LineColorBluePart",myColour.blue());
297273

298274
//set the colour for selections
299-
// old Qt3 idiom
300-
// myColour = pbnSelectionColour->paletteBackgroundColor();
301-
// new Qt4 idiom
302-
myColour = pbnSelectionColour->palette().color(QPalette::Window);
275+
myColour = pbnSelectionColour->color();
303276
QgsProject::instance()->writeEntry("Gui","/SelectionColorRedPart",myColour.red());
304277
QgsProject::instance()->writeEntry("Gui","/SelectionColorGreenPart",myColour.green());
305278
QgsProject::instance()->writeEntry("Gui","/SelectionColorBluePart",myColour.blue());
306279
QgsRenderer::mSelectionColor=myColour;
307280

308281
//set the colour for canvas
309-
// old Qt3 idiom
310-
// myColour = pbnCanvasColor->paletteBackgroundColor();
311-
// new Qt4 idiom
312-
myColour = pbnCanvasColor->palette().color(QPalette::Window);
282+
myColour = pbnCanvasColor->color();
313283
QgsProject::instance()->writeEntry("Gui","/CanvasColorRedPart",myColour.red());
314284
QgsProject::instance()->writeEntry("Gui","/CanvasColorGreenPart",myColour.green());
315285
QgsProject::instance()->writeEntry("Gui","/CanvasColorBluePart",myColour.blue());
@@ -336,50 +306,28 @@ void QgsProjectProperties::showProjectionsTab()
336306

337307
void QgsProjectProperties::on_pbnDigitisedLineColour_clicked()
338308
{
339-
// old Qt3 idiom
340-
// QColor color = QColorDialog::getColor(pbnDigitisedLineColour->paletteBackgroundColor(),this);
341-
// new Qt4 idiom
342-
QPalette palDigitisedLineColour = pbnDigitisedLineColour->palette();
343-
QColor color = QColorDialog::getColor( palDigitisedLineColour.color(QPalette::Window), this );
309+
QColor color = QColorDialog::getColor( pbnDigitisedLineColour->color(), this );
344310
if (color.isValid())
345311
{
346-
// old Qt3 idiom
347-
// pbnDigitisedLineColour->setPaletteBackgroundColor(color);
348-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
349-
pbnDigitisedLineColour->setPalette(color);
350-
312+
pbnDigitisedLineColour->setColor(color);
351313
}
352314
}
353315

354316
void QgsProjectProperties::on_pbnSelectionColour_clicked()
355317
{
356-
// old Qt3 idiom
357-
// QColor color = QColorDialog::getColor(pbnSelectionColour->paletteBackgroundColor(),this);
358-
// new Qt4 idiom
359-
QPalette palSelectionColour = pbnSelectionColour->palette();
360-
QColor color = QColorDialog::getColor( palSelectionColour.color(QPalette::Window), this );
318+
QColor color = QColorDialog::getColor( pbnSelectionColour->color(), this );
361319
if (color.isValid())
362320
{
363-
// old Qt3 idiom
364-
// pbnSelectionColour->setPaletteBackgroundColor(color);
365-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
366-
pbnSelectionColour->setPalette(color);
321+
pbnSelectionColour->setColor(color);
367322
}
368323
}
369324

370325
void QgsProjectProperties::on_pbnCanvasColor_clicked()
371326
{
372-
// old Qt3 idiom
373-
// QColor color = QColorDialog::getColor(pbnCanvasColor->paletteBackgroundColor(),this);
374-
// new Qt4 idiom
375-
QPalette palCanvasColor = pbnCanvasColor->palette();
376-
QColor color = QColorDialog::getColor( palCanvasColor.color(QPalette::Window), this );
327+
QColor color = QColorDialog::getColor( pbnCanvasColor->color(), this );
377328
if (color.isValid())
378329
{
379-
// old Qt3 idiom
380-
// pbnCanvasColor->setPaletteBackgroundColor(color);
381-
// new Qt4 idiom - see http://lists.trolltech.com/qt4-preview-feedback/2005-04/thread00270-0.html for reasoning
382-
pbnCanvasColor->setPalette(color);
330+
pbnCanvasColor->setColor(color);
383331
}
384332
}
385333
void QgsProjectProperties::on_pbnHelp_clicked()

‎src/gui/qgsprojectproperties.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include "qgis.h"
2323
#include "qgisgui.h"
2424

25-
#ifdef Q_WS_WIN
26-
#include <QWindowsStyle>
27-
#endif
28-
2925
class QColor;
3026

3127
/*! Dialog to set project level properties
@@ -121,10 +117,4 @@ public slots:
121117
private:
122118
static const int context_id = 361087368;
123119

124-
#ifdef Q_WS_WIN
125-
//! Holds the classic Windows style that is used to render buttons with a background color
126-
QWindowsStyle mWindowsStyle;
127-
#endif
128-
129-
130120
};

‎src/gui/qgssinglesymboldialog.cpp

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,12 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog(): QDialog(), mVectorLayer(0)
3333
#ifdef QGISDEBUG
3434
qWarning("constructor QgsSingleSymbolDialog called WITHOUT a layer");
3535
#endif
36-
#ifdef Q_WS_WIN
37-
// Coloured labels do not work under the Windows XP style - use plain Windows buttons instead
38-
btnFillColor->setStyle(&mWindowsStyle);
39-
btnOutlineColor->setStyle(&mWindowsStyle);
40-
#endif
4136
}
4237

4338
QgsSingleSymbolDialog::QgsSingleSymbolDialog(QgsVectorLayer * layer): QDialog(), mVectorLayer(layer)
4439
{
4540
setupUi(this);
4641

47-
#ifdef Q_WS_WIN
48-
// Coloured labels do not work under the Windows XP style - use plain Windows buttons instead
49-
btnFillColor->setStyle(&mWindowsStyle);
50-
btnOutlineColor->setStyle(&mWindowsStyle);
51-
#endif
52-
5342
#ifdef QGISDEBUG
5443
qWarning("constructor QgsSingleSymbolDialog called WITH a layer");
5544
#endif
@@ -132,8 +121,6 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog(QgsVectorLayer * layer): QDialog(),
132121

133122
if (mVectorLayer && mVectorLayer->vectorType() == QGis::Line)
134123
{
135-
// lblFillColor->unsetPalette();
136-
btnFillColor->setPalette(QPalette()); // reset to default application palette
137124
btnFillColor->setEnabled(false);
138125
grpPattern->setEnabled(false);
139126
mGroupPoint->setEnabled(false);
@@ -193,13 +180,10 @@ QgsSingleSymbolDialog::~QgsSingleSymbolDialog()
193180

194181
void QgsSingleSymbolDialog::selectOutlineColor()
195182
{
196-
QColor c = QColorDialog::getColor(btnOutlineColor->paletteBackgroundColor(),this);
183+
QColor c = QColorDialog::getColor(btnOutlineColor->color(), this);
197184

198185
if ( c.isValid() ) {
199-
// old Qt3 idiom
200-
// lblOutlineColor->setPaletteBackgroundColor(c);
201-
// new Qt4 idiom
202-
btnOutlineColor->setPalette(c);
186+
btnOutlineColor->setColor(c);
203187
emit settingsChanged();
204188
}
205189

@@ -208,13 +192,10 @@ void QgsSingleSymbolDialog::selectOutlineColor()
208192

209193
void QgsSingleSymbolDialog::selectFillColor()
210194
{
211-
QColor c = QColorDialog::getColor(btnFillColor->paletteBackgroundColor(),this);
195+
QColor c = QColorDialog::getColor(btnFillColor->color(), this);
212196

213197
if ( c.isValid() ) {
214-
// old Qt3 idiom
215-
// lblFillColor->setPaletteBackgroundColor(c);
216-
// new Qt4 idiom
217-
btnFillColor->setPalette(c);
198+
btnFillColor->setColor(c);
218199
emit settingsChanged();
219200
}
220201

@@ -224,9 +205,9 @@ void QgsSingleSymbolDialog::selectFillColor()
224205
void QgsSingleSymbolDialog::apply( QgsSymbol *sy )
225206
{
226207
//query the values of the widgets and set the symbology of the vector layer
227-
sy->setFillColor(btnFillColor->paletteBackgroundColor());
208+
sy->setFillColor(btnFillColor->color());
228209
sy->setLineWidth(outlinewidthspinbox->value());
229-
sy->setColor(btnOutlineColor->paletteBackgroundColor());
210+
sy->setColor(btnOutlineColor->color());
230211

231212
//
232213
// Apply point symbol
@@ -334,7 +315,7 @@ void QgsSingleSymbolDialog::apply()
334315
void QgsSingleSymbolDialog::set ( const QgsSymbol *sy )
335316
{
336317
// Set point symbol
337-
for ( int i = 0; i < mMarkers.size(); i++ ) {
318+
for ( int i = 0; i < mMarkers.size(); i++ ) {
338319
if ( mMarkers[i] == sy->pointSymbolName() ) {
339320
mPointSymbolComboBox->setCurrentItem ( i );
340321
break;
@@ -348,16 +329,9 @@ void QgsSingleSymbolDialog::set ( const QgsSymbol *sy )
348329
// ... but, drawLine is not correct with width > 0 -> until solved set to 0
349330
outlinewidthspinbox->setMinValue(0);
350331

332+
btnFillColor->setColor( sy->brush().color() );
351333

352-
// old Qt3 idiom
353-
// lblFillColor->setPaletteBackgroundColor(sy->brush().color());
354-
// new Qt4 idiom
355-
btnFillColor->setPalette( sy->brush().color() );
356-
357-
// old Qt3 idiom
358-
// lblOutlineColor->setPaletteBackgroundColor(sy->pen().color());
359-
// new Qt4 idiom
360-
btnOutlineColor->setPalette( sy->pen().color() );
334+
btnOutlineColor->setColor( sy->pen().color() );
361335

362336
//stylebutton->setName(QgsSymbologyUtils::penStyle2Char(sy->pen().style()));
363337
//stylebutton->setPixmap(QgsSymbologyUtils::char2LinePixmap(stylebutton->name()));
@@ -444,10 +418,7 @@ void QgsSingleSymbolDialog::set ( const QgsSymbol *sy )
444418

445419
void QgsSingleSymbolDialog::setOutlineColor(QColor& c)
446420
{
447-
// old Qt3 idiom
448-
// lblOutlineColor->setPaletteBackgroundColor(c);
449-
// new Qt4 idiom
450-
btnOutlineColor->setPalette(c);
421+
btnOutlineColor->setColor(c);
451422
}
452423

453424
void QgsSingleSymbolDialog::setOutlineStyle(Qt::PenStyle pstyle)
@@ -469,10 +440,7 @@ void QgsSingleSymbolDialog::setOutlineStyle(Qt::PenStyle pstyle)
469440

470441
void QgsSingleSymbolDialog::setFillColor(QColor& c)
471442
{
472-
// old Qt3 idiom
473-
// lblFillColor->setPaletteBackgroundColor(c);
474-
// new Qt4 idiom
475-
btnFillColor->setPalette(c);
443+
btnFillColor->setColor(c);
476444
}
477445

478446
void QgsSingleSymbolDialog::setFillStyle(Qt::BrushStyle fstyle)
@@ -521,7 +489,7 @@ void QgsSingleSymbolDialog::setOutlineWidth(int width)
521489

522490
QColor QgsSingleSymbolDialog::getOutlineColor()
523491
{
524-
return btnOutlineColor->paletteBackgroundColor();
492+
return btnOutlineColor->color();
525493
}
526494

527495
Qt::PenStyle QgsSingleSymbolDialog::getOutlineStyle()
@@ -548,7 +516,7 @@ int QgsSingleSymbolDialog::getOutlineWidth()
548516

549517
QColor QgsSingleSymbolDialog::getFillColor()
550518
{
551-
return btnFillColor->paletteBackgroundColor();
519+
return btnFillColor->color();
552520
}
553521

554522
Qt::BrushStyle QgsSingleSymbolDialog::getFillStyle()

‎src/gui/qgssinglesymboldialog.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include "ui_qgssinglesymboldialogbase.h"
2323
#include <vector>
2424

25-
#ifdef Q_WS_WIN
26-
#include <QWindowsStyle>
27-
#endif
28-
2925
class QgsSymbol;
3026
class QgsVectorLayer;
3127

@@ -74,12 +70,6 @@ protected slots:
7470
/** vector of marker names for combo items */
7571
std::vector<QString> mMarkers;
7672

77-
#ifdef Q_WS_WIN
78-
//! Holds the classic Windows style that is used to render labels with a background color
79-
QWindowsStyle mWindowsStyle;
80-
#endif
81-
82-
8373
signals:
8474
void settingsChanged();
8575
};

‎src/plugins/grass/qgsgrassregion.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <qpushbutton.h>
3737
#include <qradiobutton.h>
3838
#include <q3buttongroup.h>
39-
#include <qpalette.h>
4039
#include <qcolordialog.h>
4140
#include <qspinbox.h>
4241
#include <qglobal.h>
@@ -223,9 +222,7 @@ QgsGrassRegion::QgsGrassRegion ( QgsGrassPlugin *plugin, QgisApp *qgisApp, Qgis
223222

224223
// Symbology
225224
QPen pen = mPlugin->regionPen();
226-
QPalette palette = mColorButton->palette();
227-
palette.setColor( QColorGroup::Button, pen.color() );
228-
mColorButton->setPalette( palette );
225+
mColorButton->setColor( pen.color() );
229226
connect( mColorButton, SIGNAL(clicked()), this, SLOT(changeColor()));
230227

231228
mWidthSpinBox->setValue( pen.width() );
@@ -241,13 +238,13 @@ QgsGrassRegion::QgsGrassRegion ( QgsGrassPlugin *plugin, QgisApp *qgisApp, Qgis
241238
void QgsGrassRegion::changeColor ( void ) {
242239
QPen pen = mPlugin->regionPen();
243240
QColor color = QColorDialog::getColor ( pen.color(), this );
241+
if (color.isValid())
242+
{
243+
mColorButton->setColor( color );
244244

245-
QPalette palette = mColorButton->palette();
246-
palette.setColor( QColorGroup::Button, pen.color() );
247-
mColorButton->setPalette( palette );
248-
249-
pen.setColor(color);
250-
mPlugin->setRegionPen(pen);
245+
pen.setColor(color);
246+
mPlugin->setRegionPen(pen);
247+
}
251248
}
252249

253250
void QgsGrassRegion::changeWidth ( void ) {

‎src/plugins/grass/qgsgrassregionbase.ui

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<ui version="4.0" >
2-
<author></author>
3-
<comment></comment>
4-
<exportmacro></exportmacro>
52
<class>QgsGrassRegionBase</class>
63
<widget class="QWidget" name="QgsGrassRegionBase" >
74
<property name="geometry" >
@@ -369,27 +366,13 @@
369366
</widget>
370367
</item>
371368
<item>
372-
<widget class="QPushButton" name="mColorButton" >
373-
<property name="sizePolicy" >
374-
<sizepolicy>
375-
<hsizetype>0</hsizetype>
376-
<vsizetype>0</vsizetype>
377-
<horstretch>0</horstretch>
378-
<verstretch>0</verstretch>
379-
</sizepolicy>
380-
</property>
369+
<widget class="QgsColorButton" name="mColorButton" >
381370
<property name="minimumSize" >
382371
<size>
383372
<width>35</width>
384373
<height>25</height>
385374
</size>
386375
</property>
387-
<property name="maximumSize" >
388-
<size>
389-
<width>35</width>
390-
<height>25</height>
391-
</size>
392-
</property>
393376
<property name="text" >
394377
<string/>
395378
</property>
@@ -437,13 +420,13 @@
437420
<property name="minimumSize" >
438421
<size>
439422
<width>0</width>
440-
<height>35</height>
423+
<height>38</height>
441424
</size>
442425
</property>
443426
<property name="maximumSize" >
444427
<size>
445428
<width>32767</width>
446-
<height>35</height>
429+
<height>38</height>
447430
</size>
448431
</property>
449432
<property name="frameShape" >
@@ -531,10 +514,14 @@
531514
<customwidgets>
532515
<customwidget>
533516
<class>Q3Frame</class>
534-
<extends></extends>
517+
<extends>QFrame</extends>
535518
<header>Qt3Support/Q3Frame</header>
536519
<container>1</container>
537-
<pixmap></pixmap>
520+
</customwidget>
521+
<customwidget>
522+
<class>QgsColorButton</class>
523+
<extends>QToolButton</extends>
524+
<header>qgscolorbutton.h</header>
538525
</customwidget>
539526
</customwidgets>
540527
<resources/>

‎src/plugins/scale_bar/plugingui.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ void QgsScaleBarPluginGui::on_pbnOK_clicked()
4141
emit changeSnapping(chkSnapping->isChecked());
4242
emit changeEnabled(chkEnable->isChecked());
4343
emit changeStyle(cboStyle->currentItem());
44-
emit changeColour(pbnChangeColour->palette().color(QPalette::Button));
44+
emit changeColour(pbnChangeColour->color());
4545
emit refreshCanvas();
4646
done(1);
4747
}
4848
void QgsScaleBarPluginGui::on_pbnChangeColour_clicked()
4949
{
50-
QColor colour = QColorDialog::getColor(
51-
pbnChangeColour->palette().color(QPalette::Button), this);
50+
QColor colour = QColorDialog::getColor(pbnChangeColour->color(), this);
5251

5352
if (colour.isValid())
5453
setColour(colour);
@@ -96,7 +95,5 @@ void QgsScaleBarPluginGui::setStyle(int styleIndex)
9695

9796
void QgsScaleBarPluginGui::setColour(QColor theQColor)
9897
{
99-
QPalette palette;
100-
palette.setColor(QPalette::Button, theQColor);
101-
pbnChangeColour->setPalette(palette);
98+
pbnChangeColour->setColor(theQColor);
10299
}

‎src/plugins/scale_bar/pluginguibase.ui

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<ui version="4.0" >
2-
<author></author>
3-
<comment></comment>
4-
<exportmacro></exportmacro>
52
<class>QgsScaleBarPluginGuiBase</class>
63
<widget class="QDialog" name="QgsScaleBarPluginGuiBase" >
74
<property name="geometry" >
@@ -115,38 +112,25 @@
115112
<number>6</number>
116113
</property>
117114
<item row="2" column="1" >
118-
<layout class="QHBoxLayout" >
119-
<property name="margin" >
120-
<number>0</number>
115+
<widget class="QgsColorButton" name="pbnChangeColour" >
116+
<property name="sizePolicy" >
117+
<sizepolicy>
118+
<hsizetype>1</hsizetype>
119+
<vsizetype>1</vsizetype>
120+
<horstretch>0</horstretch>
121+
<verstretch>0</verstretch>
122+
</sizepolicy>
121123
</property>
122-
<property name="spacing" >
123-
<number>6</number>
124+
<property name="toolTip" >
125+
<string>Click to select the colour</string>
124126
</property>
125-
<item>
126-
<widget class="QPushButton" name="pbnChangeColour" >
127-
<property name="sizePolicy" >
128-
<sizepolicy>
129-
<hsizetype>1</hsizetype>
130-
<vsizetype>1</vsizetype>
131-
<horstretch>0</horstretch>
132-
<verstretch>0</verstretch>
133-
</sizepolicy>
134-
</property>
135-
<property name="toolTip" >
136-
<string>Click to select the colour</string>
137-
</property>
138-
<property name="statusTip" >
139-
<string/>
140-
</property>
141-
<property name="whatsThis" >
142-
<string>Click to select the colour</string>
143-
</property>
144-
<property name="text" >
145-
<string/>
146-
</property>
147-
</widget>
148-
</item>
149-
</layout>
127+
<property name="whatsThis" >
128+
<string>Click to select the colour</string>
129+
</property>
130+
<property name="text" >
131+
<string/>
132+
</property>
133+
</widget>
150134
</item>
151135
<item row="3" column="0" >
152136
<widget class="QLabel" name="textLabel1_3" >
@@ -271,12 +255,6 @@
271255
<verstretch>0</verstretch>
272256
</sizepolicy>
273257
</property>
274-
<property name="minimumSize" >
275-
<size>
276-
<width>0</width>
277-
<height>30</height>
278-
</size>
279-
</property>
280258
<property name="toolTip" >
281259
<string>Select the style of the scale bar</string>
282260
</property>
@@ -381,7 +359,13 @@
381359
</layout>
382360
</widget>
383361
<layoutdefault spacing="6" margin="11" />
384-
<pixmapfunction></pixmapfunction>
362+
<customwidgets>
363+
<customwidget>
364+
<class>QgsColorButton</class>
365+
<extends>QToolButton</extends>
366+
<header>qgscolorbutton.h</header>
367+
</customwidget>
368+
</customwidgets>
385369
<resources>
386370
<include location="scalebar_plugin.qrc" />
387371
</resources>

‎src/ui/qgscontinuouscolordialogbase.ui

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
<ui version="4.0" >
2-
<author></author>
3-
<comment></comment>
4-
<exportmacro></exportmacro>
52
<class>QgsContinuousColorDialogBase</class>
63
<widget class="QDialog" name="QgsContinuousColorDialogBase" >
74
<property name="geometry" >
85
<rect>
96
<x>0</x>
107
<y>0</y>
11-
<width>408</width>
8+
<width>425</width>
129
<height>155</height>
1310
</rect>
1411
</property>
@@ -81,22 +78,13 @@
8178
</widget>
8279
</item>
8380
<item row="2" column="1" >
84-
<widget class="QToolButton" name="btnMaxValue" >
81+
<widget class="QgsColorButton" name="btnMaxValue" >
8582
<property name="minimumSize" >
8683
<size>
8784
<width>100</width>
88-
<height>22</height>
85+
<height>0</height>
8986
</size>
9087
</property>
91-
<property name="maximumSize" >
92-
<size>
93-
<width>100</width>
94-
<height>22</height>
95-
</size>
96-
</property>
97-
<property name="text" >
98-
<string/>
99-
</property>
10088
</widget>
10189
</item>
10290
<item row="2" column="0" >
@@ -116,22 +104,13 @@
116104
</widget>
117105
</item>
118106
<item row="1" column="1" >
119-
<widget class="QToolButton" name="btnMinValue" >
107+
<widget class="QgsColorButton" name="btnMinValue" >
120108
<property name="minimumSize" >
121109
<size>
122110
<width>100</width>
123-
<height>22</height>
111+
<height>0</height>
124112
</size>
125113
</property>
126-
<property name="maximumSize" >
127-
<size>
128-
<width>100</width>
129-
<height>22</height>
130-
</size>
131-
</property>
132-
<property name="text" >
133-
<string/>
134-
</property>
135114
</widget>
136115
</item>
137116
<item row="0" column="1" >
@@ -148,6 +127,13 @@
148127
</widget>
149128
<layoutdefault spacing="6" margin="11" />
150129
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
130+
<customwidgets>
131+
<customwidget>
132+
<class>QgsColorButton</class>
133+
<extends>QToolButton</extends>
134+
<header>qgscolorbutton.h</header>
135+
</customwidget>
136+
</customwidgets>
151137
<resources/>
152138
<connections/>
153139
</ui>

‎src/ui/qgsoptionsbase.ui

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<rect>
66
<x>0</x>
77
<y>0</y>
8-
<width>576</width>
8+
<width>590</width>
99
<height>454</height>
1010
</rect>
1111
</property>
@@ -154,11 +154,11 @@
154154
</widget>
155155
</item>
156156
<item>
157-
<widget class="QToolButton" name="pbnSelectionColour" >
157+
<widget class="QgsColorButton" name="pbnSelectionColour" >
158158
<property name="minimumSize" >
159159
<size>
160160
<width>100</width>
161-
<height>22</height>
161+
<height>0</height>
162162
</size>
163163
</property>
164164
<property name="text" >
@@ -190,11 +190,11 @@
190190
</widget>
191191
</item>
192192
<item>
193-
<widget class="QToolButton" name="pbnCanvasColor" >
193+
<widget class="QgsColorButton" name="pbnCanvasColor" >
194194
<property name="minimumSize" >
195195
<size>
196196
<width>100</width>
197-
<height>22</height>
197+
<height>0</height>
198198
</size>
199199
</property>
200200
<property name="text" >
@@ -797,6 +797,13 @@ p, li { white-space: pre-wrap; }
797797
</layout>
798798
</widget>
799799
<layoutdefault spacing="6" margin="11" />
800+
<customwidgets>
801+
<customwidget>
802+
<class>QgsColorButton</class>
803+
<extends>QToolButton</extends>
804+
<header>qgscolorbutton.h</header>
805+
</customwidget>
806+
</customwidgets>
800807
<tabstops>
801808
<tabstop>tabWidget</tabstop>
802809
<tabstop>btnFindBrowser</tabstop>

‎src/ui/qgsprojectpropertiesbase.ui

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
<ui version="4.0" >
2-
<author></author>
3-
<comment></comment>
4-
<exportmacro></exportmacro>
52
<class>QgsProjectPropertiesBase</class>
63
<widget class="QDialog" name="QgsProjectPropertiesBase" >
74
<property name="geometry" >
85
<rect>
96
<x>0</x>
107
<y>0</y>
11-
<width>504</width>
8+
<width>565</width>
129
<height>550</height>
1310
</rect>
1411
</property>
@@ -58,12 +55,12 @@
5855
</property>
5956
<item row="0" column="0" >
6057
<widget class="QLineEdit" name="titleEdit" >
58+
<property name="toolTip" >
59+
<string>Descriptive project name</string>
60+
</property>
6161
<property name="text" >
6262
<string>Default project title</string>
6363
</property>
64-
<property name="toolTip">
65-
<string>Descriptive project name</string>
66-
</property>
6764
</widget>
6865
</item>
6966
</layout>
@@ -227,28 +224,20 @@
227224
</item>
228225
<item row="0" column="1" >
229226
<widget class="QSpinBox" name="spinDigitisedLineWidth" >
230-
<property name="minimum" >
231-
<number>1</number>
232-
</property>
233227
<property name="toolTip" >
234228
<string>Line width in pixels</string>
235229
</property>
230+
<property name="minimum" >
231+
<number>1</number>
232+
</property>
236233
</widget>
237234
</item>
238235
<item row="1" column="1" >
239-
<widget class="QToolButton" name="pbnDigitisedLineColour" >
240-
<property name="sizePolicy" >
241-
<sizepolicy>
242-
<hsizetype>5</hsizetype>
243-
<vsizetype>5</vsizetype>
244-
<horstretch>0</horstretch>
245-
<verstretch>0</verstretch>
246-
</sizepolicy>
247-
</property>
236+
<widget class="QgsColorButton" name="pbnDigitisedLineColour" >
248237
<property name="minimumSize" >
249238
<size>
250239
<width>100</width>
251-
<height>22</height>
240+
<height>0</height>
252241
</size>
253242
</property>
254243
<property name="text" >
@@ -315,19 +304,11 @@
315304
</widget>
316305
</item>
317306
<item>
318-
<widget class="QToolButton" name="pbnSelectionColour" >
319-
<property name="sizePolicy" >
320-
<sizepolicy>
321-
<hsizetype>5</hsizetype>
322-
<vsizetype>0</vsizetype>
323-
<horstretch>0</horstretch>
324-
<verstretch>0</verstretch>
325-
</sizepolicy>
326-
</property>
307+
<widget class="QgsColorButton" name="pbnSelectionColour" >
327308
<property name="minimumSize" >
328309
<size>
329-
<width>80</width>
330-
<height>22</height>
310+
<width>100</width>
311+
<height>0</height>
331312
</size>
332313
</property>
333314
<property name="text" >
@@ -341,7 +322,7 @@
341322
<enum>Qt::Horizontal</enum>
342323
</property>
343324
<property name="sizeType" >
344-
<enum>QSizePolicy::Fixed</enum>
325+
<enum>QSizePolicy::Expanding</enum>
345326
</property>
346327
<property name="sizeHint" >
347328
<size>
@@ -362,18 +343,10 @@
362343
</widget>
363344
</item>
364345
<item>
365-
<widget class="QToolButton" name="pbnCanvasColor" >
366-
<property name="sizePolicy" >
367-
<sizepolicy>
368-
<hsizetype>5</hsizetype>
369-
<vsizetype>0</vsizetype>
370-
<horstretch>0</horstretch>
371-
<verstretch>0</verstretch>
372-
</sizepolicy>
373-
</property>
346+
<widget class="QgsColorButton" name="pbnCanvasColor" >
374347
<property name="minimumSize" >
375348
<size>
376-
<width>80</width>
349+
<width>100</width>
377350
<height>0</height>
378351
</size>
379352
</property>
@@ -382,6 +355,19 @@
382355
</property>
383356
</widget>
384357
</item>
358+
<item>
359+
<spacer>
360+
<property name="orientation" >
361+
<enum>Qt::Horizontal</enum>
362+
</property>
363+
<property name="sizeHint" >
364+
<size>
365+
<width>40</width>
366+
<height>20</height>
367+
</size>
368+
</property>
369+
</spacer>
370+
</item>
385371
</layout>
386372
</widget>
387373
</item>
@@ -419,7 +405,7 @@
419405
</widget>
420406
</item>
421407
<item row="1" column="0" >
422-
<widget class="QgsProjectionSelector" name="projectionSelector" />
408+
<widget class="QgsProjectionSelector" native="1" name="projectionSelector" />
423409
</item>
424410
</layout>
425411
</widget>
@@ -497,14 +483,17 @@
497483
</layout>
498484
</widget>
499485
<layoutdefault spacing="6" margin="11" />
500-
<pixmapfunction></pixmapfunction>
501486
<customwidgets>
502487
<customwidget>
503488
<class>QgsProjectionSelector</class>
504489
<extends>QWidget</extends>
505490
<header>qgsprojectionselector.h</header>
506491
<container>1</container>
507-
<pixmap></pixmap>
492+
</customwidget>
493+
<customwidget>
494+
<class>QgsColorButton</class>
495+
<extends>QToolButton</extends>
496+
<header>qgscolorbutton.h</header>
508497
</customwidget>
509498
</customwidgets>
510499
<tabstops>

‎src/ui/qgssinglesymboldialogbase.ui

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<x>0</x>
77
<y>0</y>
88
<width>413</width>
9-
<height>453</height>
9+
<height>486</height>
1010
</rect>
1111
</property>
1212
<property name="sizePolicy" >
@@ -554,17 +554,11 @@
554554
</widget>
555555
</item>
556556
<item row="0" column="3" >
557-
<widget class="QToolButton" name="btnOutlineColor" >
557+
<widget class="QgsColorButton" name="btnOutlineColor" >
558558
<property name="minimumSize" >
559559
<size>
560560
<width>100</width>
561-
<height>22</height>
562-
</size>
563-
</property>
564-
<property name="maximumSize" >
565-
<size>
566-
<width>100</width>
567-
<height>22</height>
561+
<height>0</height>
568562
</size>
569563
</property>
570564
<property name="text" >
@@ -573,25 +567,11 @@
573567
</widget>
574568
</item>
575569
<item row="2" column="3" >
576-
<widget class="QToolButton" name="btnFillColor" >
577-
<property name="sizePolicy" >
578-
<sizepolicy>
579-
<hsizetype>4</hsizetype>
580-
<vsizetype>1</vsizetype>
581-
<horstretch>0</horstretch>
582-
<verstretch>0</verstretch>
583-
</sizepolicy>
584-
</property>
570+
<widget class="QgsColorButton" name="btnFillColor" >
585571
<property name="minimumSize" >
586572
<size>
587573
<width>100</width>
588-
<height>22</height>
589-
</size>
590-
</property>
591-
<property name="maximumSize" >
592-
<size>
593-
<width>100</width>
594-
<height>22</height>
574+
<height>0</height>
595575
</size>
596576
</property>
597577
<property name="text" >
@@ -958,6 +938,13 @@
958938
</widget>
959939
<layoutdefault spacing="6" margin="11" />
960940
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
941+
<customwidgets>
942+
<customwidget>
943+
<class>QgsColorButton</class>
944+
<extends>QToolButton</extends>
945+
<header>qgscolorbutton.h</header>
946+
</customwidget>
947+
</customwidgets>
961948
<tabstops>
962949
<tabstop>mLabelEdit</tabstop>
963950
<tabstop>mPointSymbolComboBox</tabstop>

0 commit comments

Comments
 (0)
Please sign in to comment.