110 changes: 60 additions & 50 deletions src/app/composer/qgscomposeritemwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ void QgsComposerItemWidget::on_mFrameColorButton_clicked()
{
return;
}
}

QColor newFrameColor = QColorDialog::getColor( mItem->pen().color(), 0 );
if ( !newFrameColor.isValid() )
void QgsComposerItemWidget::on_mFrameColorButton_colorChanged( const QColor& newFrameColor )
{
if ( !mItem )
{
return; //dialog canceled
return;
}

mItem->beginCommand( tr( "Frame color changed" ) );
QPen thePen;
thePen.setColor( newFrameColor );
Expand All @@ -89,15 +90,17 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_clicked()
{
return;
}
}

QColor newBackgroundColor = QColorDialog::getColor( mItem->brush().color(), 0 );
if ( !newBackgroundColor.isValid() )
void QgsComposerItemWidget::on_mBackgroundColorButton_colorChanged( const QColor& newBackgroundColor )
{
if ( !mItem )
{
return; //dialog canceled
return;
}

// QColor newColor( newBackgroundColor );
mItem->beginCommand( tr( "Background color changed" ) );
newBackgroundColor.setAlpha( 255 - ( mTransparencySpinBox->value() * 2.55 ) );
// newColor.setAlpha( 255 - ( mTransparencySpinBox->value() * 2.55 ) );
mItem->setBrush( QBrush( QColor( newBackgroundColor ), Qt::SolidPattern ) );
//if the item is a composer map, we need to regenerate the map image
//because it usually is cached
Expand All @@ -110,39 +113,39 @@ void QgsComposerItemWidget::on_mBackgroundColorButton_clicked()
mItem->endCommand();
}

void QgsComposerItemWidget::on_mTransparencySpinBox_valueChanged( int value )
{
if ( !mItem )
{
return;
}

mTransparencySlider->blockSignals( true );
mTransparencySlider->setValue( value );
mTransparencySlider->blockSignals( false );
changeItemTransparency( value );
}

void QgsComposerItemWidget::on_mTransparencySlider_valueChanged( int value )
{
if ( !mItem )
{
return;
}
// do item updates only off of mTransparencySpinBox valueChanged
mTransparencySpinBox->setValue( value );
}

void QgsComposerItemWidget::changeItemTransparency( int value )
{
mItem->beginCommand( tr( "Item transparency changed" ) );
QBrush itemBrush = mItem->brush();
QColor brushColor = itemBrush.color();
brushColor.setAlpha( 255 - ( value * 2.55 ) );
mItem->setBrush( QBrush( brushColor ) );
mItem->update();
mItem->endCommand();
}
//void QgsComposerItemWidget::on_mTransparencySpinBox_valueChanged( int value )
//{
// if ( !mItem )
// {
// return;
// }

// mTransparencySlider->blockSignals( true );
// mTransparencySlider->setValue( value );
// mTransparencySlider->blockSignals( false );
// changeItemTransparency( value );
//}

//void QgsComposerItemWidget::on_mTransparencySlider_valueChanged( int value )
//{
// if ( !mItem )
// {
// return;
// }
// // do item updates only off of mTransparencySpinBox valueChanged
// mTransparencySpinBox->setValue( value );
//}

//void QgsComposerItemWidget::changeItemTransparency( int value )
//{
// mItem->beginCommand( tr( "Item transparency changed" ) );
// QBrush itemBrush = mItem->brush();
// QColor brushColor = itemBrush.color();
// brushColor.setAlpha( 255 - ( value * 2.55 ) );
// mItem->setBrush( QBrush( brushColor ) );
// mItem->update();
// mItem->endCommand();
//}

void QgsComposerItemWidget::changeItemPosition()
{
Expand Down Expand Up @@ -344,30 +347,37 @@ void QgsComposerItemWidget::setValuesForGuiElements()

setValuesForGuiPositionElements();

mTransparencySlider->blockSignals( true );
// mTransparencySlider->blockSignals( true );
mOutlineWidthSpinBox->blockSignals( true );
mFrameGroupBox->blockSignals( true );
mBackgroundGroupBox->blockSignals( true );
mItemIdLineEdit->blockSignals( true );
mItemUuidLineEdit->blockSignals( true );
mTransparencySpinBox->blockSignals( true );

int alphaPercent = ( 255 - mItem->brush().color().alpha() ) / 2.55;
mTransparencySpinBox->setValue( alphaPercent );
mTransparencySlider->setValue( alphaPercent );
// mTransparencySpinBox->blockSignals( true );

mBackgroundColorButton->setColor( mItem->brush().color() );
mBackgroundColorButton->setColorDialogTitle( tr( "Select background color" ) );
mBackgroundColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
// int alphaPercent = ( 255 - mItem->brush().color().alpha() ) / 2.55;
// mTransparencySpinBox->setValue( alphaPercent );
// mTransparencySlider->setValue( alphaPercent );

mFrameColorButton->setColor( mItem->pen().color() );
mFrameColorButton->setColorDialogTitle( tr( "Select frame color" ) );
mFrameColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mOutlineWidthSpinBox->setValue( mItem->pen().widthF() );
mItemIdLineEdit->setText( mItem->id() );
mItemUuidLineEdit->setText( mItem->uuid() );
mFrameGroupBox->setChecked( mItem->hasFrame() );
mBackgroundGroupBox->setChecked( mItem->hasBackground() );

mTransparencySlider->blockSignals( false );
// mTransparencySlider->blockSignals( false );
mOutlineWidthSpinBox->blockSignals( false );
mFrameGroupBox->blockSignals( false );
mBackgroundGroupBox->blockSignals( false );
mItemIdLineEdit->blockSignals( false );
mItemUuidLineEdit->blockSignals( false );
mTransparencySpinBox->blockSignals( false );
// mTransparencySpinBox->blockSignals( false );
}


Expand Down
14 changes: 11 additions & 3 deletions src/app/composer/qgscomposeritemwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,17 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa

public slots:
void on_mFrameColorButton_clicked();
/** Set the frame color
* @note added in 1.9
*/
void on_mFrameColorButton_colorChanged( const QColor& newFrameColor );
void on_mBackgroundColorButton_clicked();
void on_mTransparencySlider_valueChanged( int value );
void on_mTransparencySpinBox_valueChanged( int value );
/** Set the background color
* @note added in 1.9
*/
void on_mBackgroundColorButton_colorChanged( const QColor& newBackgroundColor );
// void on_mTransparencySlider_valueChanged( int value );
// void on_mTransparencySpinBox_valueChanged( int value );
void on_mOutlineWidthSpinBox_valueChanged( double d );
void on_mFrameGroupBox_toggled( bool state );
void on_mBackgroundGroupBox_toggled( bool state );
Expand All @@ -67,7 +75,7 @@ class QgsComposerItemWidget: public QWidget, private Ui::QgsComposerItemWidgetBa

private:
QgsComposerItemWidget();
void changeItemTransparency( int value );
// void changeItemTransparency( int value );
void changeItemPosition();

QgsComposerItem* mItem;
Expand Down
14 changes: 3 additions & 11 deletions src/app/composer/qgscomposertablewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,24 +265,14 @@ void QgsComposerTableWidget::on_mGridStrokeWidthSpinBox_valueChanged( double d )
mComposerTable->endCommand();
}

