QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : ColorMapEditor.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : A QwtLinearColorMap Editor Widget 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 * This program is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU General Public License * 00023 * along with this program; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00025 * Boston, MA 02110-1301 USA * 00026 * * 00027 ***************************************************************************/ 00028 #ifndef COLORMAPEDITOR_H 00029 #define COLORMAPEDITOR_H 00030 00031 #include <QWidget> 00032 #include <QLocale> 00033 #include <qwt_color_map.h> 00034 00035 class QPushButton; 00036 class QTableWidget; 00037 class QCheckBox; 00038 class DoubleSpinBox; 00039 00041 00047 class ColorMapEditor: public QWidget 00048 { 00049 Q_OBJECT 00050 00051 public: 00053 00056 ColorMapEditor(const QLocale& locale = QLocale::system(), int precision = 6, QWidget* parent = 0); 00058 QwtLinearColorMap colorMap(){return color_map;}; 00060 void setColorMap(const QwtLinearColorMap& map); 00062 void setRange(double min, double max); 00064 static QString saveToXmlString(const QwtLinearColorMap& color_map); 00065 00066 signals: 00067 void scalingChanged(); 00068 00069 protected slots: 00070 void updateColorMap(); 00071 void enableButtons(int row); 00072 void showColorDialog(int row, int col); 00073 void insertLevel(); 00074 void deleteLevel(); 00075 void setScaledColors(bool scale = true); 00076 void spinBoxActivated(DoubleSpinBox *); 00077 00078 bool eventFilter(QObject *object, QEvent *e); 00079 00080 private: 00082 QTableWidget *table; 00083 QPushButton *insertBtn, *deleteBtn; 00084 QCheckBox *scaleColorsBox; 00085 00087 QwtLinearColorMap color_map; 00089 double min_val, max_val; 00091 QLocale d_locale; 00093 int d_precision; 00094 }; 00095 00096 #endif