fix notifications view

pull/1/head
Michael Zanetti 2017-11-26 17:17:16 +01:00
parent 2fafd06038
commit 6b2c5afb27
3 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,7 @@ CustomViewBase {
ColumnLayout {
id: grid
anchors { left: parent.left; top: parent.top; right: parent.right }
anchors { left: parent.left; top: parent.top; right: parent.right; margins: app.margins }
Label {
Layout.fillWidth: true
text: "Send a notification now:"
@ -26,7 +26,8 @@ CustomViewBase {
var params = []
var param1 = {}
var paramTypeId = root.deviceClass.actionTypes.findByName("notify").paramTypes.getParamType("title").id
print("bla:", root.deviceClass.actionTypes.findByName("notify").paramTypes)
var paramTypeId = root.deviceClass.actionTypes.findByName("notify").paramTypes.findByName("title").id
param1.paramTypeId = paramTypeId
param1.value = textArea.text
params.push(param1)

View File

@ -47,6 +47,16 @@ ParamType *ParamTypes::getParamType(const QString &id) const
return 0;
}
ParamType *ParamTypes::findByName(const QString &name) const
{
foreach (ParamType *paramType, m_paramTypes) {
if (paramType->name() == name) {
return paramType;
}
}
return 0;
}
int ParamTypes::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)

View File

@ -50,6 +50,7 @@ public:
Q_INVOKABLE ParamType *get(int index) const;
Q_INVOKABLE ParamType *getParamType(const QString &id) const;
Q_INVOKABLE ParamType *findByName(const QString &name) const;
int rowCount(const QModelIndex & parent = QModelIndex()) const;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;