VR-Forces 4.8 Class Documentation
 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) 2019 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 
41  {
42  Q_OBJECT;
43  public:
44 
45  // Construction
46  bdiQPropTreeItemCombo(QTreeWidget* tree_widget);
48  virtual ~bdiQPropTreeItemCombo();
49 
50  virtual void showEditor();
51  virtual void hideEditor();
52  virtual bool hasCustomWidget(void);
53  virtual void focusOutEvent(QFocusEvent* e);
54 
55  public:
56 
57  // Retrieve the item's attribute value
58  virtual void* getItemValue();
59 
60  // Set the item's attribute value
61  virtual void setItemValue(void* lParam, int do_commit = 1);
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  // Create combo box with TRUE/FALSE selections
70  bool createComboBoxBool(bool expand_on_true = false);
71 
72  bool addKeyValuePair(const QString& s, int value);
73  bool addKeyList(const QStringList& s);
74 
75  // note adding None will be considered a special case and the code will attempt
76  //to intercept zero length look up strings for it.
77  bool addKeyValue(const QString& s);
78 
79  // use the qstrings directly. Up to parent to update data
80  void setUseKeyAsValue(int val) { m_use_key_as_value = val; }
81 
82  void setDataPtr(void* lParam, int do_commit = 1);
83  void setSecondaryDataPtr(void* lParam);
84  virtual QWidget* getWidget() { return (QWidget*)combo(); }
85 
86  virtual bool isBold() { return 1; }
87  virtual void clearList();
88  const char* getSelectedName();
89  int getSelectedValue();
90  QStringList m_combo_items;
91 
92  void addExpandOnValue(int value);
93  void addContractOnValue(int value);
94  void setSelectedItem(int value) { m_combo_selection_index = value; }
95  protected:
96 
97  bdiQComboBox* combo();
98  QPointer<bdiQComboBox> m_combo;
99  QVector <EnumKey> m_value_list;
100  QVector <int> m_expand_on_list;
101  QVector <int> m_contract_on_list;
102 
103  protected slots:
104 
105  void setValue(int data);
106 
107  signals:
108 
109  void currentIndexChanged(int);
110 
111  protected:
112 
113  int findCBData(void* lParam);
114 
115  protected:
116 
118  void* m_pIndex;
119  void* m_pIndex2;
121 
122  };
123 }
bool createComboBoxBool(bool expand_on_true=false)
bool operator==(const EnumKey &item) const
Definition: bdiQPropTreeItemCombo.h:27
Definition: bdiQPropTreeItemCombo.h:40
bool addKeyValuePair(const QString &s, int value)
virtual void setItemValue(void *lParam, int do_commit=1)
virtual void focusOutEvent(QFocusEvent *e)
QVector< EnumKey > m_value_list
Definition: bdiQPropTreeItemCombo.h:99
int findCBData(void *lParam)
Definition: bdiQPropTreeItemCombo.h:21
QStringList m_combo_items
Definition: bdiQPropTreeItemCombo.h:90
EnumKey()
Definition: bdiQPropTreeItemCombo.h:25
void setSecondaryDataPtr(void *lParam)
virtual void * getItemValue()
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:28
bdiQPropTreeItemCombo(QTreeWidget *tree_widget)
int m_value
Definition: bdiQPropTreeItemCombo.h:33
bool addKeyList(const QStringList &s)
QString m_key
Definition: bdiQPropTreeItemCombo.h:32
bool addKeyValue(const QString &s)
virtual bool isBold()
Definition: bdiQPropTreeItemCombo.h:86
void addContractOnValue(int value)
void * m_pIndex
Definition: bdiQPropTreeItemCombo.h:118
void setUseKeyAsValue(int val)
Definition: bdiQPropTreeItemCombo.h:80
QVector< int > m_expand_on_list
Definition: bdiQPropTreeItemCombo.h:100
void * m_pIndex2
Definition: bdiQPropTreeItemCombo.h:119
QVector< int > m_contract_on_list
Definition: bdiQPropTreeItemCombo.h:101
void setSelectedItem(int value)
Definition: bdiQPropTreeItemCombo.h:94
int m_combo_selection_index
Definition: bdiQPropTreeItemCombo.h:117
Contains bdiQPropTreeItem class.
QPointer< bdiQComboBox > m_combo
Definition: bdiQPropTreeItemCombo.h:98
void addExpandOnValue(int value)
virtual bool hasCustomWidget(void)
int m_use_key_as_value
Definition: bdiQPropTreeItemCombo.h:120
virtual QWidget * getWidget()
Definition: bdiQPropTreeItemCombo.h:84

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)