Added delay button

This commit is contained in:
2026-06-18 04:07:53 +03:00
parent 70513c1136
commit 21fb4704a6
11 changed files with 268 additions and 9 deletions
+6 -1
View File
@@ -43,6 +43,7 @@ QVariant ButtonsModel::data(const QModelIndex &index, int role) const
QString id = b.value("id").toString();
QJsonObject action = b.value("action").toObject();
QJsonObject feedback = b.value("feedback").toObject();
QJsonObject trigger = b.value("trigger").toObject();
RuntimeState rt = m_runtime.value(id);
switch (role) {
@@ -67,6 +68,8 @@ QVariant ButtonsModel::data(const QModelIndex &index, int role) const
case StatusRole: return rt.status;
case StatusTextRole: return rt.text;
case BtnColorRole: return b.value("color").toString("#7b007b");
case TriggerModeRole: return trigger.value("mode").toString("hold");
case HoldMsRole: return trigger.value("holdMs").toInt(800);
}
return {};
}
@@ -86,7 +89,9 @@ QHash<int, QByteArray> ButtonsModel::roleNames() const
{FadeMsRole, "fadeMs"},
{StatusRole, "status"},
{StatusTextRole, "statusText"},
{BtnColorRole, "btnColor"}
{BtnColorRole, "btnColor"},
{TriggerModeRole, "triggerMode"},
{HoldMsRole, "holdMs"}
};
}