[LYN-4938] Prism: Paths in Engine settings page do not use consistent slashes (#1721)

* Corrected focus for form line edit widgets.
* Consistent slash usage for folder browse edit widgets.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
main
Benjamin Jillich 5 years ago committed by GitHub
parent f492949626
commit ea42ef78b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,4 +21,9 @@ namespace O3DE::ProjectManager
connect(browseButton, &QPushButton::pressed, this, &FormBrowseEditWidget::HandleBrowseButton);
m_frameLayout->addWidget(browseButton);
}
FormBrowseEditWidget::FormBrowseEditWidget(const QString& labelText, QWidget* parent)
: FormBrowseEditWidget(labelText, "", parent)
{
}
} // namespace O3DE::ProjectManager

@ -20,6 +20,7 @@ namespace O3DE::ProjectManager
public:
explicit FormBrowseEditWidget(const QString& labelText, const QString& valueText = "", QWidget* parent = nullptr);
explicit FormBrowseEditWidget(const QString& labelText = "", QWidget* parent = nullptr);
~FormBrowseEditWidget() = default;
protected slots:

@ -15,8 +15,9 @@
namespace O3DE::ProjectManager
{
FormFolderBrowseEditWidget::FormFolderBrowseEditWidget(const QString& labelText, const QString& valueText, QWidget* parent)
: FormBrowseEditWidget(labelText, valueText, parent)
: FormBrowseEditWidget(labelText, parent)
{
setText(valueText);
}
void FormFolderBrowseEditWidget::HandleBrowseButton()
@ -30,8 +31,14 @@ namespace O3DE::ProjectManager
QString directory = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(this, tr("Browse"), defaultPath));
if (!directory.isEmpty())
{
m_lineEdit->setText(directory);
setText(directory);
}
}
void FormFolderBrowseEditWidget::setText(const QString& text)
{
QString path = QDir::toNativeSeparators(text);
FormBrowseEditWidget::setText(path);
}
} // namespace O3DE::ProjectManager

@ -22,6 +22,8 @@ namespace O3DE::ProjectManager
explicit FormFolderBrowseEditWidget(const QString& labelText, const QString& valueText = "", QWidget* parent = nullptr);
~FormFolderBrowseEditWidget() = default;
void setText(const QString& text) override;
protected:
void HandleBrowseButton() override;
};

@ -123,4 +123,14 @@ namespace O3DE::ProjectManager
child->style()->polish(child);
}
}
void FormLineEditWidget::setText(const QString& text)
{
m_lineEdit->setText(text);
}
void FormLineEditWidget::mousePressEvent([[maybe_unused]] QMouseEvent* event)
{
m_lineEdit->setFocus();
}
} // namespace O3DE::ProjectManager

@ -15,6 +15,7 @@ QT_FORWARD_DECLARE_CLASS(QLineEdit)
QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QFrame)
QT_FORWARD_DECLARE_CLASS(QHBoxLayout)
QT_FORWARD_DECLARE_CLASS(QMouseEvent)
namespace AzQtComponents
{
@ -39,6 +40,8 @@ namespace O3DE::ProjectManager
//! Returns a pointer to the underlying LineEdit.
QLineEdit* lineEdit() const;
virtual void setText(const QString& text);
protected:
QLabel* m_errorLabel = nullptr;
QFrame* m_frame = nullptr;
@ -51,6 +54,8 @@ namespace O3DE::ProjectManager
void onFocusOut();
private:
void mousePressEvent(QMouseEvent* event) override;
void refreshStyle();
};
} // namespace O3DE::ProjectManager

Loading…
Cancel
Save