8 #include <QStringListModel> 15 m_func(new QWidget(this)),
16 m_comboBoxFunc(new QComboBox(this)),
17 m_paramsField(new QStackedWidget(this)),
23 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
24 mainLayout->setSpacing(10);
25 mainLayout->setContentsMargins(0, 0, 0, 0);
27 QHBoxLayout *topLayout =
new QHBoxLayout(
m_func);
28 topLayout->setSpacing(10);
29 topLayout->setContentsMargins(0, 0, 0, 0);
36 topLayout->addSpacerItem(
new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));
38 m_func->setLayout(topLayout);
39 mainLayout->addWidget(
m_func);
41 mainLayout->addSpacerItem(
new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding));
57 QStringList functionList;
58 QStringListModel *functionModel =
new QStringListModel(
this);
62 bool bFieldFunc = bFieldCall || bFieldSendTo;
63 for (
int func = 0; func < (int)functions.size(); ++func)
66 bool bTypeConstructor =
function.
type ==
"constructor";
67 bool bTypeEvent =
function.type ==
"event";
68 bool bTypeDefault =
function.type ==
"default";
69 bool bIsConstant =
function.constant;
70 if((bFieldCreate && !bTypeConstructor) ||
71 (bFieldFunc && bTypeConstructor) ||
72 (bFieldFunc && bTypeEvent) ||
73 (bFieldCall && !bIsConstant && !bTypeDefault) ||
74 (bFieldSendTo && bIsConstant && !bTypeDefault))
83 QString funcName = QString::fromStdString(
function.
name);
84 QString funcSelector = QString::fromStdString(
function.selector());
85 functionList.append(QString(funcName +
"(" + funcSelector +
")"));
89 functionModel->setStringList(functionList);
95 m_func->setVisible(visible);
109 widget->deleteLater();
118 style()->drawPrimitive(QStyle::PE_Widget, &opt, &p,
this);
130 return QStringList();
138 return QList<QStringList>();
146 std::vector<std::vector<std::string>> result;
147 for (
int i=0; i<qlist.size(); i++)
149 std::vector<std::string> itemParam;
150 QStringList qlistVlaues = qlist[i];
151 for(
int j=0; j<qlistVlaues.size(); j++)
153 itemParam.push_back(qlistVlaues.at(j).toUtf8().data());
155 result.push_back(itemParam);
164 if(currentFunc == -1)
182 QSizePolicy::Policy policy = QSizePolicy::Ignored;
184 policy = QSizePolicy::Expanding;
187 pPage->setSizePolicy(policy, policy);
const PlatformStyle * m_platformStyle
QStringList getParamValue(int paramID)
getParamValue Get the value of the parameter with the id from the currently selected function ...
ABIFunctionField(const PlatformStyle *platformStyle, FunctionType type, QWidget *parent=0)
ABIFunctionField Constructor.
QStackedWidget * m_paramsField
ContractABI * m_contractABI
QVector< int > m_abiFunctionList
std::vector< FunctionABI > functions
std::vector< std::vector< std::string > > getValuesVector()
getValuesVector Get params values vector List of all parameters that can be sent to a function...
void setContractABI(ContractABI *contractABI)
setContractABI Set the contract ABI (list of functions from the contract)
QComboBox * m_comboBoxFunc
FunctionType
The FunctionType enum Function type to display.
FunctionType m_functionType
void on_currentIndexChanged()
int getSelectedFunction() const
getSelectedFunction Get the ABI for the selected function from the contract
void updateABIFunctionField()
updateABIFunctionField Populate the GUI control with functions
The ABIParamsField class List of parameters for contract function.
PlatformStyle::TableColorType type
QList< QStringList > getParamsValues()
getParamsValues Get the values of the whole list of input parameters for the selected function ...
void updateParamsField(const FunctionABI &function)
updateParamsField Populate the GUI control with function parameters
void clear()
clear Clear the GUI control
void paintEvent(QPaintEvent *)