QtiPlot  0.9.8.2
ColorMapEditor.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ColorMapEditor.h
3  Project : QtiPlot
4 --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : A QwtLinearColorMap Editor Widget
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  * This program is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public License *
23  * along with this program; if not, write to the Free Software *
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25  * Boston, MA 02110-1301 USA *
26  * *
27  ***************************************************************************/
28 #ifndef COLORMAPEDITOR_H
29 #define COLORMAPEDITOR_H
30 
31 #include <QWidget>
32 #include <QLocale>
33 #include <LinearColorMap.h>
34 
35 class QPushButton;
36 class QTableWidget;
37 class QCheckBox;
38 class DoubleSpinBox;
39 
41 
47 class ColorMapEditor: public QWidget
48 {
49  Q_OBJECT
50 
51 public:
53 
56  ColorMapEditor(const QLocale& locale = QLocale::system(), int precision = 6, QWidget* parent = 0);
60  void setColorMap(const LinearColorMap& map);
62  void setRange(double min, double max);
63 
64 signals:
65  void scalingChanged();
66 
67 protected slots:
68  void updateLowerRangeLimit(double);
69  void updateUpperRangeLimit(double);
70  void updateColorMap();
71  void enableButtons(int row);
72  void showColorDialog(int row, int col);
73  void insertLevel();
74  void deleteLevel();
75  void setScaledColors(bool scale = true);
77 
78  bool eventFilter(QObject *object, QEvent *e);
79 
80 private:
82  QTableWidget *table;
83  QPushButton *insertBtn, *deleteBtn;
84  QCheckBox *scaleColorsBox;
85 
89  double min_val, max_val;
91  QLocale d_locale;
94 };
95 
96 #endif
void setRange(double min, double max)
Use this function to initialize the values range.
Definition: ColorMapEditor.cpp:209
void scalingChanged()
QCheckBox * scaleColorsBox
Definition: ColorMapEditor.h:84
QPushButton * deleteBtn
Definition: ColorMapEditor.h:83
LinearColorMap color_map
Color map object.
Definition: ColorMapEditor.h:87
void setColorMap(const LinearColorMap &map)
Use this function to initialize the color map to be edited.
Definition: ColorMapEditor.cpp:110
void updateUpperRangeLimit(double)
Definition: ColorMapEditor.cpp:192
QPushButton * insertBtn
Definition: ColorMapEditor.h:83
QLocale d_locale
Locale settings used to display level values.
Definition: ColorMapEditor.h:91
void spinBoxActivated(DoubleSpinBox *)
Definition: ColorMapEditor.cpp:340
A customized QwtLinearColorMap.
Definition: LinearColorMap.h:39
A QDoubleSpinBox allowing to customize numbers display with respect to locale settings.
Definition: DoubleSpinBox.h:39
QTableWidget * table
Table displaying the values ranges in the first column and their corresponding colors in the second c...
Definition: ColorMapEditor.h:82
#define min(a, b)
Definition: ShapiroWilkTest.cpp:36
int d_precision
Precision used to display level values.
Definition: ColorMapEditor.h:93
void updateColorMap()
Definition: ColorMapEditor.cpp:93
void enableButtons(int row)
Definition: ColorMapEditor.cpp:314
bool eventFilter(QObject *object, QEvent *e)
Definition: ColorMapEditor.cpp:289
void setScaledColors(bool scale=true)
Definition: ColorMapEditor.cpp:330
LinearColorMap colorMap()
Returns the customized color map.
Definition: ColorMapEditor.h:58
double max_val
Definition: ColorMapEditor.h:89
void deleteLevel()
Definition: ColorMapEditor.cpp:263
void insertLevel()
Definition: ColorMapEditor.cpp:215
ColorMapEditor(const QLocale &locale=QLocale::system(), int precision=6, QWidget *parent=0)
Constructor.
Definition: ColorMapEditor.cpp:42
A complex widget allowing to customize a QwtLinearColorMap.
Definition: ColorMapEditor.h:47
double min_val
Levels range.
Definition: ColorMapEditor.h:89
void showColorDialog(int row, int col)
Definition: ColorMapEditor.cpp:270
void updateLowerRangeLimit(double)
Definition: ColorMapEditor.cpp:170