void QgsComposerTableWidget::on_mGridColorButton_clicked()
void QgsComposerTableWidget::on_mGridColorButton_colorChanged( const QColor& newColor )
{
if ( !mComposerTable )
{
return;
}

#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mComposerTable->gridColor(), 0, tr( "Select grid color" ) );
#else
QColor newColor = QColorDialog::getColor( mComposerTable->gridColor(), 0 );
#endif
if ( !newColor.isValid() )
{
return;
}
mComposerTable->beginCommand( tr( "Table grid color" ) );
mGridColorButton->setColor( newColor );
mComposerTable->setGridColor( newColor );
mComposerTable->update();
mComposerTable->endCommand();
Expand Down Expand Up @@ -336,6 +326,8 @@ void QgsComposerTableWidget::updateGuiElements()
mMarginSpinBox->setValue( mComposerTable->lineTextDistance() );
mGridStrokeWidthSpinBox->setValue( mComposerTable->gridStrokeWidth() );
mGridColorButton->setColor( mComposerTable->gridColor() );
mGridColorButton->setColorDialogTitle( tr( "Select grid color" ) );
mGridColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
if ( mComposerTable->showGrid() )
{
mShowGridGroupCheckBox->setChecked( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposertablewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class QgsComposerTableWidget: public QWidget, private Ui::QgsComposerTableWidget
void on_mMaximumColumnsSpinBox_valueChanged( int i );
void on_mMarginSpinBox_valueChanged( double d );
void on_mGridStrokeWidthSpinBox_valueChanged( double d );
void on_mGridColorButton_clicked();
void on_mGridColorButton_colorChanged( const QColor& newColor );
void on_mHeaderFontPushButton_clicked();
void on_mContentFontPushButton_clicked();
void on_mShowGridGroupCheckBox_toggled( bool state );
Expand Down
2 changes: 2 additions & 0 deletions src/app/composer/qgscompositionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )

//grid pen color
mGridColorButton->setColor( mComposition->gridPen().color() );
mGridColorButton->setColorDialogTitle( tr( "Select grid color" ) );
mGridColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

mGridStyleComboBox->insertItem( 0, tr( "Solid" ) );
mGridStyleComboBox->insertItem( 1, tr( "Dots" ) );
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgscontinuouscolordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,11 @@ void QgsContinuousColorDialog::apply()
void QgsContinuousColorDialog::selectMinimumColor( const QColor& color )
{
Q_UNUSED( color )
activateWindow();
}

void QgsContinuousColorDialog::selectMaximumColor( const QColor& color )
{
Q_UNUSED( color )
activateWindow();
}

void QgsContinuousColorDialog::on_cb_polygonOutline_clicked()
Expand Down
15 changes: 5 additions & 10 deletions src/app/qgsdecorationcopyrightdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,12 @@ void QgsDecorationCopyrightDialog::on_buttonBox_rejected()
reject();
}

void QgsDecorationCopyrightDialog::on_pbnColorChooser_clicked()
void QgsDecorationCopyrightDialog::on_pbnColorChooser_colorChanged( const QColor& c )
{
QColor c = QColorDialog::getColor();
if ( c.isValid() )
{
pbnColorChooser->setColor( c );
QTextCursor cursor = txtCopyrightText->textCursor();
txtCopyrightText->selectAll();
txtCopyrightText->setTextColor( c );
txtCopyrightText->setTextCursor( cursor );
}
QTextCursor cursor = txtCopyrightText->textCursor();
txtCopyrightText->selectAll();
txtCopyrightText->setTextColor( c );
txtCopyrightText->setTextCursor( cursor );
}

void QgsDecorationCopyrightDialog::on_buttonBox_helpRequested()
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationcopyrightdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class QgsDecorationCopyrightDialog : public QDialog, private Ui::QgsDecorationCo
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_buttonBox_helpRequested();
void on_pbnColorChooser_clicked();
void on_pbnColorChooser_colorChanged( const QColor& c );

protected:
QgsDecorationCopyright& mDeco;
Expand Down
7 changes: 7 additions & 0 deletions src/app/qgslabelinggui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM
mBufferJoinStyleComboBox->setPenJoinStyle( lyr.bufferJoinStyle );
mBufferTranspFillChbx->setChecked( !lyr.bufferNoFill );
}
else
{
// default color
// TODO: remove after moving to persistent PAL settings?
btnBufferColor->setColor( Qt::white );
}

bool formattedNumbers = lyr.formatNumbers;
bool plusSign = lyr.plusSign;
Expand Down Expand Up @@ -360,6 +366,7 @@ void QgsLabelingGui::collapseSample( bool collapse )
void QgsLabelingGui::apply()
{
writeSettingsToLayer();
QgisApp::instance()->markDirty();
// trigger refresh
if ( mMapCanvas )
{
Expand Down
93 changes: 70 additions & 23 deletions src/app/qgslabelpropertydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const
mHaliComboBox->setCurrentIndex( mHaliComboBox->findText( "Left" ) );
mValiComboBox->setCurrentIndex( mValiComboBox->findText( "Bottom" ) );
mFontColorButton->setColorDialogTitle( tr( "Font color" ) );
mFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
mBufferColorButton->setColorDialogTitle( tr( "Buffer color" ) );
mBufferColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

disableGuiElements();

Expand All @@ -121,49 +119,91 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const

for ( ; propIt != mDataDefinedProperties.constEnd(); ++propIt )
{
bool ok = false;
switch ( propIt.key() )
{
case QgsPalLayerSettings::Show:
{ // new scope to assign variables
mShowLabelChkbx->setEnabled( true );
bool showSuccess;
int showLabel = mCurLabelFeat.attribute( propIt.value() ).toInt( &showSuccess );
mShowLabelChkbx->setChecked( !showSuccess || showLabel != 0 );
int showLabel = mCurLabelFeat.attribute( propIt.value() ).toInt( &ok );
mShowLabelChkbx->setChecked( !ok || showLabel != 0 );
break;
}
case QgsPalLayerSettings::AlwaysShow:
mAlwaysShowChkbx->setEnabled( true );
mAlwaysShowChkbx->setChecked( mCurLabelFeat.attribute( propIt.value() ).toBool() );
break;
case QgsPalLayerSettings::MinScale:
mMinScaleSpinBox->setEnabled( true );
mMinScaleSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toInt() );
{
int minScale = mCurLabelFeat.attribute( propIt.value() ).toInt( &ok );
if ( ok )
{
mMinScaleSpinBox->setEnabled( true );
mMinScaleSpinBox->setValue( minScale );
}
break;
}
case QgsPalLayerSettings::MaxScale:
mMaxScaleSpinBox->setEnabled( true );
mMaxScaleSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toInt() );
{
int maxScale = mCurLabelFeat.attribute( propIt.value() ).toInt( &ok );
if ( ok )
{
mMaxScaleSpinBox->setEnabled( true );
mMaxScaleSpinBox->setValue( maxScale );
}
break;
}
case QgsPalLayerSettings::Size:
mFontSizeSpinBox->setEnabled( true );
mLabelFont.setPointSizeF( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
mFontSizeSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double fontSize = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mFontSizeSpinBox->setEnabled( true );
mLabelFont.setPointSizeF( fontSize );
mFontSizeSpinBox->setValue( fontSize );
}
break;
}
case QgsPalLayerSettings::BufferSize:
mBufferSizeSpinBox->setEnabled( true );
mBufferSizeSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double bufferSize = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mBufferSizeSpinBox->setEnabled( true );
mBufferSizeSpinBox->setValue( bufferSize );
}
break;
}
case QgsPalLayerSettings::PositionX:
mXCoordSpinBox->setEnabled( true );
mXCoordSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double posX = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mXCoordSpinBox->setEnabled( true );
mXCoordSpinBox->setValue( posX );
}
break;
}
case QgsPalLayerSettings::PositionY:
mYCoordSpinBox->setEnabled( true );
mYCoordSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double posY = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mYCoordSpinBox->setEnabled( true );
mYCoordSpinBox->setValue( posY );
}
break;
}
case QgsPalLayerSettings::LabelDistance:
mLabelDistanceSpinBox->setEnabled( true );
mLabelDistanceSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double labelDist = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mLabelDistanceSpinBox->setEnabled( true );
mLabelDistanceSpinBox->setValue( labelDist );
}
break;
}
case QgsPalLayerSettings::Hali:
mHaliComboBox->setEnabled( true );
mHaliComboBox->setCurrentIndex( mHaliComboBox->findText( mCurLabelFeat.attribute( propIt.value() ).toString() ) );
Expand All @@ -181,11 +221,17 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const
mFontColorButton->setColor( QColor( mCurLabelFeat.attribute( propIt.value() ).toString() ) );
break;
case QgsPalLayerSettings::Rotation:
mRotationSpinBox->setEnabled( true );
mRotationSpinBox->setValue( mCurLabelFeat.attribute( propIt.value() ).toDouble() );
{
double rot = mCurLabelFeat.attribute( propIt.value() ).toDouble( &ok );
if ( ok )
{
mRotationSpinBox->setEnabled( true );
mRotationSpinBox->setValue( rot );
}
break;
}

//font related properties
//font related properties
case QgsPalLayerSettings::Bold:
mLabelFont.setBold( mCurLabelFeat.attribute( propIt.value() ).toBool() );
break;
Expand Down Expand Up @@ -237,6 +283,7 @@ void QgsLabelPropertyDialog::blockElementSignals( bool block )
mFontSizeSpinBox->blockSignals( block );
mBufferSizeSpinBox->blockSignals( block );
mFontPushButton->blockSignals( block );
mFontColorButton->blockSignals( block );
mBufferColorButton->blockSignals( block );
mLabelDistanceSpinBox->blockSignals( block );
mXCoordSpinBox->blockSignals( block );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

QString name = QApplication::style()->objectName();
cmbStyle->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) );

mLiveColorDialogsChkBx->setChecked( settings.value( "/qgis/live_color_dialogs", false ).toBool() );

//set the state of the checkboxes
//Changed to default to true as of QGIS 1.7
chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() );
Expand Down Expand Up @@ -1085,6 +1088,8 @@ void QgsOptions::saveOptions()

settings.setValue( "/qgis/messageTimeout", mMessageTimeoutSpnBx->value() );

settings.setValue( "/qgis/live_color_dialogs", mLiveColorDialogsChkBx->isChecked() );

// rasters settings
settings.setValue( "/Raster/defaultRedBand", spnRed->value() );
settings.setValue( "/Raster/defaultGreenBand", spnGreen->value() );
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgssinglesymboldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,12 @@ void QgsSingleSymbolDialog::selectOutlineColor( const QColor& color )
{
Q_UNUSED( color )
emit settingsChanged();
activateWindow();
}

void QgsSingleSymbolDialog::selectFillColor( const QColor& color )
{
Q_UNUSED( color )
emit settingsChanged();
activateWindow();
}

//should this method have a different name?
Expand Down
3 changes: 3 additions & 0 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ qgsattributeeditor.cpp
qgslegendinterface.cpp
qgscharacterselectdialog.cpp
qgscolorbutton.cpp
qgscolordialog.cpp
qgscomposerview.cpp
qgscursors.cpp
qgsdetaileditemdelegate.cpp
Expand Down Expand Up @@ -156,6 +157,7 @@ attributetable/qgsattributetabledelegate.h

