QGIS API Documentation  master-6227475
src/gui/symbology-ng/qgsvectorrandomcolorrampv2dialog.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsvectorrandomcolorrampv2dialog.cpp
00003     ---------------------
00004     begin                : November 2009
00005     copyright            : (C) 2009 by Martin Dobias
00006     email                : wonder dot sk at gmail dot com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #include "qgsvectorrandomcolorrampv2dialog.h"
00017 
00018 #include "qgsvectorcolorrampv2.h"
00019 
00020 #include <QColorDialog>
00021 
00022 
00023 QgsVectorRandomColorRampV2Dialog::QgsVectorRandomColorRampV2Dialog( QgsVectorRandomColorRampV2* ramp, QWidget* parent )
00024     : QDialog( parent ), mRamp( ramp )
00025 {
00026   setupUi( this );
00027 
00028   spinCount->setValue( ramp->count() );
00029   spinHue1->setValue( ramp->hueMin() );
00030   spinHue2->setValue( ramp->hueMax() );
00031   spinSat1->setValue( ramp->satMin() );
00032   spinSat2->setValue( ramp->satMax() );
00033   spinVal1->setValue( ramp->valMin() );
00034   spinVal2->setValue( ramp->valMax() );
00035 
00036   connect( spinCount, SIGNAL( valueChanged( int ) ), this, SLOT( setCount( int ) ) );
00037   connect( spinHue1, SIGNAL( valueChanged( int ) ), this, SLOT( setHue1( int ) ) );
00038   connect( spinHue2, SIGNAL( valueChanged( int ) ), this, SLOT( setHue2( int ) ) );
00039   connect( spinSat1, SIGNAL( valueChanged( int ) ), this, SLOT( setSat1( int ) ) );
00040   connect( spinSat2, SIGNAL( valueChanged( int ) ), this, SLOT( setSat2( int ) ) );
00041   connect( spinVal1, SIGNAL( valueChanged( int ) ), this, SLOT( setVal1( int ) ) );
00042   connect( spinVal2, SIGNAL( valueChanged( int ) ), this, SLOT( setVal2( int ) ) );
00043 
00044   updatePreview();
00045 }
00046 
00047 void QgsVectorRandomColorRampV2Dialog::updatePreview()
00048 {
00049   mRamp->updateColors();
00050 
00051   QSize size( 300, 40 );
00052   lblPreview->setPixmap( QgsSymbolLayerV2Utils::colorRampPreviewPixmap( mRamp, size ) );
00053 }
00054 
00055 void QgsVectorRandomColorRampV2Dialog::setCount( int val )
00056 {
00057   mRamp->setCount( val );
00058   updatePreview();
00059 }
00060 
00061 void QgsVectorRandomColorRampV2Dialog::setHue1( int val )
00062 {
00063   mRamp->setHueMin( val );
00064   updatePreview();
00065 }
00066 
00067 void QgsVectorRandomColorRampV2Dialog::setHue2( int val )
00068 {
00069   mRamp->setHueMax( val );
00070   updatePreview();
00071 }
00072 
00073 void QgsVectorRandomColorRampV2Dialog::setSat1( int val )
00074 {
00075   mRamp->setSatMin( val );
00076   updatePreview();
00077 }
00078 
00079 void QgsVectorRandomColorRampV2Dialog::setSat2( int val )
00080 {
00081   mRamp->setSatMax( val );
00082   updatePreview();
00083 }
00084 
00085 void QgsVectorRandomColorRampV2Dialog::setVal1( int val )
00086 {
00087   mRamp->setValMin( val );
00088   updatePreview();
00089 }
00090 
00091 void QgsVectorRandomColorRampV2Dialog::setVal2( int val )
00092 {
00093   mRamp->setValMax( val );
00094   updatePreview();
00095 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines