From 72d761ac303c97197de0ed965652859e35dc8e32 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 3 Mar 2015 13:29:10 +0100 Subject: [PATCH] Qt Designer: Suppress updating of QAction's object name when editing existing actions. Suppress the updating on clearing the text for existing actions that have non-empty names initially. Task-number: QTBUG-44778 Change-Id: Iedf59d5c8ac2ca356ed86774de677c6faf08afc7 Reviewed-by: Jarek Kobus --- src/designer/src/lib/shared/newactiondialog.cpp | 14 ++++++-------- src/designer/src/lib/shared/newactiondialog_p.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/designer/src/lib/shared/newactiondialog.cpp b/src/designer/src/lib/shared/newactiondialog.cpp index 9d418df..bc90b67 100644 --- a/src/designer/src/lib/shared/newactiondialog.cpp +++ b/src/designer/src/lib/shared/newactiondialog.cpp @@ -78,7 +78,8 @@ unsigned ActionData::compare(const ActionData &rhs) const NewActionDialog::NewActionDialog(ActionEditor *parent) : QDialog(parent, Qt::Sheet), m_ui(new Ui::NewActionDialog), - m_actionEditor(parent) + m_actionEditor(parent), + m_autoUpdateObjectName(true) { m_ui->setupUi(this); @@ -90,7 +91,6 @@ NewActionDialog::NewActionDialog(ActionEditor *parent) : setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); m_ui->editActionText->setFocus(); - m_auto_update_object_name = true; updateButtons(); QDesignerFormWindowInterface *form = parent->formWindow(); @@ -141,16 +141,14 @@ void NewActionDialog::setActionData(const ActionData &d) m_ui->keySequenceEdit->setKeySequence(d.keysequence.value()); m_ui->checkableCheckBox->setCheckState(d.checkable ? Qt::Checked : Qt::Unchecked); - m_auto_update_object_name = false; + // Suppress updating of the object name from the text for existing actions. + m_autoUpdateObjectName = d.name.isEmpty(); updateButtons(); } void NewActionDialog::on_editActionText_textEdited(const QString &text) { - if (text.isEmpty()) - m_auto_update_object_name = true; - - if (m_auto_update_object_name) + if (m_autoUpdateObjectName) m_ui->editObjectName->setText(ActionEditor::actionTextToName(text)); updateButtons(); @@ -159,7 +157,7 @@ void NewActionDialog::on_editActionText_textEdited(const QString &text) void NewActionDialog::on_editObjectName_textEdited(const QString&) { updateButtons(); - m_auto_update_object_name = false; + m_autoUpdateObjectName = false; } void NewActionDialog::slotEditToolTip() diff --git a/src/designer/src/lib/shared/newactiondialog_p.h b/src/designer/src/lib/shared/newactiondialog_p.h index 79c10e9..5281795 100644 --- a/src/designer/src/lib/shared/newactiondialog_p.h +++ b/src/designer/src/lib/shared/newactiondialog_p.h @@ -104,7 +104,7 @@ private slots: private: Ui::NewActionDialog *m_ui; ActionEditor *m_actionEditor; - bool m_auto_update_object_name; + bool m_autoUpdateObjectName; void updateButtons(); }; -- 2.7.4