gui: keyaction, kbbind - Resolve macro content retrieval in KbBind::update()

This makes it easier to append the repetition delay.
This commit is contained in:
Karl Fleischmann
2026-05-25 21:58:11 +03:00
committed by Tasos Sahanidis
parent de6b946ab2
commit 367f57963f
2 changed files with 8 additions and 7 deletions
+8 -2
View File
@@ -239,8 +239,14 @@ void KbBind::update(QFile& cmd, int notify, bool force){
cmd.write(keyLatin1);
// if a macro definiton for the key is given,
// add the converted string to key-buffer "macro"
if (act->isMacro() && act->macroContent().length() > 0) {
macros.append("macro " + keyLatin1 + ":" + act->macroContent().toLatin1() + "\n");
if (act->isMacro()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<QStringView> macroContent = QStringView(act->value()).split(':');
#else // QT_VERSION < 6.0.0
QVector<QStringRef> macroContent = act->value().splitRef(':');
#endif
if (macroContent[1].length() > 0)
macros.append("macro " + keyLatin1 + ":" + macroContent[1].toLatin1() + "\n");
}
} else {
// Otherwise, write the binding
-5
View File
@@ -31,11 +31,6 @@ public:
// Name to send to driver (empty string for unbind)
QString driverName() const;
// Returns the string that's passed to the daemon
inline QString macroContent() const {
return _value.split(":")[1];
}
// Mode-switch action.
// 0 for first mode, 1 for second, etc. Constants below for movement options
const static int MODE_PREV = -2, MODE_NEXT = -1;