* Changes to fix DCO Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com> * Moved the keyEvent to a helper function for ease of testing Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com> * Split definition and declaration of WidgetHandleKeyPressEvent Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5fd68cf1c2
commit
3ae6b601a2
@@ -112,6 +112,31 @@ void EditorPreferencesDialog::showEvent(QShowEvent* event)
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event)
|
||||
{
|
||||
// If the enter key is pressed during any text input, the dialog box will close
|
||||
// making it inconvenient to do multiple edits. This routine captures the
|
||||
// Key_Enter or Key_Return and clears the focus to give a visible cue that
|
||||
// editing of that field has finished and then doesn't propogate it.
|
||||
if (event->key() != Qt::Key::Key_Enter && event->key() != Qt::Key::Key_Return)
|
||||
{
|
||||
QApplication::sendEvent(widget, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (QWidget* editWidget = QApplication::focusWidget())
|
||||
{
|
||||
editWidget->clearFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EditorPreferencesDialog::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
WidgetHandleKeyPressEvent(this, event);
|
||||
}
|
||||
|
||||
void EditorPreferencesDialog::OnTreeCurrentItemChanged()
|
||||
{
|
||||
QTreeWidgetItem* currentItem = ui->pageTree->currentItem();
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Ui
|
||||
|
||||
class EditorPreferencesTreeWidgetItem;
|
||||
|
||||
void WidgetHandleKeyPressEvent(QWidget* widget, QKeyEvent* event);
|
||||
|
||||
class EditorPreferencesDialog
|
||||
: public QDialog
|
||||
, public AzToolsFramework::IPropertyEditorNotify
|
||||
@@ -36,6 +38,7 @@ public:
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
private:
|
||||
void CreateImages();
|
||||
|
||||
Reference in New Issue
Block a user