qgsattributeeditor.h
qgscharacterselectdialog.h
qgscolordialog.h
qgscomposerview.h
qgsdetaileditemdelegate.h
qgsdetaileditemwidget.h
Expand Down Expand Up @@ -205,6 +207,7 @@ SET(QGIS_GUI_HDRS
qgisgui.h
qgisinterface.h
qgscharacterselectdialog.h
qgscolordialog.h
qgscursors.h
qgsencodingfiledialog.h
qgsfiledropedit.h
Expand Down
260 changes: 199 additions & 61 deletions src/gui/qgscolorbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,78 +14,250 @@
***************************************************************************/

#include "qgscolorbutton.h"
#include "qgscolordialog.h"
#include "qgsapplication.h"
#include "qgslogger.h"

#include <QPainter>
#include <QSettings>
#include <QTemporaryFile>

/*!
\class QgsColorButton
\brief The QgsColorButton class provides a tool button widget displaying
a color which can be altered by calling QColorDialog::getColor.
\brief A cross platform button subclass for selecting colors. Will open a color chooser dialog when clicked.
Offers live updates to button from color chooser dialog
A subclass of QToolButton is needed to draw the button content because
A subclass of QPushButton 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.
Therefore, a wholely stylesheet-based button is used for the no-text variant.
This class is a simplified version of QtColorButton, an internal class used
by Qt Designer to do the same thing.
*/

QgsColorButton::QgsColorButton( QWidget *parent, QString cdt, QColorDialog::ColorDialogOptions cdo )
: QToolButton( parent )
, mColorDialogTitle( cdt )
: QPushButton( parent )
, mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt )
, mColor( Qt::black )
, mColorDialogOptions( cdo )
, mAcceptLiveUpdates( true )
, mTempPNG( NULL )
{
setToolButtonStyle( Qt::ToolButtonTextOnly ); // decrease default button height
connect( this, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
}

QgsColorButton::~QgsColorButton()
{}
{
mTempPNG.remove();
}

const QPixmap& QgsColorButton::transpBkgrd()
{
static QPixmap transpBkgrd;

if ( transpBkgrd.isNull() )
transpBkgrd = QgsApplication::getThemePixmap( "/transp-background_8x8.png" );

return transpBkgrd;
}

void QgsColorButton::onButtonClicked()
{
//QgsDebugMsg( "entered" );
QColor newColor;
#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( color(), 0, mColorDialogTitle, mColorDialogOptions );
QSettings settings;
if ( mAcceptLiveUpdates && settings.value( "/qgis/live_color_dialogs", false ).toBool() )
{
newColor = QgsColorDialog::getLiveColor(
color(), this, "setValidColor( const QColor& )",
this->parentWidget(), mColorDialogTitle, mColorDialogOptions );
}
else
{
newColor = QColorDialog::getColor( color(), this->parentWidget(), mColorDialogTitle, mColorDialogOptions );
}
#else
QColor newColor = QColorDialog::getColor( color() );
newColor = QColorDialog::getColor( color(), this->parentWidget() );
#endif
setValidColor( newColor );

// reactivate button's window
activateWindow();
}

void QgsColorButton::setValidColor( const QColor& newColor )
{
if ( newColor.isValid() )
{
setColor( newColor );
}
}

/*!
Paints button in response to a paint event.
*/
void QgsColorButton::paintEvent( QPaintEvent *e )
void QgsColorButton::changeEvent( QEvent* e )
{
QToolButton::paintEvent( e );
if (
#ifdef Q_WS_MAC
// Mac shows color only a when a window is active
isActiveWindow() &&
#endif
isEnabled() )
if ( e->type() == QEvent::EnabledChange )
{
QPainter p( this );
int margin = 2; // Leave some space for highlighting
QRect r = rect().adjusted( margin, margin, -margin, -margin );
p.fillRect( r, mColor );
setButtonBackground();
}
QPushButton::changeEvent( e );
}

void QgsColorButton::paintEvent( QPaintEvent* e )
{
setButtonBackground();
QPushButton::paintEvent( e );
}

void QgsColorButton::setColor( const QColor &color )
{
if ( !color.isValid() )
{
return;
}
QColor oldColor = mColor;

mColor = color;
update();

if ( oldColor != mColor )
{
emit( colorChanged( mColor ) );
setButtonBackground();
if ( isEnabled() )
{
// TODO: May be beneficial to have the option to set color without emitting this signal.
// Now done by blockSignals( bool ) where button is used
emit( colorChanged( mColor ) );
}
}
}

void QgsColorButton::setButtonBackground()
{
if ( !text().isEmpty() )
{
// generate icon pixmap for regular pushbutton
setFlat( false );

QPixmap pixmap;
pixmap = QPixmap( iconSize() );
pixmap.fill( QColor( 0, 0, 0, 0 ) );

int iconW = iconSize().width();
int iconH = iconSize().height();
QRect rect( 0, 0, iconW, iconH );

// QPainterPath::addRoundRect has flaws, draw chamfered corners instead
QPainterPath roundRect;
int chamfer = 3;
int inset = 1;
roundRect.moveTo( chamfer, inset );
roundRect.lineTo( iconW - chamfer, inset );
roundRect.lineTo( iconW - inset, chamfer );
roundRect.lineTo( iconW - inset, iconH - chamfer );
roundRect.lineTo( iconW - chamfer, iconH - inset );
roundRect.lineTo( chamfer, iconH - inset );
roundRect.lineTo( inset, iconH - chamfer );
roundRect.lineTo( inset, chamfer );
roundRect.closeSubpath();

QPainter p;
p.begin( &pixmap );
p.setRenderHint( QPainter::Antialiasing );
p.setClipPath( roundRect );
p.setPen( Qt::NoPen );
if ( mColor.alpha() < 255 )
{
p.drawTiledPixmap( rect, transpBkgrd() );
}
p.setBrush( mColor );
p.drawRect( rect );
p.end();

// set this pixmap as icon
setIcon( QIcon( pixmap ) );
}
else
{
// generate temp background image file with checkerboard canvas to be used via stylesheet

// set flat, or inline spacing (widget margins) needs to be manually calcualted and set
setFlat( true );

bool useAlpha = ( mColorDialogOptions & QColorDialog::ShowAlphaChannel );

QColor tmpColor( mColor );
QString border( "110" );
if ( !isEnabled() ) // fake disabled look (use just Qt::lightGray instead?)
{
int tmpValue = ( 255 - tmpColor.value() ) / 3 + tmpColor.value();
tmpColor.setHsv( tmpColor.hue(), tmpColor.saturation() / 2, tmpValue, useAlpha ? tmpColor.alpha() : 255 );

border = "128";
}

// in case margins need to be adjusted
QString margin = QString( "%1px %2px %3px %4px" ).arg( 0 ).arg( 0 ).arg( 0 ).arg( 0 );

//QgsDebugMsg( QString( "%1 margin: %2" ).arg( objectName() ).arg( margin ) );

QString bkgrd = QString( " background-color: rgba(%1,%2,%3,%4);" )
.arg( tmpColor.red() )
.arg( tmpColor.green() )
.arg( tmpColor.blue() )
.arg( useAlpha ? tmpColor.alpha() : 255 );

if ( useAlpha && tmpColor.alpha() < 255 )
{
QPixmap pixmap = transpBkgrd();
QRect rect( 0, 0, pixmap.width(), pixmap.height() );

QPainter p;
p.begin( &pixmap );
p.setRenderHint( QPainter::Antialiasing );
p.setPen( Qt::NoPen );
p.setBrush( tmpColor );
p.drawRect( rect );
p.end();

if ( mTempPNG.open() )
{
mTempPNG.setAutoRemove( false );
pixmap.save( mTempPNG.fileName(), "PNG" );
mTempPNG.close();
}

bkgrd = QString( " background-image: url(%1);" ).arg( mTempPNG.fileName() );
}

//QgsDebugMsg( QString( "%1" ).arg( bkgrd ) );

setStyleSheet( QString( "QgsColorButton{"
" %1"
" background-position: top left;"
" background-origin: content;"
" background-clip: content;"
" padding: 2px;"
" margin: %2;"
" border-style: outset;"
" border-width: 1px;"
" border-color: rgb(%3,%3,%3);"
" border-radius: 3px;} "
"QgsColorButton:pressed{"
" %1"
" background-position: top left;"
" background-origin: content;"
" background-clip: content;"
" padding: 1px;"
" margin: %2;"
" border-style: inset;"
" border-width: 2px;"
" border-color: rgb(128,128,128);"
" border-radius: 4px;} " )
.arg( bkgrd )
.arg( margin )
.arg( border ) );
}
}

Expand Down Expand Up @@ -113,37 +285,3 @@ QString QgsColorButton::colorDialogTitle()
{
return mColorDialogTitle;
}

//////////////////

QgsColorButtonV2::QgsColorButtonV2( QWidget* parent )
: QPushButton( parent )
{
}

QgsColorButtonV2::QgsColorButtonV2( QString text, QWidget* parent )
: QPushButton( text, parent )
{
}

void QgsColorButtonV2::setColor( const QColor &color )
{
mColor = color;

QPixmap pixmap( iconSize() );
pixmap.fill( QColor( 0, 0, 0, 0 ) );

QRect rect( 1, 1, iconSize().width() - 2, iconSize().height() - 2 );

// draw a slightly rounded rectangle
QPainter p;
p.begin( &pixmap );
p.setPen( Qt::NoPen );
p.setRenderHint( QPainter::Antialiasing );
p.setBrush( color );
p.drawRoundedRect( rect, 4, 4 );
p.end();

// set this pixmap as icon
setIcon( QIcon( pixmap ) );
}
62 changes: 43 additions & 19 deletions src/gui/qgscolorbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@
#define QGSCOLORBUTTON_H

#include <QColorDialog>
#include <QToolButton>
#include <QPushButton>
#include <QTemporaryFile>


/** \ingroup gui
* \class QgsColorButton
* A cross platform button subclass for selecting colors. Will open a color chooser dialog when clicked.
* Offers live updates to button from color chooser dialog
* @note inherited base class moved from QToolButton to QPushButton in QGIS 1.9
*/
class GUI_EXPORT QgsColorButton: public QToolButton

class GUI_EXPORT QgsColorButton: public QPushButton
{
Q_OBJECT
Q_OBJECT

public:
/**
Expand All @@ -35,7 +40,7 @@ class GUI_EXPORT QgsColorButton: public QToolButton
* @param cdo Options for the color chooser dialog
* @note changed in 1.9
*/
QgsColorButton( QWidget *parent = 0, QString cdt = tr( "Select Color" ), QColorDialog::ColorDialogOptions cdo = 0 );
QgsColorButton( QWidget *parent = 0, QString cdt = "", QColorDialog::ColorDialogOptions cdo = 0 );
~QgsColorButton();

/**
Expand Down Expand Up @@ -85,11 +90,20 @@ class GUI_EXPORT QgsColorButton: public QToolButton
*/
QString colorDialogTitle();

protected:
void paintEvent( QPaintEvent *e );
/**
* Whether the button accepts live updates from QColorDialog.
*
* @note added in 1.9
*/
bool acceptLiveUpdates() { return mAcceptLiveUpdates; }

public slots:
void onButtonClicked();
/**
* Sets whether the button accepts live updates from QColorDialog.
* Live updates may cause changes that are not undoable on QColorDialog cancel.
*
* @note added in 1.9
*/
void setAcceptLiveUpdates( bool accept ) { mAcceptLiveUpdates = accept; }

signals:
/**
Expand All @@ -101,24 +115,34 @@ class GUI_EXPORT QgsColorButton: public QToolButton
*/
void colorChanged( const QColor &color );

protected:
void changeEvent( QEvent* e );
void paintEvent( QPaintEvent* e );
static const QPixmap& transpBkgrd();

private:
QString mColorDialogTitle;
QColor mColor;
QColorDialog::ColorDialogOptions mColorDialogOptions;
};
bool mAcceptLiveUpdates;
QTemporaryFile mTempPNG;

private slots:
void onButtonClicked();

class GUI_EXPORT QgsColorButtonV2 : public QPushButton
{
public:
QgsColorButtonV2( QWidget* parent = 0 );
QgsColorButtonV2( QString text, QWidget* parent = 0 );

void setColor( const QColor &color );
QColor color() const { return mColor; }
/**
* Sets the background pixmap for the button based upon set color and transparency.
*
* @note added in 1.9
*/
void setButtonBackground();

private:
QColor mColor;
/**
* Sets color for button, if valid.
*
* @note added in 1.9
*/
void setValidColor( const QColor& newColor );
};

#endif
53 changes: 53 additions & 0 deletions src/gui/qgscolordialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
qgscolordialog.cpp - color selection dialog
---------------------
begin : March 19, 2013
copyright : (C) 2013 by Larry Shaffer
email : larrys at dakcarto 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. *
* *
***************************************************************************/

#include "qgscolordialog.h"

#include <QMetaObject>

QgsColorDialog::QgsColorDialog()
{
}

QgsColorDialog::~QgsColorDialog()
{
}

QColor QgsColorDialog::getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot,
QWidget* parent,
const QString& title,
QColorDialog::ColorDialogOptions options )
{
QColor returnColor( initialColor );
QColorDialog* liveDialog = new QColorDialog( initialColor, parent );
liveDialog->setWindowTitle( title.isEmpty() ? tr( "Select Color" ) : title );
liveDialog->setOptions( options );
#ifdef Q_WS_MAC
// always use native color dialog on Mac
liveDialog->setOption( QColorDialog::DontUseNativeDialog, false );
#endif
connect( liveDialog, SIGNAL( currentColorChanged( const QColor& ) ),
updateObject, QString( "1%1" ).arg( QString( QMetaObject::normalizedSignature( updateSlot ) ) ).toAscii() );

if ( liveDialog->exec() )
{
returnColor = liveDialog->currentColor();
}
delete liveDialog;
liveDialog = 0;

return returnColor;
}
53 changes: 53 additions & 0 deletions src/gui/qgscolordialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/***************************************************************************
qgscolordialog.h - color selection dialog
---------------------
begin : March 19, 2013
copyright : (C) 2013 by Larry Shaffer
email : larrys at dakcarto 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 QGSCOLORDIALOG_H
#define QGSCOLORDIALOG_H

#include <QColorDialog>
#include "qgisgui.h"

class QColor;

/** \ingroup gui
* \class QgsColorDialog
* A dialog for selecting a color
*/

