[FEATURE] Make color brewer and limited random ramp editors show

inline in style panel
This commit is contained in:
Nyall Dawson 2016-08-24 15:00:07 +10:00
parent 1d98b10904
commit b225a82b3e
10 changed files with 362 additions and 265 deletions

View File

@ -1,3 +1,40 @@
/** \ingroup gui
* \class QgsColorBrewerColorRampDialog
* A widget which allows users to modify the properties of a QgsColorBrewerColorRamp.
* \note added in QGIS 3.0
*/
class QgsColorBrewerColorRampWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgscolorbrewercolorrampdialog.h>
%End
public:
/** Constructor for QgsColorBrewerColorRampDialog.
* @param ramp initial ramp to show in dialog
* @param parent parent widget
*/
QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp& ramp, QWidget* parent /TransferThis/ = nullptr );
/** Returns a color ramp representing the current settings from the dialog.
* @see setRamp()
*/
QgsColorBrewerColorRamp ramp() const;
/** Sets the color ramp to show in the dialog.
* @param ramp color ramp
* @see ramp()
*/
void setRamp( const QgsColorBrewerColorRamp& ramp );
signals:
//! Emitted when the dialog settings change
void changed();
};
/** \ingroup gui /** \ingroup gui
* \class QgsColorBrewerColorRampDialog * \class QgsColorBrewerColorRampDialog
* A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp. * A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.

View File

@ -1,3 +1,57 @@
/** \ingroup gui
* \class QgsLimitedRandomColorRampWidget
* A widget which allows users to modify the properties of a QgsLimitedRandomColorRamp.
* \note added in QGIS 3.0
*/
class QgsLimitedRandomColorRampWidget : QgsPanelWidget
{
%TypeHeaderCode
#include <qgslimitedrandomcolorrampdialog.h>
%End
public:
/** Constructor for QgsLimitedRandomColorRampWidget.
* @param ramp initial ramp to show in dialog
* @param parent parent widget
*/
QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp& ramp, QWidget* parent /TransferThis/ = nullptr );
/** Returns a color ramp representing the current settings from the dialog.
* @see setRamp()
*/
QgsLimitedRandomColorRamp ramp() const;
/** Sets the color ramp to show in the dialog.
* @param ramp color ramp
* @see ramp()
*/
void setRamp( const QgsLimitedRandomColorRamp& ramp );
signals:
//! Emitted when the dialog settings change
void changed();
public slots:
//! Sets the number of colors to create in the ramp
void setCount( int val );
//! Sets the minimum hue for colors in the ramp
void setHue1( int val );
//! Sets the maximum hue for colors in the ramp
void setHue2( int val );
//! Sets the minimum saturation for colors in the ramp
void setSat1( int val );
//! Sets the maximum saturation for colors in the ramp
void setSat2( int val );
//! Sets the minimum value for colors in the ramp
void setVal1( int val );
//! Sets the maximum value for colors in the ramp
void setVal2( int val );
};
/** \ingroup gui /** \ingroup gui
* \class QgsLimitedRandomColorRampDialog * \class QgsLimitedRandomColorRampDialog
* A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp. * A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
@ -34,20 +88,4 @@ class QgsLimitedRandomColorRampDialog : QDialog
//! Emitted when the dialog settings change //! Emitted when the dialog settings change
void changed(); void changed();
public slots:
//! Sets the number of colors to create in the ramp
void setCount( int val );
//! Sets the minimum hue for colors in the ramp
void setHue1( int val );
//! Sets the maximum hue for colors in the ramp
void setHue2( int val );
//! Sets the minimum saturation for colors in the ramp
void setSat1( int val );
//! Sets the maximum saturation for colors in the ramp
void setSat2( int val );
//! Sets the minimum value for colors in the ramp
void setVal1( int val );
//! Sets the maximum value for colors in the ramp
void setVal2( int val );
}; };

View File

@ -18,6 +18,7 @@
#include "qgscolorramp.h" #include "qgscolorramp.h"
#include "qgssymbollayerutils.h" #include "qgssymbollayerutils.h"
#include <QAbstractButton> #include <QAbstractButton>
#include <QDialogButtonBox>
#if 0 // unused #if 0 // unused
static void updateColorButton( QAbstractButton* button, QColor color ) static void updateColorButton( QAbstractButton* button, QColor color )
@ -31,8 +32,8 @@ static void updateColorButton( QAbstractButton* button, QColor color )
///////// /////////
QgsColorBrewerColorRampDialog::QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp& ramp, QWidget* parent ) QgsColorBrewerColorRampWidget::QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp& ramp, QWidget* parent )
: QDialog( parent ) : QgsPanelWidget( parent )
, mRamp( ramp ) , mRamp( ramp )
{ {
@ -56,14 +57,14 @@ QgsColorBrewerColorRampDialog::QgsColorBrewerColorRampDialog( const QgsColorBrew
connect( cboColors, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setColors() ) ); connect( cboColors, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setColors() ) );
} }
void QgsColorBrewerColorRampDialog::setRamp( const QgsColorBrewerColorRamp& ramp ) void QgsColorBrewerColorRampWidget::setRamp( const QgsColorBrewerColorRamp& ramp )
{ {
mRamp = ramp; mRamp = ramp;
updateUi(); updateUi();
emit changed(); emit changed();
} }
void QgsColorBrewerColorRampDialog::populateVariants() void QgsColorBrewerColorRampWidget::populateVariants()
{ {
QString oldVariant = cboColors->currentText(); QString oldVariant = cboColors->currentText();
@ -85,13 +86,13 @@ void QgsColorBrewerColorRampDialog::populateVariants()
cboColors->setCurrentIndex( idx ); cboColors->setCurrentIndex( idx );
} }
void QgsColorBrewerColorRampDialog::updatePreview() void QgsColorBrewerColorRampWidget::updatePreview()
{ {
QSize size( 300, 40 ); QSize size( 300, 40 );
lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) ); lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) );
} }
void QgsColorBrewerColorRampDialog::updateUi() void QgsColorBrewerColorRampWidget::updateUi()
{ {
whileBlocking( cboSchemeName )->setCurrentIndex( cboSchemeName->findText( mRamp.schemeName() ) ); whileBlocking( cboSchemeName )->setCurrentIndex( cboSchemeName->findText( mRamp.schemeName() ) );
populateVariants(); populateVariants();
@ -99,7 +100,7 @@ void QgsColorBrewerColorRampDialog::updateUi()
updatePreview(); updatePreview();
} }
void QgsColorBrewerColorRampDialog::setSchemeName() void QgsColorBrewerColorRampWidget::setSchemeName()
{ {
// populate list of variants // populate list of variants
populateVariants(); populateVariants();
@ -109,10 +110,24 @@ void QgsColorBrewerColorRampDialog::setSchemeName()
emit changed(); emit changed();
} }
void QgsColorBrewerColorRampDialog::setColors() void QgsColorBrewerColorRampWidget::setColors()
{ {
int num = cboColors->currentText().toInt(); int num = cboColors->currentText().toInt();
mRamp.setColors( num ); mRamp.setColors( num );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
QgsColorBrewerColorRampDialog::QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp& ramp, QWidget* parent )
: QDialog( parent )
{
QVBoxLayout* vLayout = new QVBoxLayout();
mWidget = new QgsColorBrewerColorRampWidget( ramp );
vLayout->addWidget( mWidget );
QDialogButtonBox* bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
connect( bbox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( bbox, SIGNAL( rejected() ), this, SLOT( reject() ) );
vLayout->addWidget( bbox );
setLayout( vLayout );
connect( mWidget, SIGNAL( changed() ), this, SIGNAL( changed() ) );
}

View File

@ -17,29 +17,29 @@
#define QGSCOLORBREWERCOLORRAMPDIALOG_H #define QGSCOLORBREWERCOLORRAMPDIALOG_H
#include <QDialog> #include <QDialog>
#include "qgspanelwidget.h"
#include "qgscolorramp.h" #include "qgscolorramp.h"
#include "ui_qgscolorbrewercolorrampdialogbase.h" #include "ui_qgscolorbrewercolorrampwidgetbase.h"
class QgsColorBrewerColorRamp; class QgsColorBrewerColorRamp;
/** \ingroup gui /** \ingroup gui
* \class QgsColorBrewerColorRampDialog * \class QgsColorBrewerColorRampWidget
* A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp. * A widget which allows users to modify the properties of a QgsColorBrewerColorRamp.
* \note added in QGIS 3.0 * \note added in QGIS 3.0
*/ */
class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog, private Ui::QgsColorBrewerColorRampDialogBase class GUI_EXPORT QgsColorBrewerColorRampWidget : public QgsPanelWidget, private Ui::QgsColorBrewerColorRampWidgetBase
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp ) Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
public: public:
/** Constructor for QgsColorBrewerColorRampDialog. /** Constructor for QgsColorBrewerColorRampWidget.
* @param ramp initial ramp to show in dialog * @param ramp initial ramp to show in dialog
* @param parent parent widget * @param parent parent widget
*/ */
QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp& ramp, QWidget* parent = nullptr ); QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp& ramp, QWidget* parent = nullptr );
/** Returns a color ramp representing the current settings from the dialog. /** Returns a color ramp representing the current settings from the dialog.
* @see setRamp() * @see setRamp()
@ -70,4 +70,44 @@ class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog, private Ui::Qgs
QgsColorBrewerColorRamp mRamp; QgsColorBrewerColorRamp mRamp;
}; };
/** \ingroup gui
* \class QgsColorBrewerColorRampDialog
* A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
* \note added in QGIS 3.0
*/
class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog
{
Q_OBJECT
Q_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
public:
/** Constructor for QgsColorBrewerColorRampDialog.
* @param ramp initial ramp to show in dialog
* @param parent parent widget
*/
QgsColorBrewerColorRampDialog( const QgsColorBrewerColorRamp& ramp, QWidget* parent = nullptr );
/** Returns a color ramp representing the current settings from the dialog.
* @see setRamp()
*/
QgsColorBrewerColorRamp ramp() const { return mWidget->ramp(); }
/** Sets the color ramp to show in the dialog.
* @param ramp color ramp
* @see ramp()
*/
void setRamp( const QgsColorBrewerColorRamp& ramp ) { mWidget->setRamp( ramp ); }
signals:
//! Emitted when the dialog settings change
void changed();
private:
QgsColorBrewerColorRampWidget* mWidget;
};
#endif #endif

