VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bdiQPropTreeItemCombo.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include "bdiQPropTreeItem.h"
13 
14 #include <QFocusEvent>
15 #include <QPointer>
16 #include <QList>
17 namespace makVrv
18 {
19 
21  struct EnumKey
22  {
23  EnumKey(QString key, int val) : m_key(key), m_value(val) {}
24  EnumKey(QString key) : m_key(key), m_value(-1) {}
25  EnumKey() : m_key(QString::null), m_value(-1) {}
26 
27  bool operator == (const EnumKey& item) const
28  {
29  return (m_key == item.m_key && m_value == item.m_value);
30  }
31 
32  QString m_key;
33  int m_value;
34 
35  };
36 
37  class bdiQComboBox;
38 
39 
42  {
43  Q_OBJECT;
44 
45  public:
46 
47 
48  // Construction
52 
53  virtual void showEditor();
54  virtual void hideEditor();
55  virtual bool hasCustomWidget(void);
56  virtual void focusOutEvent(QFocusEvent* e);
57 
58  public:
59 
60  // Retrieve the item's attribute value
61  virtual int getItemValue() const;
62 
63  // Called when the item needs to refresh its data
64  virtual void onRefresh();
65 
66  // Called when the item needs to commit its changes
67  virtual void onCommit();
68 
69  virtual QWidget* getWidget() { return (QWidget*)combo(); }
70 
71  virtual bool isBold() { return 1; }
72  virtual void clearList();
73  int getSelectedValue();
74  const char* getSelectedName();
75 
76  void addExpandOnValue(int value);
77  void addContractOnValue(int value);
78  void setSelectedItem(int value) { m_combo_selection_index = value; }
79  const char* getSelectedText();
80 
81  void doCommitHelper(int do_commit);
82 
83  protected:
84 
85  bdiQComboBox* combo();
86 
87 
88  signals:
89 
90  void currentIndexChanged(int);
91 
92  protected:
93  QPointer<bdiQComboBox> m_combo;
94  QVector <EnumKey> m_value_list;
95  QStringList m_combo_items;
96 
97  QVector <int> m_expand_on_list;
98  QVector <int> m_contract_on_list;
99 
101 
102 
103  };
104 
105 
108  {
109  Q_OBJECT;
110 
111  public:
112 
113  // Construction
114  bdiQPropTreeItemCombo(QTreeWidget* tree_widget);
116 
117  public:
118 
119 
120  // Set the item's attribute value
121  virtual void setItemValue(void* lParam, int do_commit = 1);
122 
123  bool addKeyValuePair(const QString& s, int value);
124  bool addKeyList(const QStringList& s);
125 
126  // note adding None will be considered a special case and the code will attempt
127  //to intercept zero length look up strings for it.
128  bool addKeyValue(const QString& s);
129 
130  void setDataPtr(void* lParam, int do_commit = 1);
131  //void setSecondaryDataPtr(void* lParam);
132 
133  protected:
134 
135  protected slots:
136 
137  virtual void setValue(int data);
138 
139  signals:
140 
141  void currentIndexChanged(int);
142 
143  protected:
144 
145  int findCBData(void* lParam);
146 
147  protected:
148 
149  void* m_pIndex;
150  //void* m_pIndex2;
152  };
153 
156  {
157  Q_OBJECT;
158 
159  public:
160 
161  // Construction
162  bdiQPropTreeItemComboBool(QTreeWidget* tree_widget, bool autopopulate = true, bool expande_on_true = false);
163  bdiQPropTreeItemComboBool(QTreeWidgetItem* parent, bool autopopulate = true, bool expande_on_true = false);
164 
165  public:
166 
167  // Set the item's attribute value
168  virtual void setItemValue(bool lParam, int do_commit = 1);
169 
170  // Create combo box with TRUE/FALSE selections
171  bool createComboBoxBool(bool expand_on_true = false);
172 
173  void setDataPtr(int* lParam, int do_commit = 1);
174  void setDataPtr(bool* lParam, int do_commit = 1);
175 
176 
177  protected:
178 
179  bdiQComboBox* combo();
180 
181  protected slots:
182 
183  virtual void setValue(int data);
184 
185  signals:
186 
187  void currentIndexChanged(int);
188 
189  protected:
190 
193  };
194 
195 }
virtual bool isBold()
Definition: bdiQPropTreeItemCombo.h:71
QVector< EnumKey > m_value_list
Definition: bdiQPropTreeItemCombo.h:94
bool operator==(const EnumKey &item) const
Definition: bdiQPropTreeItemCombo.h:27
Definition: bdiQPropTreeItemCombo.h:107
bdiQPropTreeItemComboBool(QTreeWidget *tree_widget, bool autopopulate=true, bool expande_on_true=false)
virtual void setItemValue(bool lParam, int do_commit=1)
bool addKeyValuePair(const QString &s, int value)
void setDataPtr(int *lParam, int do_commit=1)
virtual void setValue(int data)
virtual void setItemValue(void *lParam, int do_commit=1)
int findCBData(void *lParam)
int m_combo_selection_index
Definition: bdiQPropTreeItemCombo.h:100
Definition: bdiQPropTreeItemCombo.h:21
virtual bool hasCustomWidget(void)
QPointer< bdiQComboBox > m_combo
Definition: bdiQPropTreeItemCombo.h:93
bdiQPropTreeItemComboBase(QTreeWidget *tree_widget)
EnumKey()
Definition: bdiQPropTreeItemCombo.h:25
virtual void focusOutEvent(QFocusEvent *e)
bool * m_pBoolIndex
Definition: bdiQPropTreeItemCombo.h:191
EnumKey(QString key)
Definition: bdiQPropTreeItemCombo.h:24
EnumKey(QString key, int val)
Definition: bdiQPropTreeItemCombo.h:23
void setDataPtr(void *lParam, int do_commit=1)
Definition: bdiQPropTreeItem.h:33
bdiQPropTreeItemCombo(QTreeWidget *tree_widget)
virtual int getItemValue() const
int m_value
Definition: bdiQPropTreeItemCombo.h:33
int * m_pIntIndex
Definition: bdiQPropTreeItemCombo.h:192
QStringList m_combo_items
Definition: bdiQPropTreeItemCombo.h:95
bool addKeyList(const QStringList &s)
bool createComboBoxBool(bool expand_on_true=false)
QString m_key
Definition: bdiQPropTreeItemCombo.h:32
bool addKeyValue(const QString &s)
virtual void setValue(int data)
Definition: bdiQPropTreeItemCombo.h:41
void setSelectedItem(int value)
Definition: bdiQPropTreeItemCombo.h:78
Definition: bdiQPropTreeItemCombo.h:155
void * m_pIndex
Definition: bdiQPropTreeItemCombo.h:149
QVector< int > m_expand_on_list
Definition: bdiQPropTreeItemCombo.h:97
Contains bdiQPropTreeItem class.
virtual QWidget * getWidget()
Definition: bdiQPropTreeItemCombo.h:69
void doCommitHelper(int do_commit)
int m_use_key_as_value
Definition: bdiQPropTreeItemCombo.h:151
QVector< int > m_contract_on_list
Definition: bdiQPropTreeItemCombo.h:98

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)