forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Henning Gründl
parent
fceb1a2e63
commit
d0fccdc025
@@ -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();
|
||||
|
Reference in New Issue
Block a user