diff options
author | Henning Gruendl <henning.gruendl@qt.io> | 2023-11-24 16:48:50 +0100 |
---|---|---|
committer | Henning Gründl <henning.gruendl@qt.io> | 2023-11-24 16:14:12 +0000 |
commit | d0fccdc02590af3429cebaae4edb5fc9bc6221ff (patch) | |
tree | 4cd605540ffc1089bb1a68d27c178eee46ed7582 | |
parent | fceb1a2e6323abca50eb6f4fe98edb9e6f2ee093 (diff) |
QmlDesigner: Fix signal name prefix removal
Only remove the first to characters of a signal name, if it matches
the regular expression.
Task-number: QDS-11385
Change-Id: Icc61f2c5281c15842729f67d3b0498c80637ceb1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
-rw-r--r-- | src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index dd6350f4e5..88cdc8e52a 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -25,6 +25,7 @@ #include <utils/qtcassert.h> #include <QMessageBox> +#include <QRegularExpression> #include <QStandardItemModel> #include <QTableView> #include <QTextCursor> @@ -859,6 +860,11 @@ QString removeOnFromSignalName(const QString &signal) { if (signal.isEmpty()) return {}; + + static const QRegularExpression rx("^on[A-Z]"); + if (!rx.match(signal).hasMatch()) + return signal; + QString ret = signal; ret.remove(0, 2); ret[0] = ret.at(0).toLower(); |