mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[FEATURE] Make color brewer and limited random ramp editors show
inline in style panel
This commit is contained in:
parent
1d98b10904
commit
b225a82b3e
@ -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
|
||||
* \class QgsColorBrewerColorRampDialog
|
||||
* A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
|
||||
|
@ -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
|
||||
* \class QgsLimitedRandomColorRampDialog
|
||||
* 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
|
||||
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 );
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include <QAbstractButton>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#if 0 // unused
|
||||
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 )
|
||||
: QDialog( parent )
|
||||
QgsColorBrewerColorRampWidget::QgsColorBrewerColorRampWidget( const QgsColorBrewerColorRamp& ramp, QWidget* parent )
|
||||
: QgsPanelWidget( parent )
|
||||
, mRamp( ramp )
|
||||
{
|
||||
|
||||
@ -56,14 +57,14 @@ QgsColorBrewerColorRampDialog::QgsColorBrewerColorRampDialog( const QgsColorBrew
|
||||
connect( cboColors, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setColors() ) );
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::setRamp( const QgsColorBrewerColorRamp& ramp )
|
||||
void QgsColorBrewerColorRampWidget::setRamp( const QgsColorBrewerColorRamp& ramp )
|
||||
{
|
||||
mRamp = ramp;
|
||||
updateUi();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::populateVariants()
|
||||
void QgsColorBrewerColorRampWidget::populateVariants()
|
||||
{
|
||||
QString oldVariant = cboColors->currentText();
|
||||
|
||||
@ -85,13 +86,13 @@ void QgsColorBrewerColorRampDialog::populateVariants()
|
||||
cboColors->setCurrentIndex( idx );
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::updatePreview()
|
||||
void QgsColorBrewerColorRampWidget::updatePreview()
|
||||
{
|
||||
QSize size( 300, 40 );
|
||||
lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) );
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::updateUi()
|
||||
void QgsColorBrewerColorRampWidget::updateUi()
|
||||
{
|
||||
whileBlocking( cboSchemeName )->setCurrentIndex( cboSchemeName->findText( mRamp.schemeName() ) );
|
||||
populateVariants();
|
||||
@ -99,7 +100,7 @@ void QgsColorBrewerColorRampDialog::updateUi()
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::setSchemeName()
|
||||
void QgsColorBrewerColorRampWidget::setSchemeName()
|
||||
{
|
||||
// populate list of variants
|
||||
populateVariants();
|
||||
@ -109,10 +110,24 @@ void QgsColorBrewerColorRampDialog::setSchemeName()
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsColorBrewerColorRampDialog::setColors()
|
||||
void QgsColorBrewerColorRampWidget::setColors()
|
||||
{
|
||||
int num = cboColors->currentText().toInt();
|
||||
mRamp.setColors( num );
|
||||
updatePreview();
|
||||
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() ) );
|
||||
}
|
||||
|
@ -17,29 +17,29 @@
|
||||
#define QGSCOLORBREWERCOLORRAMPDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "qgspanelwidget.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "ui_qgscolorbrewercolorrampdialogbase.h"
|
||||
#include "ui_qgscolorbrewercolorrampwidgetbase.h"
|
||||
|
||||
class QgsColorBrewerColorRamp;
|
||||
|
||||
/** \ingroup gui
|
||||
* \class QgsColorBrewerColorRampDialog
|
||||
* A dialog which allows users to modify the properties of a QgsColorBrewerColorRamp.
|
||||
* \class QgsColorBrewerColorRampWidget
|
||||
* A widget which allows users to modify the properties of a QgsColorBrewerColorRamp.
|
||||
* \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_PROPERTY( QgsColorBrewerColorRamp ramp READ ramp WRITE setRamp )
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsColorBrewerColorRampDialog.
|
||||
/** Constructor for QgsColorBrewerColorRampWidget.
|
||||
* @param ramp initial ramp to show in dialog
|
||||
* @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.
|
||||
* @see setRamp()
|
||||
@ -70,4 +70,44 @@ class GUI_EXPORT QgsColorBrewerColorRampDialog : public QDialog, private Ui::Qgs
|
||||
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
|
||||
|
@ -19,10 +19,11 @@
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
|
||||
QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimitedRandomColorRamp& ramp, QWidget* parent )
|
||||
: QDialog( parent )
|
||||
QgsLimitedRandomColorRampWidget::QgsLimitedRandomColorRampWidget( const QgsLimitedRandomColorRamp& ramp, QWidget* parent )
|
||||
: QgsPanelWidget( parent )
|
||||
, mRamp( ramp )
|
||||
{
|
||||
setupUi( this );
|
||||
@ -38,14 +39,14 @@ QgsLimitedRandomColorRampDialog::QgsLimitedRandomColorRampDialog( const QgsLimit
|
||||
connect( spinVal2, SIGNAL( valueChanged( int ) ), this, SLOT( setVal2( int ) ) );
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setRamp( const QgsLimitedRandomColorRamp& ramp )
|
||||
void QgsLimitedRandomColorRampWidget::setRamp( const QgsLimitedRandomColorRamp& ramp )
|
||||
{
|
||||
mRamp = ramp;
|
||||
updateUi();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::updatePreview()
|
||||
void QgsLimitedRandomColorRampWidget::updatePreview()
|
||||
{
|
||||
mRamp.updateColors();
|
||||
|
||||
@ -53,7 +54,7 @@ void QgsLimitedRandomColorRampDialog::updatePreview()
|
||||
lblPreview->setPixmap( QgsSymbolLayerUtils::colorRampPreviewPixmap( &mRamp, size ) );
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::updateUi()
|
||||
void QgsLimitedRandomColorRampWidget::updateUi()
|
||||
{
|
||||
spinCount->setValue( mRamp.count() );
|
||||
spinHue1->setValue( mRamp.hueMin() );
|
||||
@ -65,51 +66,65 @@ void QgsLimitedRandomColorRampDialog::updateUi()
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setCount( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setCount( int val )
|
||||
{
|
||||
mRamp.setCount( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setHue1( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setHue1( int val )
|
||||
{
|
||||
mRamp.setHueMin( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setHue2( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setHue2( int val )
|
||||
{
|
||||
mRamp.setHueMax( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setSat1( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setSat1( int val )
|
||||
{
|
||||
mRamp.setSatMin( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setSat2( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setSat2( int val )
|
||||
{
|
||||
mRamp.setSatMax( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setVal1( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setVal1( int val )
|
||||
{
|
||||
mRamp.setValMin( val );
|
||||
updatePreview();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsLimitedRandomColorRampDialog::setVal2( int val )
|
||||
void QgsLimitedRandomColorRampWidget::setVal2( int val )
|
||||
{
|
||||
mRamp.setValMax( val );
|
||||
updatePreview();
|
||||
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() ) );
|
||||
}
|
||||
|
@ -17,27 +17,27 @@
|
||||
#define QGsLIMITEDRANDOMCOLORRAMPDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "qgspanelwidget.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "ui_qgslimitedrandomcolorrampdialogbase.h"
|
||||
|
||||
#include "ui_qgslimitedrandomcolorrampwidgetbase.h"
|
||||
|
||||
/** \ingroup gui
|
||||
* \class QgsLimitedRandomColorRampDialog
|
||||
* A dialog which allows users to modify the properties of a QgsLimitedRandomColorRamp.
|
||||
* \class QgsLimitedRandomColorRampWidget
|
||||
* A widget which allows users to modify the properties of a QgsLimitedRandomColorRamp.
|
||||
* \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_PROPERTY( QgsLimitedRandomColorRamp ramp READ ramp WRITE setRamp )
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsLimitedRandomColorRampDialog.
|
||||
/** Constructor for QgsLimitedRandomColorRampWidget.
|
||||
* @param ramp initial ramp to show in dialog
|
||||
* @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.
|
||||
* @see setRamp()
|
||||
@ -80,4 +80,45 @@ class GUI_EXPORT QgsLimitedRandomColorRampDialog : public QDialog, private Ui::Q
|
||||
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
|
||||
|
@ -135,6 +135,9 @@ void QgsColorRampComboBox::colorRampChanged( int index )
|
||||
|
||||
void QgsColorRampComboBox::editSourceRamp()
|
||||
{
|
||||
QgsPanelWidget* panel = QgsPanelWidget::findParentPanel( this );
|
||||
bool panelMode = panel && panel->dockMode();
|
||||
|
||||
QScopedPointer< QgsColorRamp > currentRamp( currentColorRamp() );
|
||||
if ( !currentRamp )
|
||||
return;
|
||||
@ -152,21 +155,41 @@ void QgsColorRampComboBox::editSourceRamp()
|
||||
else if ( currentRamp->type() == "random" )
|
||||
{
|
||||
QgsLimitedRandomColorRamp* randRamp = static_cast<QgsLimitedRandomColorRamp*>( currentRamp.data() );
|
||||
QgsLimitedRandomColorRampDialog dlg( *randRamp, this );
|
||||
if ( dlg.exec() )
|
||||
if ( panelMode )
|
||||
{
|
||||
setSourceColorRamp( dlg.ramp().clone() );
|
||||
emit sourceRampEdited();
|
||||
QgsLimitedRandomColorRampWidget* widget = new QgsLimitedRandomColorRampWidget( *randRamp, this );
|
||||
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" )
|
||||
{
|
||||
QgsColorBrewerColorRamp* brewerRamp = static_cast<QgsColorBrewerColorRamp*>( currentRamp.data() );
|
||||
QgsColorBrewerColorRampDialog dlg( *brewerRamp, this );
|
||||
if ( dlg.exec() )
|
||||
if ( panelMode )
|
||||
{
|
||||
setSourceColorRamp( dlg.ramp().clone() );
|
||||
emit sourceRampEdited();
|
||||
QgsColorBrewerColorRampWidget* widget = new QgsColorBrewerColorRampWidget( *brewerRamp, this );
|
||||
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" )
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,10 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
|
||||
QgsStyle* mStyle;
|
||||
QgsColorRamp* mSourceColorRamp; // owns the copy
|
||||
|
||||
private slots:
|
||||
|
||||
void rampWidgetUpdated();
|
||||
|
||||
private:
|
||||
bool mShowGradientOnly;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsColorBrewerColorRampDialogBase</class>
|
||||
<widget class="QDialog" name="QgsColorBrewerColorRampDialogBase">
|
||||
<class>QgsColorBrewerColorRampWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsColorBrewerColorRampWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>224</width>
|
||||
<height>164</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -16,32 +16,6 @@
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<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">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@ -58,24 +32,18 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cboColors"/>
|
||||
</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>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@ -99,55 +67,32 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cboSchemeName</tabstop>
|
||||
<tabstop>cboColors</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QgsLimitedRandomColorRampDialogBase</class>
|
||||
<widget class="QDialog" name="QgsLimitedRandomColorRampDialogBase">
|
||||
<class>QgsLimitedRandomColorRampWidgetBase</class>
|
||||
<widget class="QgsPanelWidget" name="QgsLimitedRandomColorRampWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>429</width>
|
||||
<height>266</height>
|
||||
<width>277</width>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout">
|
||||
<layout class="QGridLayout" columnstretch="0,1,0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
@ -24,27 +24,20 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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">
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="spinHue2">
|
||||
<property name="maximum">
|
||||
<number>359</number>
|
||||
@ -54,6 +47,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
@ -61,28 +61,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="spinSat2">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
@ -92,6 +78,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
@ -99,28 +92,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="spinVal2">
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
@ -130,18 +109,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Classes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="spinCount">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
@ -154,40 +129,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
@ -208,50 +151,28 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsPanelWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qgspanelwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<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>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user