diff options
Diffstat (limited to 'examples/itemviews/stardelegate')
-rw-r--r-- | examples/itemviews/stardelegate/stardelegate.cpp | 10 | ||||
-rw-r--r-- | examples/itemviews/stardelegate/stardelegate.h | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/itemviews/stardelegate/stardelegate.cpp b/examples/itemviews/stardelegate/stardelegate.cpp index 6c3677e..1e12971 100644 --- a/examples/itemviews/stardelegate/stardelegate.cpp +++ b/examples/itemviews/stardelegate/stardelegate.cpp @@ -58,7 +58,7 @@ void StarDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, starRating.paint(painter, option.rect, option.palette, StarRating::ReadOnly); } else { - QItemDelegate::paint(painter, option, index); + QStyledItemDelegate::paint(painter, option, index); } //! [0] } @@ -71,7 +71,7 @@ QSize StarDelegate::sizeHint(const QStyleOptionViewItem &option, StarRating starRating = qVariantValue<StarRating>(index.data()); return starRating.sizeHint(); } else { - return QItemDelegate::sizeHint(option, index); + return QStyledItemDelegate::sizeHint(option, index); } } //! [1] @@ -88,7 +88,7 @@ QWidget *StarDelegate::createEditor(QWidget *parent, this, SLOT(commitAndCloseEditor())); return editor; } else { - return QItemDelegate::createEditor(parent, option, index); + return QStyledItemDelegate::createEditor(parent, option, index); } } //! [2] @@ -102,7 +102,7 @@ void StarDelegate::setEditorData(QWidget *editor, StarEditor *starEditor = qobject_cast<StarEditor *>(editor); starEditor->setStarRating(starRating); } else { - QItemDelegate::setEditorData(editor, index); + QStyledItemDelegate::setEditorData(editor, index); } } //! [3] @@ -115,7 +115,7 @@ void StarDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, StarEditor *starEditor = qobject_cast<StarEditor *>(editor); model->setData(index, qVariantFromValue(starEditor->starRating())); } else { - QItemDelegate::setModelData(editor, model, index); + QStyledItemDelegate::setModelData(editor, model, index); } } //! [4] diff --git a/examples/itemviews/stardelegate/stardelegate.h b/examples/itemviews/stardelegate/stardelegate.h index 8333da9..84814ed 100644 --- a/examples/itemviews/stardelegate/stardelegate.h +++ b/examples/itemviews/stardelegate/stardelegate.h @@ -42,15 +42,15 @@ #ifndef STARDELEGATE_H #define STARDELEGATE_H -#include <QItemDelegate> +#include <QStyledItemDelegate> //! [0] -class StarDelegate : public QItemDelegate +class StarDelegate : public QStyledItemDelegate { Q_OBJECT public: - StarDelegate(QWidget *parent = 0) : QItemDelegate(parent) {} + StarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; |