![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2012 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvCoreQt/vrvCoreQt.h> 00013 00014 #include <vrvCoreQt/DtRangeEditorInterface.h> 00015 00016 #include <QtCore/QString> 00017 00018 #include <QtGui/QWidget> 00019 00020 class QAbstractItemDelegate; 00021 class QStandardItemModel; 00022 class QTreeWidgetItem; 00023 class QGraphicsScene; 00024 class QStandardItem; 00025 class QItemDelegate; 00026 class QGraphicsView; 00027 class QActionGroup; 00028 class QResizeEvent; 00029 class QVBoxLayout; 00030 class QTreeWidget; 00031 class QPushButton; 00032 class QTreeView; 00033 class QMenu; 00034 00035 namespace makVrv 00036 { 00037 00040 class DT_DLL_VRVCOREQT DtRangeEditorWidget 00041 : public QWidget , public DtRangeEditorInterface 00042 { Q_OBJECT; 00043 public: 00044 00045 const static int theRangeStartColumn = 0; 00046 const static int theRangeEndColumn = 1; 00047 const static int theColorColumn = 2; 00048 00049 public: 00050 00052 DtRangeEditorWidget( DtDe& de, QWidget* parent = 0, 00053 Qt::WindowFlags flags = 0 ); 00054 00056 virtual ~DtRangeEditorWidget(); 00057 00059 virtual void resizeEvent( QResizeEvent * event ); 00060 00062 virtual void clearGradient(); 00063 00065 virtual void setValueUnits( const QString& units ); 00066 00068 virtual void setValueDecimals( int decimals ); 00069 00071 virtual void setRangeBackgroundColor( const QColor& color ); 00072 00074 virtual QColor rangeBackgroundColor() const; 00075 00077 virtual void getRange( int index, float& rangeStart, float& rangeEnd, 00078 QColor& color ) const; 00079 00081 virtual int numRanges() const; 00082 00084 virtual void addControlPoint( double rangeStart, double rangeEnd, 00085 double red, double green, double blue, double alpha = 1.0 ); 00086 00089 virtual void addControlPoint( DtRangeEditorInterface::ControlPoint cp ); 00090 00092 virtual void setGradient( DtRangeEditorInterface::Gradient grad ); 00093 00095 virtual DtRangeEditorInterface::Gradient gradient() const; 00096 00098 virtual void removeControlPoint( int index ); 00099 00100 public slots: 00101 00103 virtual void decorate(); 00104 00105 protected slots: 00106 00109 virtual void insertNewControlPoint(); 00110 00113 virtual void removeSelectedControlPoint(); 00114 00116 virtual void updateGradient(); 00117 00118 protected: 00119 00122 void setupGui(); 00123 00126 void connectToSignals(); 00127 00129 virtual void insertNewControlPoint( double rangeStart, 00130 double rangeEnd, const QColor& color ); 00131 00133 std::string colorStringFromColor( const QColor& color ); 00134 00136 QList<QStandardItem*> modelRowFromAltitudeColor( 00137 double rangeStart, double rangeEnd, std::string color ); 00138 00140 virtual void changeEvent( QEvent* event ); 00141 00142 protected: 00143 00144 QString myRangeEndLabel; 00145 QString myRangeStartLabel; 00146 00147 QColor myBackgroundColor; 00148 00149 QAbstractItemDelegate* myColorDelegate; 00150 QAbstractItemDelegate* myValueDelegate; 00151 00152 QStandardItemModel* myControlPointModel; 00153 QGraphicsScene* myGradientScene; 00154 00155 QTreeView* myControlPointView; 00156 QGraphicsView* myGradientView; 00157 QPushButton* myAddControlPointButton; 00158 QPushButton* myRemoveControlPointButton; 00159 00160 makVrv::DtDe& myDe; 00161 00162 }; 00163 00164 }