class GUI_EXPORT QgsColorDialog : public QObject
{
Q_OBJECT

public:
QgsColorDialog();
~QgsColorDialog();

/** Return a color selection from a QColorDialog, with live updating of interim selections.
* @param initialColor The initial color of the selection dialog.
* @param updateObject The receiver object of the live updating.
* @param updateSlot The receiver object's slot for live updating (e.g. "setColor( const QColor& )" ).
* @param parent Parent widget. Usually 0 is best for native system color dialogs.
* @param title The title of the QColorDialog.
* @param options ColorDialogOptions passed to QColorDialog.
* @return Selected color on accepted() or initialColor on rejected().
*/
static QColor getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot,
QWidget* parent = 0,
const QString& title = "",
QColorDialog::ColorDialogOptions options = 0 );
};

#endif // #ifndef QGSCOLORDIALOG_H
32 changes: 14 additions & 18 deletions src/gui/symbology-ng/qgsellipsesymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mOutlineWidthSpinBox->setValue( mLayer->outlineWidth() );

btnChangeColorBorder->setColor( mLayer->outlineColor() );
btnChangeColorBorder->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColorFill->setColor( mLayer->fillColor() );
btnChangeColorFill->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

QList<QListWidgetItem *> symbolItemList = mShapeListWidget->findItems( mLayer->symbolName(), Qt::MatchExactly );
if ( symbolItemList.size() > 0 )
Expand Down Expand Up @@ -190,32 +192,26 @@ void QgsEllipseSymbolLayerV2Widget::on_mOutlineWidthSpinBox_valueChanged( double
}
}

void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorBorder_clicked()
void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorBorder_colorChanged( const QColor& newColor )
{
if ( mLayer )
if ( !mLayer )
{
QColor newColor = QColorDialog::getColor( mLayer->outlineColor(), this, "", QColorDialog::ShowAlphaChannel );
if ( newColor.isValid() )
{
mLayer->setOutlineColor( newColor );
btnChangeColorBorder->setColor( newColor );
emit changed();
}
return;
}

mLayer->setOutlineColor( newColor );
emit changed();
}

void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorFill_clicked()
void QgsEllipseSymbolLayerV2Widget::on_btnChangeColorFill_colorChanged( const QColor& newColor )
{
if ( mLayer )
if ( !mLayer )
{
QColor newColor = QColorDialog::getColor( mLayer->fillColor(), this, "", QColorDialog::ShowAlphaChannel );
if ( newColor.isValid() )
{
mLayer->setFillColor( newColor );
btnChangeColorFill->setColor( newColor );
emit changed();
}
return;
}

mLayer->setFillColor( newColor );
emit changed();
}

void QgsEllipseSymbolLayerV2Widget::fillDataDefinedComboBoxes()
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgsellipsesymbollayerv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class GUI_EXPORT QgsEllipseSymbolLayerV2Widget: public QgsSymbolLayerV2Widget, p
void on_mHeightSpinBox_valueChanged( double d );
void on_mRotationSpinBox_valueChanged( double d );
void on_mOutlineWidthSpinBox_valueChanged( double d );
void on_btnChangeColorBorder_clicked();
void on_btnChangeColorFill_clicked();
void on_btnChangeColorBorder_colorChanged( const QColor& newColor );
void on_btnChangeColorFill_colorChanged( const QColor& newColor );

void on_mDDSymbolWidthComboBox_currentIndexChanged( int idx );
void on_mDDSymbolHeightComboBox_currentIndexChanged( int idx );
Expand Down
26 changes: 4 additions & 22 deletions src/gui/symbology-ng/qgspointdisplacementrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,42 +222,24 @@ void QgsPointDisplacementRendererWidget::on_mCircleWidthSpinBox_valueChanged( do
}
}

