VR-Forces 4.0.4 Class Documentation
include/vrvCoreQt/DtGradientEditorWidget.h
Go to the documentation of this file.
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/DtGradientEditorInterface.h>
00015 
00016 #include <QtCore/QString>
00017 
00018 #include <QtGui/QWidget>
00019 
00020 class QTreeView;
00021 class QPushButton;
00022 class QStandardItem;
00023 class QGraphicsView;
00024 class QGraphicsScene;
00025 class QStandardItemModel;
00026 class QAbstractItemDelegate;
00027 
00028 namespace makVrv
00029 {
00030 
00031    class DtDe;
00032 
00035    class DT_DLL_VRVCOREQT DtGradientEditorWidget
00036       : public QWidget
00037       , public DtGradientEditorInterface
00038    {
00039 
00040       Q_OBJECT
00041 
00042    public:
00043 
00044       const static int theAltitudeColumn = 0;
00045       const static int theDisplayColorColumn = 1;
00046 
00047    public:
00048 
00050       DtGradientEditorWidget( DtDe& de, QWidget* parent = 0,
00051          Qt::WindowFlags flags = 0 );
00052 
00054       virtual ~DtGradientEditorWidget();
00055 
00057       virtual void resizeEvent( QResizeEvent * event );
00058 
00060       virtual void clearGradient();
00061 
00063       virtual void setAltitudeUnits( const QString& units );
00064 
00066       virtual void setAltitudeDecimals( int decimals );
00067 
00069       virtual void addControlPoint( double location, double red,
00070          double green, double blue, double alpha = 1.0 );
00071 
00073       virtual void addControlPoint( DtGradientEditorInterface::ControlPoint cp );
00074 
00076       virtual void setGradient( DtGradientEditorInterface::Gradient grad );
00077 
00079       virtual const DtGradientEditorInterface::Gradient gradient() const;
00080 
00082       virtual void removeControlPoint( int index );
00083 
00084    public slots:
00085 
00087       virtual void decorate();
00088 
00089    protected slots:
00090 
00093       virtual void insertNewControlPoint();
00094 
00097       virtual void removeSelectedControlPoint();
00098 
00100       virtual void updateGradient();
00101 
00102    protected:
00103 
00106       void setupGui();
00107 
00110       void connectToSignals();
00111 
00113       virtual void insertNewControlPoint(double height, const QColor& color);
00114 
00116       std::string colorStringFromColor(const QColor& color);
00117 
00119       QList<QStandardItem*> modelRowFromAltitudeColor(double altitude, std::string color);
00120 
00121    protected:
00122 
00123       QString myAltitudeUnitsLabel;
00124 
00125       QAbstractItemDelegate* myColorDelegate;
00126       QAbstractItemDelegate* myAltitudeDelegate;
00127 
00128       QStandardItemModel* myControlPointModel;
00129       QGraphicsScene* myGradientScene;
00130 
00131       QTreeView* myControlPointView;
00132       QGraphicsView* myGradientView;
00133       QPushButton* myAddControlPointButton;
00134       QPushButton* myRemoveControlPointButton;
00135 
00136       makVrv::DtDe& myDe;
00137 
00138    };
00139 
00140 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)