ff7tk  1.0.0.16
Work with Final Fantasy 7 game data
ItemSelector.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012 - 2023 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QWidget>
7 #include <ff7tkwidgets_export.h>
8 
9 class QComboBox;
10 class QPushButton;
11 class QSpinBox;
12 
13 class FF7TKWIDGETS_EXPORT ItemSelector : public QWidget
14 {
15  Q_OBJECT
16 public:
17  explicit ItemSelector(QWidget *parent = nullptr);
18  int id();// current id
19  int combo_item_width();//width of the item box.
20  int combo_type_width();//width of the type box.
21  int qty_width();//width of qty area.
22  void setFixedHeight(int h);
23  void setFixedWidth(int w);
24  quint16 currentItem();
25 signals:
26  void itemChanged(quint16);//return selected rawitem
27 public slots:
28  void setCurrentItem(quint16 ff7item);
29  void setCurrentItem(int id, int qty);
30  void setMaximumQty(int maxQty);
31  void setEditableItemCombo(bool editable);
32  void setShowPlaceholderItems(bool showPlaceholderItems);
33 private slots:
34  void setFilter(int type);
35  void comboItem_changed(int index);
36  void sb_qty_changed(int qty);
37  void btn_remove_clicked();
38 private:
39  void init_display();
40  void init_connections();
41  void init_data();
42  int type_offset(int type);
43  QComboBox *combo_type = nullptr;
44  QComboBox *combo_item = nullptr;
45  QSpinBox *sb_qty = nullptr;
46  QPushButton *btn_remove = nullptr;
47  quint16 current_item = 0;
48  bool _showPlaceholderItems;
49 };
ItemSelector
Definition: ItemSelector.h:13