void QgsPointDisplacementRendererWidget::on_mCircleColorButton_clicked()
void QgsPointDisplacementRendererWidget::on_mCircleColorButton_colorChanged( const QColor& newColor )
{
if ( !mRenderer )
{
return;
}

#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mRenderer->circleColor(), 0, tr( "Circle color" ), QColorDialog::ShowAlphaChannel );
#else
QColor newColor = QColorDialog::getColor( mRenderer->circleColor() );
#endif
if ( newColor.isValid() )
{
mRenderer->setCircleColor( newColor );
mCircleColorButton->setColor( newColor );
}
mRenderer->setCircleColor( newColor );
}

void QgsPointDisplacementRendererWidget::on_mLabelColorButton_clicked()
void QgsPointDisplacementRendererWidget::on_mLabelColorButton_colorChanged( const QColor& newColor )
{
if ( !mRenderer )
{
return;
}

#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mRenderer->labelColor(), 0, tr( "Label color" ), QColorDialog::ShowAlphaChannel );
#else
QColor newColor = QColorDialog::getColor( mRenderer->labelColor() );
#endif
if ( newColor.isValid() )
{
mRenderer->setLabelColor( newColor );
mLabelColorButton->setColor( newColor );
}
mRenderer->setLabelColor( newColor );
}

void QgsPointDisplacementRendererWidget::on_mCircleModificationSpinBox_valueChanged( double d )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/symbology-ng/qgspointdisplacementrendererwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class GUI_EXPORT QgsPointDisplacementRendererWidget: public QgsRendererV2Widget,
void on_mRendererComboBox_currentIndexChanged( int index );
void on_mLabelFontButton_clicked();
void on_mCircleWidthSpinBox_valueChanged( double d );
void on_mCircleColorButton_clicked();
void on_mCircleColorButton_colorChanged( const QColor& newColor );
void on_mDistanceSpinBox_valueChanged( double d );
void on_mLabelColorButton_clicked();
void on_mLabelColorButton_colorChanged( const QColor& newColor );
void on_mCircleModificationSpinBox_valueChanged( double d );
void on_mScaleDependentLabelsCheckBox_stateChanged( int state );
void on_mMaxScaleDenominatorEdit_textChanged( const QString & text );
Expand Down
11 changes: 7 additions & 4 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void QgsRuleBasedRendererV2Widget::addRule()
QgsSymbolV2* s = QgsSymbolV2::defaultSymbol( mLayer->geometryType() );
QgsRuleBasedRendererV2::Rule* newrule = new QgsRuleBasedRendererV2::Rule( s );

QgsRendererRulePropsDialog dlg( newrule, mLayer, mStyle );
QgsRendererRulePropsDialog dlg( newrule, mLayer, mStyle, this );
if ( dlg.exec() )
{
QgsRuleBasedRendererV2::Rule* current = currentRule();
Expand Down Expand Up @@ -159,7 +159,7 @@ void QgsRuleBasedRendererV2Widget::editRule( const QModelIndex& index )
return;
QgsRuleBasedRendererV2::Rule* rule = mModel->ruleForIndex( index );

QgsRendererRulePropsDialog dlg( rule, mLayer, mStyle );
QgsRendererRulePropsDialog dlg( rule, mLayer, mStyle, this );
if ( dlg.exec() )
{
// model should know about the change and emit dataChanged signal for the view
Expand Down Expand Up @@ -478,10 +478,13 @@ void QgsRuleBasedRendererV2Widget::countFeatures()

///////////

QgsRendererRulePropsDialog::QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style )
: mRule( rule ), mLayer( layer ), mSymbolSelector( NULL ), mSymbol( NULL )
QgsRendererRulePropsDialog::QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent )
: QDialog( parent ), mRule( rule ), mLayer( layer ), mSymbolSelector( NULL ), mSymbol( NULL )
{
setupUi( this );
#ifdef Q_WS_MAC
setWindowModality( Qt::WindowModal );
#endif

connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgsrulebasedrendererv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class GUI_EXPORT QgsRendererRulePropsDialog : public QDialog, private Ui::QgsRen
Q_OBJECT

public:
QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style );
QgsRendererRulePropsDialog( QgsRuleBasedRendererV2::Rule* rule, QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent = 0 );
~QgsRendererRulePropsDialog();

QgsRuleBasedRendererV2::Rule* rule() { return mRule; }
Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
: QDialog( parent ), mStyle( style ), mModified( false )
{
setupUi( this );
#ifdef Q_WS_MAC
setWindowModality( Qt::WindowModal );
#endif

QSettings settings;
restoreGeometry( settings.value( "/Windows/StyleV2Manager/geometry" ).toByteArray() );
Expand Down
175 changes: 42 additions & 133 deletions src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ QgsSimpleLineSymbolLayerV2Widget::QgsSimpleLineSymbolLayerV2Widget( const QgsVec
setupUi( this );

connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( penWidthChanged() ) );
connect( btnChangeColor, SIGNAL( clicked() ), this, SLOT( colorChanged() ) );
connect( btnChangeColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( colorChanged( const QColor& ) ) );
connect( cboPenStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penStyleChanged() ) );
connect( spinOffset, SIGNAL( valueChanged( double ) ), this, SLOT( offsetChanged() ) );
connect( cboCapStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( penStyleChanged() ) );
Expand Down Expand Up @@ -83,6 +83,7 @@ void QgsSimpleLineSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
// set values
spinWidth->setValue( mLayer->width() );
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
spinOffset->setValue( mLayer->offset() );
cboPenStyle->blockSignals( true );
cboJoinStyle->blockSignals( true );
Expand Down Expand Up @@ -117,20 +118,9 @@ void QgsSimpleLineSymbolLayerV2Widget::penWidthChanged()
emit changed();
}

void QgsSimpleLineSymbolLayerV2Widget::colorChanged()
void QgsSimpleLineSymbolLayerV2Widget::colorChanged( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::ShowAlphaChannel );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
btnChangeColor->setColor( mLayer->color() );
updatePatternIcon();
emit changed();
}
Expand Down Expand Up @@ -241,8 +231,8 @@ QgsSimpleMarkerSymbolLayerV2Widget::QgsSimpleMarkerSymbolLayerV2Widget( const Qg
}

connect( lstNames, SIGNAL( currentRowChanged( int ) ), this, SLOT( setName() ) );
connect( btnChangeColorBorder, SIGNAL( clicked() ), this, SLOT( setColorBorder() ) );
connect( btnChangeColorFill, SIGNAL( clicked() ), this, SLOT( setColorFill() ) );
connect( btnChangeColorBorder, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColorBorder( const QColor& ) ) );
connect( btnChangeColorFill, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColorFill( const QColor& ) ) );
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize() ) );
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setAngle() ) );
connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) );
Expand All @@ -268,7 +258,9 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer
}
}
btnChangeColorBorder->setColor( mLayer->borderColor() );
btnChangeColorBorder->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
btnChangeColorFill->setColor( mLayer->color() );
btnChangeColorFill->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
spinSize->setValue( mLayer->size() );
spinAngle->setValue( mLayer->angle() );

Expand Down Expand Up @@ -299,37 +291,15 @@ void QgsSimpleMarkerSymbolLayerV2Widget::setName()
emit changed();
}

void QgsSimpleMarkerSymbolLayerV2Widget::setColorBorder()
void QgsSimpleMarkerSymbolLayerV2Widget::setColorBorder( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel );
#else
QColor borderColor = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::ShowAlphaChannel );
#endif
if ( !borderColor.isValid() )
return;
mLayer->setBorderColor( borderColor );
btnChangeColorBorder->setColor( mLayer->borderColor() );
mLayer->setBorderColor( color );
emit changed();
}

void QgsSimpleMarkerSymbolLayerV2Widget::setColorFill()
void QgsSimpleMarkerSymbolLayerV2Widget::setColorFill( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::ShowAlphaChannel );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
btnChangeColorFill->setColor( mLayer->color() );
emit changed();
}

Expand Down Expand Up @@ -379,9 +349,9 @@ QgsSimpleFillSymbolLayerV2Widget::QgsSimpleFillSymbolLayerV2Widget( const QgsVec

setupUi( this );

connect( btnChangeColor, SIGNAL( clicked() ), this, SLOT( setColor() ) );
connect( btnChangeColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor( const QColor& ) ) );
connect( cboFillStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setBrushStyle() ) );
connect( btnChangeBorderColor, SIGNAL( clicked() ), this, SLOT( setBorderColor() ) );
connect( btnChangeBorderColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setBorderColor( const QColor& ) ) );
connect( spinBorderWidth, SIGNAL( valueChanged( double ) ), this, SLOT( borderWidthChanged() ) );
connect( cboBorderStyle, SIGNAL( currentIndexChanged( int ) ), this, SLOT( borderStyleChanged() ) );
connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( offsetChanged() ) );
Expand All @@ -398,8 +368,10 @@ void QgsSimpleFillSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )

// set values
btnChangeColor->setColor( mLayer->color() );
btnChangeColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
cboFillStyle->setBrushStyle( mLayer->brushStyle() );
btnChangeBorderColor->setColor( mLayer->borderColor() );
btnChangeBorderColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
cboBorderStyle->setPenStyle( mLayer->borderStyle() );
spinBorderWidth->setValue( mLayer->borderWidth() );
spinOffsetX->blockSignals( true );
Expand All @@ -422,37 +394,15 @@ QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2Widget::symbolLayer()
return mLayer;
}

