A custom delegate for rendering items in views.
More...
#include <CustomItemDelegate.h>
|
| void | animationValueChanged (double value) |
| | Animates the value change for the animation. More...
|
| |
|
void | animationFinished () |
| | Slot called when the animation has finished.
|
| |
|
void | stopAnimation () |
| | Stops the currently running animation.
|
| |
| void | startAnimation (const QModelIndex &index) |
| | Starts an animation for the specified index. More...
|
| |
| bool | isAnimationRunning () const |
| | Checks if an animation is currently running. More...
|
| |
| QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Creates and returns a custom editor widget. More...
|
| |
| void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override |
| | Sets the model data based on the edited data in the editor. More...
|
| |
|
| void | fileDropped (const QString &filePath, const QPoint &iconPosition) |
| | Signal emitted when a file is dropped onto the delegate item. More...
|
| |
|
| | CustomItemDelegate (QObject *parent=nullptr, QAbstractProxyModel *fileSystemModel=nullptr) |
| | Constructs a CustomItemDelegate object. More...
|
| |
| void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Renders the item's appearance using a QPainter. More...
|
| |
| void | setSelectionModel (QItemSelectionModel *selectionModel) |
| | Installs event filters on the specified view to intercept events. More...
|
| |
| QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override |
| | Overrides the sizeHint method to set the size of the delegate items. More...
|
| |
|
|
bool | editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override |
| |
A custom delegate for rendering items in views.
The CustomItemDelegate class provides a custom delegate for rendering items in views, such as QTreeView or QListView. It extends QStyledItemDelegate and adds custom behavior like animations, context menus, and drag-and-drop handling.
◆ CustomItemDelegate()
| CustomItemDelegate::CustomItemDelegate |
( |
QObject * |
parent = nullptr, |
|
|
QAbstractProxyModel * |
fileSystemModel = nullptr |
|
) |
| |
|
explicit |
◆ animationValueChanged
| void CustomItemDelegate::animationValueChanged |
( |
double |
value | ) |
|
|
slot |
Animates the value change for the animation.
- Parameters
-
| value | The new animation value. |
◆ createEditor
| QWidget * CustomItemDelegate::createEditor |
( |
QWidget * |
parent, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
overrideslot |
Creates and returns a custom editor widget.
- Parameters
-
| parent | The parent widget of the editor. |
| option | Style options for the item. |
| index | Model index of the item being edited. |
- Returns
- A pointer to the custom editor widget.
◆ fileDropped
| void CustomItemDelegate::fileDropped |
( |
const QString & |
filePath, |
|
|
const QPoint & |
iconPosition |
|
) |
| |
|
signal |
Signal emitted when a file is dropped onto the delegate item.
- Parameters
-
| filePath | The path of the dropped file. |
| iconPosition | The position of the icon. |
◆ isAnimationRunning
| bool CustomItemDelegate::isAnimationRunning |
( |
| ) |
const |
|
slot |
Checks if an animation is currently running.
- Returns
- True if an animation is running, otherwise false.
◆ paint()
| void CustomItemDelegate::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
override |
Renders the item's appearance using a QPainter.
- Parameters
-
| painter | The QPainter object to paint with. |
| option | The style options for rendering. |
| index | The model index to be rendered. |
◆ setModelData
| void CustomItemDelegate::setModelData |
( |
QWidget * |
editor, |
|
|
QAbstractItemModel * |
model, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
overrideslot |
Sets the model data based on the edited data in the editor.
- Parameters
-
| editor | The editor widget. |
| model | The model that holds the item data. |
| index | Model index of the item being edited. |
◆ setSelectionModel()
| void CustomItemDelegate::setSelectionModel |
( |
QItemSelectionModel * |
selectionModel | ) |
|
Installs event filters on the specified view to intercept events.
- Parameters
-
| view | The view on which to install the event filters. |
Overrides the event filter to handle events for the delegate.
- Parameters
-
| object | The QObject that sent the event. |
| event | The event to be filtered. |
- Returns
- True if the event was handled, otherwise false.
Sets the selection model for the delegate.
- Parameters
-
| selectionModel | The QItemSelectionModel to use for selection. |
◆ sizeHint()
| QSize CustomItemDelegate::sizeHint |
( |
const QStyleOptionViewItem & |
option, |
|
|
const QModelIndex & |
index |
|
) |
| const |
|
inlineoverride |
Overrides the sizeHint method to set the size of the delegate items.
- Parameters
-
| option | The style options for the item. |
| index | The index of the item. |
- Returns
- The preferred size of the item.
◆ startAnimation
| void CustomItemDelegate::startAnimation |
( |
const QModelIndex & |
index | ) |
|
|
slot |
Starts an animation for the specified index.
- Parameters
-
| index | The index of the item to animate. |
The documentation for this class was generated from the following files: