mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 01:56:39 +02:00
getting textfield into focus
This commit is contained in:
parent
1375e85f2c
commit
a24cd41367
7 changed files with 27 additions and 18 deletions
|
@ -166,7 +166,6 @@ Item {
|
|||
topMargin: loginErrorMessage.height
|
||||
}
|
||||
placeholderText: "Username or Email"
|
||||
focus: true
|
||||
activeFocusOnPress: true
|
||||
Keys.onPressed: {
|
||||
switch (event.key) {
|
||||
|
@ -489,8 +488,13 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
onFocusChanged: {
|
||||
emailField.focus = focus;
|
||||
Connections {
|
||||
target: loginDialog
|
||||
onFocusEnabled: {
|
||||
Qt.callLater(function() {
|
||||
emailField.forceActiveFocus();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
|
|
|
@ -5849,6 +5849,9 @@ void Application::setKeyboardFocusOverlay(const OverlayID& overlayID) {
|
|||
_keyboardFocusHighlight->setVisible(false);
|
||||
}
|
||||
}
|
||||
if (overlayID == _loginDialogOverlayID) {
|
||||
emit loginDialogFocusEnabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8178,9 +8181,9 @@ void Application::loadDomainConnectionDialog() {
|
|||
}
|
||||
|
||||
void Application::toggleLogDialog() {
|
||||
//if (getLoginDialogPoppedUp()) {
|
||||
// return;
|
||||
//}
|
||||
if (getLoginDialogPoppedUp()) {
|
||||
return;
|
||||
}
|
||||
if (! _logDialog) {
|
||||
_logDialog = new LogDialog(nullptr, getLogger());
|
||||
}
|
||||
|
@ -8749,8 +8752,7 @@ void Application::createLoginDialogOverlay() {
|
|||
overlays.editOverlay(keyboard->getAnchorID(), properties);
|
||||
keyboard->setResetKeyboardPositionOnRaise(false);
|
||||
}
|
||||
auto loginDialogOverlay = std::dynamic_pointer_cast<Web3DOverlay>(getOverlays().getOverlay(_loginDialogOverlayID));
|
||||
loginDialogOverlay->setActiveFocus(true);
|
||||
setKeyboardFocusOverlay(_loginDialogOverlayID);
|
||||
getApplicationCompositor().getReticleInterface()->setAllowMouseCapture(false);
|
||||
getApplicationCompositor().getReticleInterface()->setVisible(false);
|
||||
if (!_loginStateManager.isSetUp()) {
|
||||
|
|
|
@ -344,6 +344,8 @@ signals:
|
|||
|
||||
void interstitialModeChanged(bool isInInterstitialMode);
|
||||
|
||||
void loginDialogFocusEnabled();
|
||||
|
||||
void miniTabletEnabledChanged(bool enabled);
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -42,8 +42,9 @@ LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
|
|||
this, &LoginDialog::handleLoginCompleted);
|
||||
connect(accountManager.data(), &AccountManager::loginFailed,
|
||||
this, &LoginDialog::handleLoginFailed);
|
||||
#endif
|
||||
connect(qApp, SIGNAL(loginDialogFocusEnabled()), this, SLOT(onFocusEnabled()));
|
||||
connect(this, SIGNAL(dismissedLoginDialog()), qApp, SLOT(onDismissedLoginDialog()));
|
||||
#endif
|
||||
}
|
||||
|
||||
LoginDialog::~LoginDialog() {
|
||||
|
@ -307,3 +308,8 @@ void LoginDialog::signupFailed(QNetworkReply* reply) {
|
|||
emit handleSignupFailed(DEFAULT_SIGN_UP_FAILURE_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginDialog::onFocusEnabled() {
|
||||
forceActiveFocus();
|
||||
emit focusEnabled();
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ signals:
|
|||
// occurs upon dismissing the encouraging log in.
|
||||
void dismissedLoginDialog();
|
||||
|
||||
void focusEnabled();
|
||||
|
||||
public slots:
|
||||
void linkCompleted(QNetworkReply* reply);
|
||||
void linkFailed(QNetworkReply* reply);
|
||||
|
@ -58,6 +60,8 @@ public slots:
|
|||
void signupCompleted(QNetworkReply* reply);
|
||||
void signupFailed(QNetworkReply* reply);
|
||||
|
||||
void onFocusEnabled();
|
||||
|
||||
protected slots:
|
||||
Q_INVOKABLE void dismissLoginDialog();
|
||||
|
||||
|
|
|
@ -473,14 +473,6 @@ void Web3DOverlay::handlePointerEventAsMouse(const PointerEvent& event) {
|
|||
QCoreApplication::sendEvent(_webSurface->getWindow(), &mouseEvent);
|
||||
}
|
||||
|
||||
void Web3DOverlay::setActiveFocus(bool focus) {
|
||||
if (_webSurface && focus) {
|
||||
if (focus) {
|
||||
_webSurface->getRootItem()->forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Web3DOverlay::setProperties(const QVariantMap& properties) {
|
||||
Billboard3DOverlay::setProperties(properties);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
Q_INVOKABLE void handlePointerEvent(const PointerEvent& event);
|
||||
void handlePointerEventAsTouch(const PointerEvent& event);
|
||||
void handlePointerEventAsMouse(const PointerEvent& event);
|
||||
void setActiveFocus(bool focus);
|
||||
|
||||
// setters
|
||||
void setURL(const QString& url);
|
||||
|
|
Loading…
Reference in a new issue