ff7tk  1.2.0.13
Work with Final Fantasy 7 game data
ItemSelectionDelegate.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2022 - 2023 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QStyledItemDelegate>
7 #include <ff7tkwidgets_export.h>
8 
9 class FF7TKWIDGETS_EXPORT ItemSelectionDelegate : public QStyledItemDelegate
10 {
11  Q_OBJECT
12 public:
13  ItemSelectionDelegate(QObject * parent = nullptr);
14  QWidget *createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index = QModelIndex()) const override;
15  void setEditorData(QWidget *editor, const QModelIndex &index) const override;
16  void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
17  void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
18  void setMaximumQty(int maxQty);
19  void setEditableItemCombo(bool editable);
20  void setShowPlaceholderItems(bool showPlaceholderItems);
21 protected:
22  QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
23 signals:
24  void commitData(QWidget *editor) const;
25 private:
26  int m_maxQty = 127;
27  bool m_editableItemCombo = false;
28  bool m_showPlaceholderItems = false;
29 };
30 
ItemSelectionDelegate
Definition: ItemSelectionDelegate.h:9