Automatically focus on input when opening a dialog

This commit is contained in:
Konstantinos Sideris 2018-01-16 22:50:47 +02:00
parent eea33062e3
commit 9de2db2fb8
6 changed files with 27 additions and 0 deletions

View File

@ -22,6 +22,7 @@ signals:
protected:
void paintEvent(QPaintEvent *event) override;
void showEvent(QShowEvent *event) override;
private:
void clearFields();

View File

@ -19,6 +19,7 @@ public:
protected:
void paintEvent(QPaintEvent *event) override;
void showEvent(QShowEvent *event) override;
signals:
void closing(bool isLeaving, QStringList invitees);

View File

@ -18,6 +18,7 @@ signals:
protected:
void paintEvent(QPaintEvent *event) override;
void showEvent(QShowEvent *event) override;
private:
FlatButton *confirmBtn_;

View File

@ -152,3 +152,11 @@ CreateRoom::paintEvent(QPaintEvent *)
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void
CreateRoom::showEvent(QShowEvent *event)
{
nameInput_->setFocus();
QFrame::showEvent(event);
}

View File

@ -147,3 +147,11 @@ InviteUsers::invitedUsers() const
return users;
}
void
InviteUsers::showEvent(QShowEvent *event)
{
inviteeInput_->setFocus();
QFrame::showEvent(event);
}

View File

@ -59,3 +59,11 @@ JoinRoom::paintEvent(QPaintEvent *)
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void
JoinRoom::showEvent(QShowEvent *event)
{
roomInput_->setFocus();
QFrame::showEvent(event);
}