Focus name edit for new items

This commit is contained in:
WarmUpTill 2026-02-10 20:21:03 +01:00 committed by WarmUpTill
parent eb5046a9d6
commit 87c45e2b32
2 changed files with 11 additions and 1 deletions

View File

@ -4,9 +4,11 @@
#include "ui-helpers.hpp"
#include <algorithm>
#include <QAction>
#include <QMenu>
#include <QLayout>
#include <QMenu>
#include <QTimer>
Q_DECLARE_METATYPE(advss::Item *);
@ -330,6 +332,13 @@ void ItemSettingsDialog::NameChanged(const QString &text)
SetNameWarning("");
}
void ItemSettingsDialog::showEvent(QShowEvent *)
{
if (_showNameEmptyWarning && _name->text().isEmpty()) {
_name->setFocus(Qt::OtherFocusReason);
}
}
void ItemSettingsDialog::SetNameWarning(const QString warn)
{
if (warn.isEmpty()) {

View File

@ -52,6 +52,7 @@ private slots:
void NameChanged(const QString &);
protected:
virtual void showEvent(QShowEvent *) override;
void SetNameWarning(const QString);
QLineEdit *_name;