QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsvectorrandomcolorrampv2dialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorrandomcolorrampv2dialog.cpp
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
17 
18 #include "qgsvectorcolorrampv2.h"
19 
20 #include <QColorDialog>
21 
22 
24  : QDialog( parent ), mRamp( ramp )
25 {
26  setupUi( this );
27 
28  spinCount->setValue( ramp->count() );
29  spinHue1->setValue( ramp->hueMin() );
30  spinHue2->setValue( ramp->hueMax() );
31  spinSat1->setValue( ramp->satMin() );
32  spinSat2->setValue( ramp->satMax() );
33  spinVal1->setValue( ramp->valMin() );
34  spinVal2->setValue( ramp->valMax() );
35 
36  connect( spinCount, SIGNAL( valueChanged( int ) ), this, SLOT( setCount( int ) ) );
37  connect( spinHue1, SIGNAL( valueChanged( int ) ), this, SLOT( setHue1( int ) ) );
38  connect( spinHue2, SIGNAL( valueChanged( int ) ), this, SLOT( setHue2( int ) ) );
39  connect( spinSat1, SIGNAL( valueChanged( int ) ), this, SLOT( setSat1( int ) ) );
40  connect( spinSat2, SIGNAL( valueChanged( int ) ), this, SLOT( setSat2( int ) ) );
41  connect( spinVal1, SIGNAL( valueChanged( int ) ), this, SLOT( setVal1( int ) ) );
42  connect( spinVal2, SIGNAL( valueChanged( int ) ), this, SLOT( setVal2( int ) ) );
43 
44  updatePreview();
45 }
46 
48 {
50 
51  QSize size( 300, 40 );
52  lblPreview->setPixmap( QgsSymbolLayerV2Utils::colorRampPreviewPixmap( mRamp, size ) );
53 }
54 
56 {
57  mRamp->setCount( val );
58  updatePreview();
59 }
60 
62 {
63  mRamp->setHueMin( val );
64  updatePreview();
65 }
66 
68 {
69  mRamp->setHueMax( val );
70  updatePreview();
71 }
72 
74 {
75  mRamp->setSatMin( val );
76  updatePreview();
77 }
78 
80 {
81  mRamp->setSatMax( val );
82  updatePreview();
83 }
84 
86 {
87  mRamp->setValMin( val );
88  updatePreview();
89 }
90 
92 {
93  mRamp->setValMax( val );
94  updatePreview();
95 }