Commit dd8875e5 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

UIParamGradient added.

parent 1726a645
/*
* (c) LSIIT, UMR CNRS/UdS
* Authors: F. Larue.
*
* See licence.txt for additional information.
*/
#ifndef UIPARAMGRADIENT_H
#define UIPARAMGRADIENT_H
#include "UIParam.h"
#include "GradientWidget.h"
class UIParamGradient : public UIParam
{
public:
inline UIParamGradient( const QString& id,
const QString& name,
const QString& description,
const QColor& color0,
const QColor& color1 );
inline UIParamGradient( const QString& id,
const QString& name,
const QString& description,
const QList<QColor>& colors,
const QList<float>& values );
//inline void SetValue( const QVector3D& value ) { ((GradientWidget*) m_Widget)->setDirection( value ); }
inline QColor Value( float v ) const { return ((GradientWidget*) m_Widget)->getColor(v); }
inline const QWidget* Widget() const { return m_Widget; }
inline QWidget* Widget() { return m_Widget; }
inline void ArrangeInLayout( QGridLayout *l, int line );
inline void ConnectModificationSignal();
};
inline UIParamGradient::UIParamGradient( const QString& id,
const QString& name,
const QString& description,
const QColor& color0,
const QColor& color1 ) : UIParam(id,name,description)
{
m_Widget = new GradientWidget( color0, color1 );
if( !m_Description.isNull() && !m_Description.isEmpty() )
m_Widget->setToolTip( m_Description );
}
inline UIParamGradient::UIParamGradient( const QString& id,
const QString& name,
const QString& description,
const QList<QColor>& colors,
const QList<float>& values ) : UIParam(id,name,description)
{
m_Widget = new GradientWidget( colors, values );
if( !m_Description.isNull() && !m_Description.isEmpty() )
m_Widget->setToolTip( m_Description );
}
inline void UIParamGradient::ArrangeInLayout( QGridLayout *l, int line )
{
l->addWidget( m_Widget, line,0, 1,2 );
}
inline void UIParamGradient::ConnectModificationSignal()
{
QObject::connect( m_Widget, SIGNAL(gradientModified()), this, SLOT(triggerParameterUpdate()) );
}
#endif // UIPARAMGRADIENT_H
......@@ -9,6 +9,7 @@
#ifndef UIPARAMSET_H
#define UIPARAMSET_H
#include <QString>
#include <QtWidgets>
......@@ -28,11 +29,14 @@
#include "UIParamBufferSize1D.h"
#include "UIParamBufferSize2D.h"
#include "UIParamFunction.h"
#include "UIParamGradient.h"
#include "UIParamAnimation.h"
#include "UIParamChildren.h"
#include "UIParamSlider.h"
class UIParamSet : public QGroupBox
{
Q_OBJECT
......@@ -117,6 +121,7 @@ public:
inline UIParamBufferSize1D* GetBufferSize1D ( const QString &paramName ) const { return GetParam<UIParamBufferSize1D >( paramName ); }
inline UIParamBufferSize2D* GetBufferSize2D ( const QString &paramName ) const { return GetParam<UIParamBufferSize2D >( paramName ); }
inline UIParamFunction* GetFunction ( const QString &paramName ) const { return GetParam<UIParamFunction >( paramName ); }
inline UIParamGradient* GetGradient ( const QString &paramName ) const { return GetParam<UIParamGradient >( paramName ); }
inline UIParamChildren* GetChild ( const QString &paramName ) const { return GetParam<UIParamChildren >( paramName ); }
inline UIParamSlider* GetSlider ( const QString &paramName ) const { return GetParam<UIParamSlider >( paramName ); }
inline UIParamAnimation* GetAnimationCtrl () const { return m_AnimationCtrl; }
......@@ -135,4 +140,6 @@ private slots:
};
#endif // UIPARAMSET_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment