Fabcoin Core  0.16.2
P2P Digital Currency
abiparamsfield.cpp
Go to the documentation of this file.
1 #include <abiparamsfield.h>
2 #include <abiparam.h>
3 #include <platformstyle.h>
4 
5 #include <QStringList>
6 
7 ABIParamsField::ABIParamsField(const PlatformStyle *platformStyle, QWidget *parent) :
8  QWidget(parent),
9  m_mainLayout(new QVBoxLayout(this))
10 {
11  m_platfromStyle = platformStyle;
12  m_mainLayout->setSpacing(10);
13  m_mainLayout->setContentsMargins(0,0,30,0);
14  this->setLayout(m_mainLayout);
15 }
16 
18 {
19  // Add function parameters
20  m_listParams.clear();
21  int paramId = 0;
22  for(std::vector<ParameterABI>::const_iterator param = function.inputs.begin(); param != function.inputs.end(); ++param)
23  {
24  ABIParam *paramFiled = new ABIParam(m_platfromStyle, paramId, *param);
25  m_listParams.append(paramFiled);
26  m_mainLayout->addWidget(paramFiled);
27 
28  paramId++;
29  }
30  m_mainLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding));
31 }
32 
33 QStringList ABIParamsField::getParamValue(int paramID)
34 {
35  // Get parameter value
36  return m_listParams[paramID]->getValue();
37 }
38 
39 QList<QStringList> ABIParamsField::getParamsValues()
40 {
41  // Get parameters values
42  QList<QStringList> resultList;
43  for(int i = 0; i < m_listParams.count(); ++i){
44  resultList.append(m_listParams[i]->getValue());
45  }
46  return resultList;
47 }
48 
50 {
51  bool isValid = true;
52  for(int i = 0; i < m_listParams.count(); ++i){
53  if(!m_listParams[i]->isValid())
54  isValid = false;
55  }
56  return isValid;
57 }
QStringList getParamValue(int paramID)
getParamValue Get the value of a specific parameter
QList< ABIParam * > m_listParams
QVBoxLayout * m_mainLayout
QList< QStringList > getParamsValues()
getParamsValues Get the values of the whole list of input parameters
The ABIParam class ABI parameter widget.
Definition: abiparam.h:16
const PlatformStyle * m_platfromStyle
void updateParamsField(const FunctionABI &function)
updateParamsField Populate the GUI control with function parameters
ABIParamsField(const PlatformStyle *platformStyle, QWidget *parent=0)
ABIParamsField Constructor.