+#include <QToolButton>
+
+HYDROGUI_ColorDelegate::HYDROGUI_ColorDelegate( QWidget* theParent )
+{
+}
+
+HYDROGUI_ColorDelegate::~HYDROGUI_ColorDelegate()
+{
+}
+
+void HYDROGUI_ColorDelegate::paint( QPainter* thePainter, const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex ) const
+{
+ QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value<QColor>();
+ thePainter->fillRect( theOption.rect, aColor );
+}
+
+QWidget* HYDROGUI_ColorDelegate::createEditor( QWidget* theParent,
+ const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex ) const
+{
+ QColor aColor = theIndex.data( Qt::BackgroundColorRole ).value<QColor>();
+ QColor aNewColor = QColorDialog::getColor( aColor );
+ if( aNewColor.isValid() )
+ {
+ QAbstractItemModel* aModel = const_cast<QAbstractItemModel*>( theIndex.model() );
+ QVariant aValue = qVariantFromValue( aNewColor );
+ aModel->setData( theIndex, aValue, Qt::BackgroundColorRole );
+ }
+ return 0;
+}
+
+void HYDROGUI_ColorDelegate::setEditorData( QWidget* theEditor, const QModelIndex& theIndex ) const
+{
+}
+
+void HYDROGUI_ColorDelegate::setModelData( QWidget* theEditor, QAbstractItemModel* theModel,
+ const QModelIndex& theIndex ) const
+{
+}
+
+QSize HYDROGUI_ColorDelegate::sizeHint( const QStyleOptionViewItem& theOption, const QModelIndex& theIndex ) const
+{
+ return theOption.rect.size();
+}
+
+
+
+const int COLUMNS_COUNT = 4;
+