void QgsSimpleFillSymbolLayerV2Widget::setColor()
void QgsSimpleFillSymbolLayerV2Widget::setColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::ShowAlphaChannel );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
btnChangeColor->setColor( mLayer->color() );
emit changed();
}

void QgsSimpleFillSymbolLayerV2Widget::setBorderColor()
void QgsSimpleFillSymbolLayerV2Widget::setBorderColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( mLayer->borderColor(), this, "", QColorDialog::ShowAlphaChannel );
#endif
if ( !color.isValid() )
return;
mLayer->setBorderColor( color );
btnChangeBorderColor->setColor( mLayer->borderColor() );
emit changed();
}

Expand Down Expand Up @@ -936,34 +886,26 @@ void QgsSvgMarkerSymbolLayerV2Widget::on_mFileLineEdit_editingFinished()
emit changed();
}

void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeColorButton_clicked()
void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeColorButton_colorChanged( const QColor& color )
{
if ( !mLayer )
{
return;
}
QColor c = QColorDialog::getColor( mLayer->fillColor() );
if ( c.isValid() )
{
mLayer->setFillColor( c );
mChangeColorButton->setColor( c );
emit changed();
}

mLayer->setFillColor( color );
emit changed();
}

void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeBorderColorButton_clicked()
void QgsSvgMarkerSymbolLayerV2Widget::on_mChangeBorderColorButton_colorChanged( const QColor& color )
{
if ( !mLayer )
{
return;
}
QColor c = QColorDialog::getColor( mLayer->outlineColor() );
if ( c.isValid() )
{
mLayer->setOutlineColor( c );
mChangeBorderColorButton->setColor( c );
emit changed();
}

mLayer->setOutlineColor( color );
emit changed();
}

void QgsSvgMarkerSymbolLayerV2Widget::on_mBorderWidthSpinBox_valueChanged( double d )
Expand Down Expand Up @@ -1011,7 +953,7 @@ QgsLineDecorationSymbolLayerV2Widget::QgsLineDecorationSymbolLayerV2Widget( cons

setupUi( this );

connect( btnChangeColor, SIGNAL( clicked() ), this, SLOT( colorChanged() ) );
connect( btnChangeColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( colorChanged( const QColor& ) ) );
connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( penWidthChanged() ) );
}

Expand All @@ -1037,20 +979,9 @@ QgsSymbolLayerV2* QgsLineDecorationSymbolLayerV2Widget::symbolLayer()
return mLayer;
}

void QgsLineDecorationSymbolLayerV2Widget::colorChanged()
void QgsLineDecorationSymbolLayerV2Widget::colorChanged( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
btnChangeColor->setColor( mLayer->color() );
emit changed();
}

Expand Down Expand Up @@ -1241,34 +1172,26 @@ void QgsSVGFillSymbolLayerWidget::updateParamGui()
mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
}

void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_clicked()
void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_colorChanged( const QColor& color )
{
if ( !mLayer )
{
return;
}
QColor c = QColorDialog::getColor( mLayer->svgFillColor() );
if ( c.isValid() )
{
mLayer->setSvgFillColor( c );
mChangeColorButton->setColor( c );
emit changed();
}

mLayer->setSvgFillColor( color );
emit changed();
}

void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_clicked()
void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_colorChanged( const QColor& color )
{
if ( !mLayer )
{
return;
}
QColor c = QColorDialog::getColor( mLayer->svgOutlineColor() );
if ( c.isValid() )
{
mLayer->setSvgOutlineColor( c );
mChangeBorderColorButton->setColor( c );
emit changed();
}

mLayer->setSvgOutlineColor( color );
emit changed();
}

void QgsSVGFillSymbolLayerWidget::on_mBorderWidthSpinBox_valueChanged( double d )
Expand Down Expand Up @@ -1377,18 +1300,15 @@ void QgsLinePatternFillSymbolLayerWidget::on_mOffsetSpinBox_valueChanged( double
}
}

void QgsLinePatternFillSymbolLayerWidget::on_mColorPushButton_clicked()
void QgsLinePatternFillSymbolLayerWidget::on_mColorPushButton_colorChanged( const QColor& color )
{
if ( mLayer )
if ( !mLayer )
{
QColor c = QColorDialog::getColor( mLayer->color() );
if ( c.isValid() )
{
mLayer->setColor( c );
mColorPushButton->setColor( c );
emit changed();
}
return;
}

mLayer->setColor( color );
emit changed();
}

void QgsLinePatternFillSymbolLayerWidget::on_mDistanceUnitComboBox_currentIndexChanged( int index )
Expand Down Expand Up @@ -1545,7 +1465,7 @@ QgsFontMarkerSymbolLayerV2Widget::QgsFontMarkerSymbolLayerV2Widget( const QgsVec

connect( cboFont, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( setFontFamily( const QFont& ) ) );
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setSize( double ) ) );
connect( btnColor, SIGNAL( clicked() ), this, SLOT( setColor() ) );
connect( btnColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor( const QColor& ) ) );
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setAngle( double ) ) );
connect( spinOffsetX, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) );
connect( spinOffsetY, SIGNAL( valueChanged( double ) ), this, SLOT( setOffset() ) );
Expand Down Expand Up @@ -1596,20 +1516,9 @@ void QgsFontMarkerSymbolLayerV2Widget::setFontFamily( const QFont& font )
emit changed();
}

void QgsFontMarkerSymbolLayerV2Widget::setColor()
void QgsFontMarkerSymbolLayerV2Widget::setColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mLayer->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mLayer->color(), this );
#endif
if ( !color.isValid() )
return;
mLayer->setColor( color );
btnColor->setColor( mLayer->color() );
emit changed();
}

Expand Down
24 changes: 12 additions & 12 deletions src/gui/symbology-ng/qgssymbollayerv2widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class GUI_EXPORT QgsSimpleLineSymbolLayerV2Widget : public QgsSymbolLayerV2Widge

public slots:
void penWidthChanged();
void colorChanged();
void colorChanged( const QColor& color );
void penStyleChanged();
void offsetChanged();
void on_mCustomCheckBox_stateChanged( int state );
Expand Down Expand Up @@ -100,8 +100,8 @@ class GUI_EXPORT QgsSimpleMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Wid

public slots:
void setName();
void setColorBorder();
void setColorFill();
void setColorBorder( const QColor& color );
void setColorFill( const QColor& color );
void setSize();
void setAngle();
void setOffset();
Expand Down Expand Up @@ -132,8 +132,8 @@ class GUI_EXPORT QgsSimpleFillSymbolLayerV2Widget : public QgsSymbolLayerV2Widge
virtual QgsSymbolLayerV2* symbolLayer();

public slots:
void setColor();
void setBorderColor();
void setColor( const QColor& color );
void setBorderColor( const QColor& color );
void setBrushStyle();
void borderWidthChanged();
void borderStyleChanged();
Expand Down Expand Up @@ -208,8 +208,8 @@ class GUI_EXPORT QgsSvgMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widget
void on_mFileToolButton_clicked();
void on_mFileLineEdit_textEdited( const QString& text );
void on_mFileLineEdit_editingFinished();
void on_mChangeColorButton_clicked();
void on_mChangeBorderColorButton_clicked();
void on_mChangeColorButton_colorChanged( const QColor& color );
void on_mChangeBorderColorButton_colorChanged( const QColor& color );
void on_mBorderWidthSpinBox_valueChanged( double d );
void on_mSizeUnitComboBox_currentIndexChanged( int index );
void on_mBorderWidthUnitComboBox_currentIndexChanged( int index );
Expand Down Expand Up @@ -245,7 +245,7 @@ class GUI_EXPORT QgsLineDecorationSymbolLayerV2Widget : public QgsSymbolLayerV2W
virtual QgsSymbolLayerV2* symbolLayer();

public slots:
void colorChanged();
void colorChanged( const QColor& color );
void penWidthChanged();
void on_mWidthUnitComboBox_currentIndexChanged( int index );

Expand Down Expand Up @@ -285,8 +285,8 @@ class GUI_EXPORT QgsSVGFillSymbolLayerWidget : public QgsSymbolLayerV2Widget, pr
void setFile( const QModelIndex& item );
void populateIcons( const QModelIndex& item );
void on_mRotationSpinBox_valueChanged( double d );
void on_mChangeColorButton_clicked();
void on_mChangeBorderColorButton_clicked();
void on_mChangeColorButton_colorChanged( const QColor& color );
void on_mChangeBorderColorButton_colorChanged( const QColor& color );
void on_mBorderWidthSpinBox_valueChanged( double d );
void on_mTextureWidthUnitComboBox_currentIndexChanged( int index );
void on_mSvgOutlineWidthUnitComboBox_currentIndexChanged( int index );
Expand Down Expand Up @@ -318,7 +318,7 @@ class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLayerV2Wi
void on_mDistanceSpinBox_valueChanged( double d );
void on_mLineWidthSpinBox_valueChanged( double d );
void on_mOffsetSpinBox_valueChanged( double d );
void on_mColorPushButton_clicked();
void on_mColorPushButton_colorChanged( const QColor& color );
void on_mDistanceUnitComboBox_currentIndexChanged( int index );
void on_mLineWidthUnitComboBox_currentIndexChanged( int index );
void on_mOffsetUnitComboBox_currentIndexChanged( int index );
Expand Down Expand Up @@ -377,7 +377,7 @@ class GUI_EXPORT QgsFontMarkerSymbolLayerV2Widget : public QgsSymbolLayerV2Widge

