QSapecNG
 All Classes Functions Enumerations Properties
delegate.h
00001 /*
00002     QSapecNG - Qt based SapecNG GUI front-end
00003     Copyright (C) 2009, Michele Caini
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef DELEGATE_H
00021 #define DELEGATE_H
00022 
00023 
00024 #include <QtGui/QItemDelegate>
00025 
00026 
00027 namespace qsapecng
00028 {
00029 
00030 
00031 class NullDelegate: public QItemDelegate
00032 {
00033 
00034   Q_OBJECT
00035 
00036 public:
00037   NullDelegate(QObject* parent = 0)
00038     : QItemDelegate(parent) { }
00039 
00040   QWidget* createEditor(
00041       QWidget* parent,
00042       const QStyleOptionViewItem& option,
00043       const QModelIndex& index
00044     ) const { return 0; }
00045 
00046   void setEditorData(QWidget* editor, const QModelIndex& index) const { }
00047 
00048   void setModelData(
00049       QWidget* editor,
00050       QAbstractItemModel* model,
00051       const QModelIndex& index
00052     ) const { }
00053 
00054   void updateEditorGeometry(
00055       QWidget* editor,
00056       const QStyleOptionViewItem& option,
00057       const QModelIndex& index
00058     ) const { }
00059 
00060 };
00061 
00062 
00063 class QDoubleSpinBoxDelegate: public QItemDelegate
00064 {
00065 
00066   Q_OBJECT
00067 
00068 public:
00069   QDoubleSpinBoxDelegate(QObject* parent = 0)
00070     : QItemDelegate(parent) { }
00071 
00072   QWidget* createEditor(
00073       QWidget* parent,
00074       const QStyleOptionViewItem& option,
00075       const QModelIndex& index
00076     ) const;
00077 
00078   void setEditorData(QWidget* editor, const QModelIndex& index) const;
00079 
00080   void setModelData(
00081       QWidget* editor,
00082       QAbstractItemModel* model,
00083       const QModelIndex& index
00084     ) const;
00085 
00086   void updateEditorGeometry(
00087       QWidget* editor,
00088       const QStyleOptionViewItem& option,
00089       const QModelIndex& index
00090     ) const;
00091 
00092 };
00093 
00094 
00095 }
00096 
00097 
00098 #endif // DELEGATE_H
 All Classes Functions Enumerations Properties