View File

@ -19,10 +19,11 @@
#include "qgscolorramp.h" #include "qgscolorramp.h"
#include <QColorDialog> #include <QColorDialog>
#include <QDialogButtonBox>
QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp& ramp, QWidget* parent ) QgsLimitedRandomColorRampWidget::QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp& ramp, QWidget* parent )
: QDialog( parent ) : QgsPanelWidget( parent )
, mRamp( ramp ) , mRamp( ramp )
{ {
setupUi( this ); setupUi( this );
@ -38,14 +39,14 @@ QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimit
connect( spinVal2, SIGNAL( valueChanged( int ) ), this, SLOT( setVal2( int ) ) ); connect( spinVal2, SIGNAL( valueChanged( int ) ), this, SLOT( setVal2( int ) ) );
} }
void QgsLimitedRandomColorRampDialog::setRamp( const QgsLimitedRandomColorRamp& ramp ) void QgsLimitedRandomColorRampWidget::setRamp( const QgsLimitedRandomColorRamp& ramp )
{ {
mRamp = ramp; mRamp = ramp;
updateUi(); updateUi();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::updatePreview() void QgsLimitedRandomColorRampWidget::updatePreview()
{ {
mRamp.updateColors(); mRamp.updateColors();
@ -53,7 +54,7 @@ void QgsLimitedRandomColorRampDialog::updatePreview()
lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) ); lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) );
} }
void QgsLimitedRandomColorRampDialog::updateUi() void QgsLimitedRandomColorRampWidget::updateUi()
{ {
spinCount->setValue( mRamp.count() ); spinCount->setValue( mRamp.count() );
spinHue1->setValue( mRamp.hueMin() ); spinHue1->setValue( mRamp.hueMin() );
@ -65,51 +66,65 @@ void QgsLimitedRandomColorRampDialog::updateUi()
updatePreview(); updatePreview();
} }
void QgsLimitedRandomColorRampDialog::setCount( int val ) void QgsLimitedRandomColorRampWidget::setCount( int val )
{ {
mRamp.setCount( val ); mRamp.setCount( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setHue1( int val ) void QgsLimitedRandomColorRampWidget::setHue1( int val )
{ {
mRamp.setHueMin( val ); mRamp.setHueMin( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setHue2( int val ) void QgsLimitedRandomColorRampWidget::setHue2( int val )
{ {
mRamp.setHueMax( val ); mRamp.setHueMax( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setSat1( int val ) void QgsLimitedRandomColorRampWidget::setSat1( int val )
{ {
mRamp.setSatMin( val ); mRamp.setSatMin( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setSat2( int val ) void QgsLimitedRandomColorRampWidget::setSat2( int val )
{ {
mRamp.setSatMax( val ); mRamp.setSatMax( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setVal1( int val ) void QgsLimitedRandomColorRampWidget::setVal1( int val )
{ {
mRamp.setValMin( val ); mRamp.setValMin( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
void QgsLimitedRandomColorRampDialog::setVal2( int val ) void QgsLimitedRandomColorRampWidget::setVal2( int val )
{ {
mRamp.setValMax( val ); mRamp.setValMax( val );
updatePreview(); updatePreview();
emit changed(); emit changed();
} }
QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp& ramp, QWidget* parent )
: QDialog( parent )
{
QVBoxLayout* vLayout = new QVBoxLayout();
mWidget = new QgsLimitedRandomColorRampWidget( ramp );
vLayout->addWidget( mWidget );
QDialogButtonBox* bbox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal );
connect( bbox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( bbox, SIGNAL( rejected() ), this, SLOT( reject() ) );
vLayout->addWidget( bbox );
setLayout( vLayout );
connect( mWidget, SIGNAL( changed() ), this, SIGNAL( changed() ) );
}

View File

@ -17,27 +17,27 @@
#define QGsLIMITEDRANDOMCOLORRAMPDIALOG_H #define QGsLIMITEDRANDOMCOLORRAMPDIALOG_H
#include <QDialog> #include <QDialog>
#include "qgspanelwidget.h"
#include "qgscolorramp.h" #include "qgscolorramp.h"
#include "ui_qgslimitedrandomcolorrampdialogbase.h" #include "ui_qgslimitedrandomcolorrampwidgetbase.h"
/** \ingroup gui /** \ingroup gui
* \class QgsLimitedRandomColorRampDialog * \class QgsLimitedRandomColorRampWidget
* A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp. * A widget which allows users to modify the properties of a QgsLimitedRandomColorRamp.
* \note added in QGIS 3.0 * \note added in QGIS 3.0
*/ */
class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog, private Ui::QgsLimitedRandomColorRampDialogBase class GUI_EXPORT QgsLimitedRandomColorRampWidget : public QgsPanelWidget, private Ui::QgsLimitedRandomColorRampWidgetBase
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp ) Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
public: public:
/** Constructor for QgsLimitedRandomColorRampDialog. /** Constructor for QgsLimitedRandomColorRampWidget.
* @param ramp initial ramp to show in dialog * @param ramp initial ramp to show in dialog
* @param parent parent widget * @param parent parent widget
*/ */
QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp& ramp, QWidget* parent = nullptr ); QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp& ramp, QWidget* parent = nullptr );
/** Returns a color ramp representing the current settings from the dialog. /** Returns a color ramp representing the current settings from the dialog.
* @see setRamp() * @see setRamp()
@ -80,4 +80,45 @@ class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog, private Ui::Q
QgsLimitedRandomColorRamp mRamp; QgsLimitedRandomColorRamp mRamp;
}; };
/** \ingroup gui
* \class QgsLimitedRandomColorRampDialog
* A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
* \note added in QGIS 3.0
*/
class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog
{
Q_OBJECT
Q_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
public:
/** Constructor for QgsLimitedRandomColorRampDialog.
* @param ramp initial ramp to show in dialog
* @param parent parent widget
*/
QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp& ramp, QWidget* parent = nullptr );
/** Returns a color ramp representing the current settings from the dialog.
* @see setRamp()
*/
QgsLimitedRandomColorRamp ramp() const { return mWidget->ramp(); }
/** Sets the color ramp to show in the dialog.
* @param ramp color ramp
* @see ramp()
*/
void setRamp( const QgsLimitedRandomColorRamp& ramp ) { mWidget->setRamp( ramp ); }
signals:
//! Emitted when the dialog settings change
void changed();
private:
QgsLimitedRandomColorRampWidget* mWidget;
};
#endif #endif

View File

@ -135,6 +135,9 @@ void QgsColorRampComboBox::colorRampChanged( int index )
void QgsColorRampComboBox::editSourceRamp() void QgsColorRampComboBox::editSourceRamp()
{ {
QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this );
bool panelMode = panel && panel->dockMode();
QScopedPointer< QgsColorRamp > currentRamp( currentColorRamp() ); QScopedPointer< QgsColorRamp > currentRamp( currentColorRamp() );
if ( !currentRamp ) if ( !currentRamp )
return; return;
@ -152,21 +155,41 @@ void QgsColorRampComboBox::editSourceRamp()
else if ( currentRamp->type() == "random" ) else if ( currentRamp->type() == "random" )
{ {
QgsLimitedRandomColorRamp* randRamp = static_cast<QgsLimitedRandomColorRamp*>( currentRamp.data() ); QgsLimitedRandomColorRamp* randRamp = static_cast<QgsLimitedRandomColorRamp*>( currentRamp.data() );
QgsLimitedRandomColorRampDialog dlg( *randRamp, this ); if ( panelMode )
if ( dlg.exec() )
{ {
setSourceColorRamp( dlg.ramp().clone() ); QgsLimitedRandomColorRampWidget* widget = new QgsLimitedRandomColorRampWidget( *randRamp, this );
emit sourceRampEdited(); widget->setPanelTitle( tr( "Edit ramp" ) );
connect( widget, SIGNAL( changed() ), this, SLOT( rampWidgetUpdated() ) );
panel->openPanel( widget );
}
else
{
QgsLimitedRandomColorRampDialog dlg( *randRamp, this );
if ( dlg.exec() )
{
setSourceColorRamp( dlg.ramp().clone() );
emit sourceRampEdited();
}
} }
} }
else if ( currentRamp->type() == "colorbrewer" ) else if ( currentRamp->type() == "colorbrewer" )
{ {
QgsColorBrewerColorRamp* brewerRamp = static_cast<QgsColorBrewerColorRamp*>( currentRamp.data() ); QgsColorBrewerColorRamp* brewerRamp = static_cast<QgsColorBrewerColorRamp*>( currentRamp.data() );
QgsColorBrewerColorRampDialog dlg( *brewerRamp, this ); if ( panelMode )
if ( dlg.exec() )
{ {
setSourceColorRamp( dlg.ramp().clone() ); QgsColorBrewerColorRampWidget* widget = new QgsColorBrewerColorRampWidget( *brewerRamp, this );
emit sourceRampEdited(); widget->setPanelTitle( tr( "Edit ramp" ) );
connect( widget, SIGNAL( changed() ), this, SLOT( rampWidgetUpdated() ) );
panel->openPanel( widget );
}
else
{
QgsColorBrewerColorRampDialog dlg( *brewerRamp, this );
if ( dlg.exec() )
{
setSourceColorRamp( dlg.ramp().clone() );
emit sourceRampEdited();
}
} }
} }
else if ( currentRamp->type() == "cpt-city" ) else if ( currentRamp->type() == "cpt-city" )
@ -187,3 +210,21 @@ void QgsColorRampComboBox::editSourceRamp()
} }
} }
} }
void QgsColorRampComboBox::rampWidgetUpdated()
{
QgsLimitedRandomColorRampWidget* limitedRampWidget = qobject_cast< QgsLimitedRandomColorRampWidget* >( sender() );
if ( limitedRampWidget )
{
setSourceColorRamp( limitedRampWidget->ramp().clone() );
emit sourceRampEdited();
return;
}
QgsColorBrewerColorRampWidget* colorBrewerRampWidget = qobject_cast< QgsColorBrewerColorRampWidget* >( sender() );
if ( colorBrewerRampWidget )
{
setSourceColorRamp( colorBrewerRampWidget->ramp().clone() );
emit sourceRampEdited();
return;
}
}

View File

@ -83,6 +83,10 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
QgsStyle* mStyle; QgsStyle* mStyle;
QgsColorRamp* mSourceColorRamp; // owns the copy QgsColorRamp* mSourceColorRamp; // owns the copy
private slots:
void rampWidgetUpdated();
private: private:
bool mShowGradientOnly; bool mShowGradientOnly;

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>QgsColorBrewerColorRampDialogBase</class> <class>QgsColorBrewerColorRampWidgetBase</class>
<widget class="QDialog" name="QgsColorBrewerColorRampDialogBase"> <widget class="QgsPanelWidget" name="QgsColorBrewerColorRampWidgetBase">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>224</width>
<height>300</height> <height>164</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,32 +16,6 @@
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QGridLayout"> <layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scheme name</string>
</property>
<property name="buddy">
<cstring>cboSchemeName</cstring>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>71</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
@ -58,24 +32,18 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="cboColors"/> <widget class="QComboBox" name="cboColors"/>
</item> </item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scheme name</string>
</property>
<property name="buddy">
<cstring>cboSchemeName</cstring>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
@ -99,55 +67,32 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="standardButtons"> <property name="sizeHint" stdset="0">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <size>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</widget> </spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QgsPanelWidget</class>
<extends>QWidget</extends>
<header>qgspanelwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>cboSchemeName</tabstop> <tabstop>cboSchemeName</tabstop>
<tabstop>cboColors</tabstop> <tabstop>cboColors</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QgsColorBrewerColorRampDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>258</x>
<y>281</y>
</hint>
<hint type="destinationlabel">
<x>168</x>
<y>256</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsColorBrewerColorRampDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>363</x>
<y>273</y>
</hint>
<hint type="destinationlabel">
<x>371</x>
<y>259</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>QgsLimitedRandomColorRampDialogBase</class> <class>QgsLimitedRandomColorRampWidgetBase</class>
<widget class="QDialog" name="QgsLimitedRandomColorRampDialogBase"> <widget class="QgsPanelWidget" name="QgsLimitedRandomColorRampWidgetBase">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>429</width> <width>277</width>
<height>266</height> <height>205</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -15,7 +15,7 @@
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QGridLayout"> <layout class="QGridLayout" columnstretch="0,1,0,1">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -24,27 +24,20 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>from</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QSpinBox" name="spinHue1"> <widget class="QSpinBox" name="spinHue1">
<property name="maximum"> <property name="maximum">
<number>359</number> <number>359</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="2">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>to</string> <string>to</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="3">
<widget class="QSpinBox" name="spinHue2"> <widget class="QSpinBox" name="spinHue2">
<property name="maximum"> <property name="maximum">
<number>359</number> <number>359</number>
@ -54,6 +47,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinSat1">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
@ -61,28 +61,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>from</string>
</property>
</widget>
</item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QSpinBox" name="spinSat1">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>to</string> <string>to</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item row="1" column="3">
<widget class="QSpinBox" name="spinSat2"> <widget class="QSpinBox" name="spinSat2">
<property name="maximum"> <property name="maximum">
<number>255</number> <number>255</number>
@ -92,6 +78,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinVal1">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
@ -99,28 +92,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>from</string>
</property>
</widget>
</item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QSpinBox" name="spinVal1">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>to</string> <string>to</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="4"> <item row="2" column="3">
<widget class="QSpinBox" name="spinVal2"> <widget class="QSpinBox" name="spinVal2">
<property name="maximum"> <property name="maximum">
<number>255</number> <number>255</number>
@ -130,18 +109,14 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="3" column="0">
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Classes</string> <string>Classes</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="3" column="1">
<widget class="QSpinBox" name="spinCount"> <widget class="QSpinBox" name="spinCount">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
@ -154,40 +129,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
@ -208,50 +151,28 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="standardButtons"> <property name="sizeHint" stdset="0">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <size>
<width>20</width>
<height>40</height>
</size>
</property> </property>
</widget> </spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>QgsPanelWidget</class>
<extends>QWidget</extends>
<header>qgspanelwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QgsLimitedRandomColorRampDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsLimitedRandomColorRampDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>