public slots:
void setFontFamily( const QFont& font );
void setColor();
void setColor( const QColor& color );
void setSize( double size );
void setAngle( double angle );
void setCharacter( const QChar& chr );
Expand Down
22 changes: 7 additions & 15 deletions src/gui/symbology-ng/qgssymbolslistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
// select correct page in stacked widget
// there's a correspondence between symbol type number and page numbering => exploit it!
stackedWidget->setCurrentIndex( symbol->type() );
connect( btnColor, SIGNAL( clicked() ), this, SLOT( setSymbolColor() ) );
connect( btnColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setSymbolColor( const QColor& ) ) );
connect( spinAngle, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerAngle( double ) ) );
connect( spinSize, SIGNAL( valueChanged( double ) ), this, SLOT( setMarkerSize( double ) ) );
connect( spinWidth, SIGNAL( valueChanged( double ) ), this, SLOT( setLineWidth( double ) ) );


// Live color updates are not undoable to child symbol layers
btnColor->setAcceptLiveUpdates( false );
btnColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
// Set symbol color in btnColor
updateSymbolColor();
}
Expand Down Expand Up @@ -182,21 +184,9 @@ void QgsSymbolsListWidget::openStyleManager()
populateSymbolView();
}

void QgsSymbolsListWidget::setSymbolColor()
void QgsSymbolsListWidget::setSymbolColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mSymbol->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mSymbol->color(), this );
#endif
if ( !color.isValid() )
return;

mSymbol->setColor( color );
updateSymbolColor();
emit changed();
}

Expand Down Expand Up @@ -287,7 +277,9 @@ void QgsSymbolsListWidget::displayTransparency( double alpha )

void QgsSymbolsListWidget::updateSymbolColor()
{
btnColor->blockSignals( true );
btnColor->setColor( mSymbol->color() );
btnColor->blockSignals( false );
}

void QgsSymbolsListWidget::updateSymbolInfo()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgssymbolslistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW

public slots:
void setSymbolFromStyle( const QModelIndex & index );
void setSymbolColor();
void setSymbolColor( const QColor& color );
void setMarkerAngle( double angle );
void setMarkerSize( double size );
void setLineWidth( double width );
Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class SymbolLayerItem : public QStandardItem
QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsStyleV2* style, const QgsVectorLayer* vl, QWidget* parent, bool embedded )
: QDialog( parent ), mAdvancedMenu( NULL ), mVectorLayer( vl )
{
#ifdef Q_WS_MAC
setWindowModality( Qt::WindowModal );
#endif
mStyle = style;
mSymbol = symbol;
mPresentWidget = NULL;
Expand Down
96 changes: 52 additions & 44 deletions src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@

#include "qgsvectorcolorrampv2.h"
#include "qgsdialog.h"
#include "qgscolordialog.h"
#include "qgscptcityarchive.h"

#include <QColorDialog>
#include <QInputDialog>
#include <QPainter>
#include <QSettings>
#include <QTableWidget>
#include <QTextEdit>

QgsVectorGradientColorRampV2Dialog::QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent )
: QDialog( parent ), mRamp( ramp )
: QDialog( parent ), mRamp( ramp ), mCurrentItem( 0 )
{
setupUi( this );
#ifdef Q_WS_MAC
setWindowModality( Qt::WindowModal );
#endif

connect( btnColor1, SIGNAL( clicked() ), this, SLOT( setColor1() ) );
connect( btnColor2, SIGNAL( clicked() ), this, SLOT( setColor2() ) );
connect( btnColor1, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor1( const QColor& ) ) );
connect( btnColor2, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( setColor2( const QColor& ) ) );

// handle stops
updateStops();
Expand Down Expand Up @@ -207,34 +212,14 @@ void QgsVectorGradientColorRampV2Dialog::updatePreview()
btnColor2->setColor( mRamp->color2() );
}

void QgsVectorGradientColorRampV2Dialog::setColor1()
void QgsVectorGradientColorRampV2Dialog::setColor1( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mRamp->color1(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mRamp->color1(), this );
#endif
if ( !color.isValid() )
return;
mRamp->setColor1( color );
updatePreview();
}

