From 29b0367dfb58cab4fb0c40d6b0c3c035f10b75ae Mon Sep 17 00:00:00 2001 From: Zithia Satazaki Date: Tue, 29 Mar 2022 14:54:41 -0400 Subject: [PATCH] value negation --- notes | 3 ++- xybrid/ui/patterneditoritemdelegate.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/notes b/notes index 195fb61..864fe1a 100644 --- a/notes +++ b/notes @@ -44,7 +44,8 @@ TODO { - make space preview on port column - fix strut not working except to overwrite another param - add negate function to param columns + - add negate function to param columns + multi select negate revert-to-saved menu action diff --git a/xybrid/ui/patterneditoritemdelegate.cpp b/xybrid/ui/patterneditoritemdelegate.cpp index 4a4a3a2..ab12269 100644 --- a/xybrid/ui/patterneditoritemdelegate.cpp +++ b/xybrid/ui/patterneditoritemdelegate.cpp @@ -323,6 +323,10 @@ bool PatternEditorItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *m view->setCurrentIndex(index.siblingAtColumn(index.column()+1)); return dc->commit(); } else { + if (k == Qt::Key_Minus) { // negate current value + row.param(par)[1] *= -1; + return dc->commit(); + } if (k == Qt::Key_Comma) { // convenience; allow inserting an extend from number column if (row.numParams() >= PatternEditorModel::paramSoftCap) return dc->cancel(); row.insertParam(par+1, ',');