Qt 4.0: bookdelegate.h Example File (demos/books/bookdelegate.h)

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# bookdelegate.h Example File
demos/books/bookdelegate.h

        #ifndef RATINGDELEGATE_H
        #define RATINGDELEGATE_H

        #include <QModelIndex>
        #include <QPixmap>
        #include <QSize>
        #include <QSqlRelationalDelegate>

        class QPainter;

        class BookDelegate : public QSqlRelationalDelegate
        {
        public:
            BookDelegate(QObject *parent);

            void paint(QPainter *painter, const QStyleOptionViewItem &option,
                       const QModelIndex &index) const;

            QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;

            bool editorEvent(QEvent *event, QAbstractItemModel *model,
                             const QStyleOptionViewItem &option,
                             const QModelIndex &index);

        private:
            QPixmap star;
        };

        #endif