void QgsVectorGradientColorRampV2Dialog::setColor2()
void QgsVectorGradientColorRampV2Dialog::setColor2( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( mRamp->color2(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( mRamp->color2(), this );
#endif
if ( !color.isValid() )
return;
mRamp->setColor2( color );
updatePreview();
}
Expand All @@ -252,26 +237,40 @@ void QgsVectorGradientColorRampV2Dialog::setStopColor( QTreeWidgetItem* item, QC
p.setPen( Qt::NoPen );
p.setRenderHint( QPainter::Antialiasing );
p.setBrush( color );
p.drawRoundedRect( rect, 4, 4 );
p.drawRoundedRect( rect, 2, 2 );
p.end();

item->setIcon( 0, QIcon( pixmap ) );
item->setData( 0, StopColorRole, color );
item->setText( 0, color.name() );
}

void QgsVectorGradientColorRampV2Dialog::setItemStopColor( const QColor& newColor )
{
if ( mCurrentItem )
{
setStopColor( mCurrentItem, newColor );
updatePreview();
}
}

void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* item, int column )
{
if ( column == 0 )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// FIXME need to also check max QT_VERSION when Qt bug fixed
QColor color = QColorDialog::getColor( item->data( 0, StopColorRole ).value<QColor>(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor color = QColorDialog::getColor( item->data( 0, StopColorRole ).value<QColor>(), this );
#endif
QColor color;

QSettings settings;
if ( settings.value( "/qgis/live_color_dialogs", false ).toBool() )
{
mCurrentItem = item;
color = QgsColorDialog::getLiveColor( item->data( 0, StopColorRole ).value<QColor>(), this, "setItemStopColor( const QColor& )", this );
mCurrentItem = 0;
}
else
{
color = QColorDialog::getColor( item->data( 0, StopColorRole ).value<QColor>(), this );
}
if ( !color.isValid() )
return;
setStopColor( item, color );
Expand Down Expand Up @@ -310,19 +309,19 @@ void QgsVectorGradientColorRampV2Dialog::stopDoubleClicked( QTreeWidgetItem* ite

void QgsVectorGradientColorRampV2Dialog::addStop()
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// also Qt 4.7 Mac Cocoa bug: calling QInputDialog::getInt after QColorDialog::getColor will freeze app
// workaround: call QColorDialog::getColor below instead of here,
// but not needed at this time because of the other Qt bug
// FIXME need to also check max QT_VERSION when Qt bug(s) fixed
QColor color = QColorDialog::getColor( QColor(), this, "", QColorDialog::DontUseNativeDialog );
#else
// Native Mac dialog works only for Qt Carbon
// Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-14889
// Qt 4.7 Mac Cocoa bug: calling QInputDialog::getInt after QColorDialog::getColor will freeze app
// workaround: call QColorDialog::getColor below instead of here,
// but not needed at this time because of the other Qt bug
// FIXME need to also check max QT_VERSION when Qt bug(s) fixed
#ifndef Q_WS_MAC
QColor color = QColorDialog::getColor( QColor(), this );
#endif

if ( !color.isValid() )
return;
activateWindow();
#endif

bool ok;
double val = 50.0;
Expand All @@ -341,11 +340,20 @@ void QgsVectorGradientColorRampV2Dialog::addStop()
#endif
if ( !ok )
return;
activateWindow();

double key = val / 100.0;
QStringList lst;
lst << "." << QString(( val < 10 ) ? '0' + QString::number( val ) : QString::number( val ) );

#ifdef Q_WS_MAC
QColor color = QColorDialog::getColor( QColor(), this );

if ( !color.isValid() )
return;
activateWindow();
#endif

QTreeWidgetItem* item = new QTreeWidgetItem( lst );

setStopColor( item, color );
Expand Down
7 changes: 5 additions & 2 deletions src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, private Ui
QgsVectorGradientColorRampV2Dialog( QgsVectorGradientColorRampV2* ramp, QWidget* parent = NULL );

public slots:
void setColor1();
void setColor2();
void setColor1( const QColor& color );
void setColor2( const QColor& color );

void toggledStops( bool on );
void addStop();
void removeStop();

void stopDoubleClicked( QTreeWidgetItem* item, int column );
void setItemStopColor( const QColor& newColor );

protected slots:
void on_cboType_currentIndexChanged( int index );
Expand All @@ -53,6 +54,8 @@ class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, private Ui

static const int StopColorRole = Qt::UserRole + 1;
static const int StopOffsetRole = Qt::UserRole + 2;

QTreeWidgetItem* mCurrentItem;
};

#endif
14 changes: 4 additions & 10 deletions src/plugins/grass/qgsgrassregion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,23 +273,17 @@ QgsGrassRegion::QgsGrassRegion( QgsGrassPlugin *plugin, QgisInterface *iface,
// Symbology
QPen pen = mPlugin->regionPen();
mColorButton->setColor( pen.color() );
connect( mColorButton, SIGNAL( clicked() ), this, SLOT( changeColor() ) );
connect( mColorButton, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );

mWidthSpinBox->setValue( pen.width() );
connect( mWidthSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( changeWidth() ) );
}

void QgsGrassRegion::changeColor( void )
void QgsGrassRegion::changeColor( const QColor& color )
{
QPen pen = mPlugin->regionPen();
QColor color = QColorDialog::getColor( pen.color(), this );
if ( color.isValid() )
{
mColorButton->setColor( color );

pen.setColor( color );
mPlugin->setRegionPen( pen );
}
pen.setColor( color );
mPlugin->setRegionPen( pen );
}

void QgsGrassRegion::changeWidth( void )
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassregion.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class QgsGrassRegion: public QDialog, private Ui::QgsGrassRegionBase

void radioChanged( void ) ;

void changeColor( void ) ;
void changeColor( const QColor& color ) ;
void changeWidth( void ) ;

void restorePosition( void );
Expand Down
38 changes: 22 additions & 16 deletions src/plugins/grass/qgsgrassregionbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>445</width>
<height>388</height>
<height>397</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -172,19 +172,6 @@ or change the following values</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QgsColorButton" name="mColorButton" native="true">
<property name="minimumSize">
<size>
<width>35</width>
<height>25</height>
</size>
</property>
<property name="text" stdset="0">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="textLabel6">
<property name="text">
Expand All @@ -211,6 +198,25 @@ or change the following values</string>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QgsColorButtonV2" name="mColorButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand All @@ -228,8 +234,8 @@ or change the following values</string>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QWidget</extends>
<class>QgsColorButtonV2</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
Expand Down
66 changes: 24 additions & 42 deletions src/ui/qgsannotationwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>180</width>
<height>151</height>
<width>221</width>
<height>172</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -23,6 +23,20 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QgsColorButton" name="mFrameColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mBackgroundColorLabel">
<property name="text">
<string>Background color</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mMapMarkerLabel">
<property name="text">
Expand All @@ -33,6 +47,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="mMapMarkerButton">
<property name="text">
Expand All @@ -53,50 +74,11 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mFrameWidthSpinBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mBackgroundColorLabel">
<property name="text">
<string>Background color</string>
</property>
<property name="buddy">
<cstring>mBackgroundColorButton</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mFrameColorLabel">
<property name="text">
<string>Frame color</string>
</property>
<property name="buddy">
<cstring>mFrameColorButton</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QgsColorButton" name="mFrameColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
Expand All @@ -106,7 +88,7 @@
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgscategorizedsymbolrendererv2widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</sizepolicy>
</property>
<property name="text">
<string>change</string>
<string>Change...</string>
</property>
</widget>
</item>
Expand Down
9 changes: 7 additions & 2 deletions src/ui/qgscomposerarrowwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="mArrowColorButton">
<widget class="QgsColorButton" name="mArrowColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Arrow color...</string>
<string>Color...</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -214,6 +214,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
Expand Down
100 changes: 32 additions & 68 deletions src/ui/qgscomposeritemwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -231,36 +231,35 @@
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="mFrameColorButton">
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<item row="1" column="0">
<widget class="QLabel" name="mOutlineWidthLabel">
<property name="text">
<string>Frame color...</string>
<string>Thickness</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mOutlineWidthSpinBox</cstring>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="mOutlineWidthSpinBox"/>
</item>
<item row="0" column="0" colspan="2">
<widget class="QgsColorButton" name="mFrameColorButton">
<property name="text">
<string>Color...</string>
</property>
<item row="0" column="0">
<widget class="QLabel" name="mOutlineWidthLabel">
<property name="text">
<string>Thickness</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mOutlineWidthSpinBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mOutlineWidthSpinBox"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
Expand All @@ -270,9 +269,6 @@
<property name="title">
<string>Background</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>true</bool>
</property>
Expand All @@ -285,51 +281,14 @@
<property name="collapsed" stdset="0">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="mBackgroundColorButton">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="text">
<string>Background color...</string>
<string>Color...</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="mOpacityLabel">
<property name="text">
<string>Transparency</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mTransparencySlider</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="mTransparencySlider">
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="mTransparencySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -397,6 +356,11 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
Expand Down
39 changes: 7 additions & 32 deletions src/ui/qgscomposertablewidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -187,35 +187,10 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mGridStrokeWidthSpinBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mGridColorLabel">
<property name="text">
<string>Color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mGridColorButton</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="0" colspan="2">
<widget class="QgsColorButton" name="mGridColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
<string>Color...</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -265,17 +240,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header location="global">qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
Expand Down
69 changes: 19 additions & 50 deletions src/ui/qgscompositionwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Spacing</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="mGridResolutionSpinBox">
<property name="prefix">
Expand Down Expand Up @@ -368,44 +378,6 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mGridColorLabel">
<property name="text">
<string>Grid color</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="buddy">
<cstring>mGridColorButton</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QgsColorButton" name="mGridColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="mGridStyleLabel">
<property name="text">
<string>Grid style</string>
Expand All @@ -418,7 +390,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="mGridStyleComboBox"/>
</item>
<item row="5" column="0">
Expand All @@ -441,13 +413,10 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<item row="4" column="1">
<widget class="QgsColorButton" name="mGridColorButton">
<property name="text">
<string>Spacing</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<string>Color...</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -516,17 +485,17 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBoxBasic</class>
<extends>QGroupBox</extends>
<header location="global">qgscollapsiblegroupbox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>scrollArea</tabstop>
Expand Down
46 changes: 16 additions & 30 deletions src/ui/qgscontinuouscolordialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>256</width>
<width>263</width>
<height>175</height>
</rect>
</property>
Expand Down Expand Up @@ -64,19 +64,6 @@
<property name="text">
<string>Minimum value</string>
</property>
<property name="buddy">
<cstring>btnMinValue</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QgsColorButton" name="btnMinValue">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
Expand All @@ -90,19 +77,6 @@
<property name="text">
<string>Maximum value</string>
</property>
<property name="buddy">
<cstring>btnMaxValue</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="btnMaxValue">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="0">
Expand Down Expand Up @@ -144,20 +118,32 @@
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QgsColorButton" name="btnMinValue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="btnMaxValue">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>classificationComboBox</tabstop>
<tabstop>btnMinValue</tabstop>
<tabstop>btnMaxValue</tabstop>
<tabstop>outlinewidthspinbox</tabstop>
<tabstop>cb_polygonOutline</tabstop>
</tabstops>
Expand Down
35 changes: 11 additions & 24 deletions src/ui/qgsdecorationcopyrightdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<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;
&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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&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';&quot;&gt;© QGIS 2009&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&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 2009&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -111,26 +111,7 @@ p, li { white-space: pre-wrap; }
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Color</string>
</property>
<property name="buddy">
<cstring>pbnColorChooser</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QgsColorButton" name="pbnColorChooser">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
<string>Color</string>
</property>
</widget>
</item>
Expand All @@ -144,13 +125,20 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QgsColorButton" name="pbnColorChooser">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
Expand All @@ -159,7 +147,6 @@ p, li { white-space: pre-wrap; }
<tabstop>txtCopyrightText</tabstop>
<tabstop>cboPlacement</tabstop>
<tabstop>cboOrientation</tabstop>
<tabstop>pbnColorChooser</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
Expand Down
32 changes: 8 additions & 24 deletions src/ui/qgsdecorationscalebardialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,6 @@
<property name="text">
<string>Color of bar</string>
</property>
<property name="buddy">
<cstring>pbnChangeColor</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="pbnChangeColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Click to select the color</string>
</property>
<property name="whatsThis">
<string>Click to select the color</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
Expand Down Expand Up @@ -217,20 +195,26 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsColorButton" name="pbnChangeColor">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>cboPlacement</tabstop>
<tabstop>cboStyle</tabstop>
<tabstop>pbnChangeColor</tabstop>
<tabstop>spnSize</tabstop>
<tabstop>chkEnable</tabstop>
<tabstop>chkSnapping</tabstop>
Expand Down
74 changes: 25 additions & 49 deletions src/ui/qgsdiagrampropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>756</width>
<height>627</height>
<width>752</width>
<height>613</height>
</rect>
</property>
<layout class="QVBoxLayout" name="scrollAreaLayout">
Expand Down Expand Up @@ -124,8 +124,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>723</width>
<height>356</height>
<width>713</width>
<height>364</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -204,25 +204,6 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="mBarWidthSpinBox">
<property name="minimum">
Expand All @@ -233,25 +214,6 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QgsColorButton" name="mDiagramPenColorButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="mPenWidthSpinBox">
<property name="decimals">
Expand All @@ -262,6 +224,20 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QgsColorButton" name="mBackgroundColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QgsColorButton" name="mDiagramPenColorButton">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
Expand Down Expand Up @@ -334,8 +310,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>289</height>
<width>715</width>
<height>318</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -523,8 +499,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>216</width>
<height>284</height>
<width>713</width>
<height>271</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -685,8 +661,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>137</width>
<height>191</height>
<width>728</width>
<height>166</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -979,7 +955,7 @@
<customwidgets>
<customwidget>
<class>QgsColorButton</class>
<extends>QToolButton</extends>
<extends>QPushButton</extends>
<header>qgscolorbutton.h</header>
</customwidget>
</customwidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsgraduatedsymbolrendererv2widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</sizepolicy>
</property>
<property name="text">
<string>change</string>
<string>Change...</string>
</property>
</widget>
</item>
Expand Down
Loading