1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.widgets.abstractitemdelegate; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.abstractitemmodel; 17 import qt.core.coreevent; 18 import qt.core.list; 19 import qt.core.object; 20 import qt.core.size; 21 import qt.gui.event; 22 import qt.gui.painter; 23 import qt.helpers; 24 import qt.widgets.abstractitemview; 25 import qt.widgets.styleoption; 26 import qt.widgets.widget; 27 28 /+ QT_REQUIRE_CONFIG(itemviews); +/ 29 30 31 extern(C++, class) struct QAbstractItemDelegatePrivate; 32 33 /// Binding for C++ class [QAbstractItemDelegate](https://doc.qt.io/qt-6/qabstractitemdelegate.html). 34 abstract class /+ Q_WIDGETS_EXPORT +/ QAbstractItemDelegate : QObject 35 { 36 mixin(Q_OBJECT); 37 38 public: 39 40 enum EndEditHint { 41 NoHint, 42 EditNextItem, 43 EditPreviousItem, 44 SubmitModelCache, 45 RevertModelCache 46 } 47 48 mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{ 49 /+ explicit +/this(QObject parent = null); 50 })); 51 /+ virtual +/~this(); 52 53 // painting 54 /+ virtual +/ abstract void paint(QPainter* painter, 55 ref const(QStyleOptionViewItem) option, 56 ref const(QModelIndex) index) const; 57 58 /+ virtual +/ abstract QSize sizeHint(ref const(QStyleOptionViewItem) option, 59 ref const(QModelIndex) index) const; 60 61 // editing 62 /+ virtual +/ QWidget createEditor(QWidget parent, 63 ref const(QStyleOptionViewItem) option, 64 ref const(QModelIndex) index) const; 65 66 /+ virtual +/ void destroyEditor(QWidget editor, ref const(QModelIndex) index) const; 67 68 /+ virtual +/ void setEditorData(QWidget editor, ref const(QModelIndex) index) const; 69 70 /+ virtual +/ void setModelData(QWidget editor, 71 QAbstractItemModel model, 72 ref const(QModelIndex) index) const; 73 74 /+ virtual +/ void updateEditorGeometry(QWidget editor, 75 ref const(QStyleOptionViewItem) option, 76 ref const(QModelIndex) index) const; 77 78 // for non-widget editors 79 /+ virtual +/ bool editorEvent(QEvent event, 80 QAbstractItemModel model, 81 ref const(QStyleOptionViewItem) option, 82 ref const(QModelIndex) index); 83 84 /+ virtual +/ bool helpEvent(QHelpEvent event, 85 QAbstractItemView view, 86 ref const(QStyleOptionViewItem) option, 87 ref const(QModelIndex) index); 88 89 /+ virtual +/ QList!(int) paintingRoles() const; 90 91 /+ Q_SIGNALS +/public: 92 @QSignal final void commitData(QWidget editor); 93 @QSignal final void closeEditor(QWidget editor, EndEditHint hint = EndEditHint.NoHint); 94 @QSignal final void sizeHintChanged(ref const(QModelIndex) ); 95 96 protected: 97 mixin(changeItaniumMangling(q{mangleConstructorBaseObject}, q{ 98 this(ref QObjectPrivate , QObject parent = null); 99 })); 100 private: 101 /+ Q_DECLARE_PRIVATE(QAbstractItemDelegate) +/ 102 /+ Q_DISABLE_COPY(QAbstractItemDelegate) +/ 103 /+ Q_PRIVATE_SLOT(d_func(), void _q_commitDataAndCloseEditor(QWidget*)) +/ 104 mixin(CREATE_CONVENIENCE_WRAPPERS); 105 } 106