aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/common/structure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scxmleditor/common/structure.cpp')
-rw-r--r--src/plugins/scxmleditor/common/structure.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/scxmleditor/common/structure.cpp b/src/plugins/scxmleditor/common/structure.cpp
index be49e9711d..742a822c07 100644
--- a/src/plugins/scxmleditor/common/structure.cpp
+++ b/src/plugins/scxmleditor/common/structure.cpp
@@ -41,8 +41,7 @@
#include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
-#include <QRegExp>
-#include <QRegExpValidator>
+#include <QRegularExpressionValidator>
#include <QToolBar>
#include <QToolButton>
#include <QUndoStack>
@@ -63,9 +62,9 @@ QWidget *TreeItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
if (index.isValid()) {
auto edit = new QLineEdit(parent);
edit->setFocusPolicy(Qt::StrongFocus);
- QRegExp rx("^(?!xml)[_a-z][a-z0-9-._]*$");
- rx.setCaseSensitivity(Qt::CaseInsensitive);
- edit->setValidator(new QRegExpValidator(rx, parent));
+ QRegularExpression rx("^(?!xml)[_a-z][a-z0-9-._]*$");
+ rx.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
+ edit->setValidator(new QRegularExpressionValidator(rx, parent));
return edit;
}
return QStyledItemDelegate::createEditor(parent, option, index);
@@ -239,7 +238,7 @@ void Structure::childAdded(const QModelIndex &childIndex)
void Structure::keyPressEvent(QKeyEvent *e)
{
- if (e->key() == Qt::Key_Delete) {
+ if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) {
QModelIndex ind = m_proxyModel->mapToSource(m_structureView->currentIndex());
auto tag = static_cast<ScxmlTag*>(ind.internalPointer());
if (tag && m_currentDocument) {