Doc: Use QStyledItemDelegate and frameless spinboxes in spinbox delegate example
authorGeir Vattekar <geir.vattekar@nokia.com>
Fri, 7 Sep 2012 09:58:34 +0000 (11:58 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 18 Sep 2012 18:59:03 +0000 (20:59 +0200)
Task-number: QTBUG-18847
Change-Id: I5347a1028b6f45a60e43fb75f6d362efecb6880b
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Marius Bugge Monsen <marius@cutehacks.com>
Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
examples/widgets/doc/spinboxdelegate.qdoc
examples/widgets/itemviews/spinboxdelegate/delegate.cpp
examples/widgets/itemviews/spinboxdelegate/delegate.h

index 95e764d..258811c 100644 (file)
@@ -68,7 +68,7 @@
 
     \snippet itemviews/spinboxdelegate/delegate.cpp 0
 
-    Since the delegate is a subclass of QItemDelegate, the data it retrieves
+    Since the delegate is a subclass of QStyledItemDelegate, the data it retrieves
     from the model is displayed in a default style, and we do not need to
     provide a custom \c paintEvent().
 
 
     The table view is informed about the delegate, and will use it to
     display each of the items. Since the delegate is a subclass of
-    QItemDelegate, each cell in the table will be rendered using standard
+    QStyledItemDelegate, each cell in the table will be rendered using standard
     painting operations.
 
     We insert some arbitrary data into the model for demonstration purposes:
index 2967b6a..974ec26 100644 (file)
@@ -52,7 +52,7 @@
 
 //! [0]
 SpinBoxDelegate::SpinBoxDelegate(QObject *parent)
-    : QItemDelegate(parent)
+    : QStyledItemDelegate(parent)
 {
 }
 //! [0]
@@ -63,6 +63,7 @@ QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
     const QModelIndex &/* index */) const
 {
     QSpinBox *editor = new QSpinBox(parent);
+    editor->setFrame(false);
     editor->setMinimum(0);
     editor->setMaximum(100);
 
index 19d6470..56c2196 100644 (file)
 #ifndef DELEGATE_H
 #define DELEGATE_H
 
-#include <QItemDelegate>
+#include <QStyledItemDelegate>
 #include <QModelIndex>
 #include <QObject>
 #include <QSize>
 #include <QSpinBox>
 
 //! [0]
-class SpinBoxDelegate : public QItemDelegate
+class SpinBoxDelegate : public QStyledItemDelegate
 {
     Q_OBJECT