Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt6.8.2 iOS: Keyboard invisible in the background
Forum Update on Monday, May 27th 2025

Qt6.8.2 iOS: Keyboard invisible in the background

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
c++keyboardqt6.8.2ios
1 Posts 1 Posters 110 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheoSys
    wrote on 6 Feb 2025, 14:23 last edited by TheoSys 8 days from now
    #1

    I wrote a small application in C++ and compiled it now with qt 6.8.2. When I developed the app I used Qt 6.7.3. With this version everything worked as expected.
    My app displays on startup a small dialog (QDialog) with 2 input lines and an OK button. When I tap to the first input line the cursor appears but no keyboard. But when I tap on the screen where the keyboard should be, the letters appearing in the input line. How can I bring the keyboard in forground? Or should I try to bring the app into the background?

    Here is a code snipped showing how the dialog is called:

    bool THeating::login()
    {
        qDebug() << "DEBUG: THeating::login()";
    
        TLogin *login = new TLogin(mParent);
    
        if (login->exec() == QDialog::Accepted)
        {
            mUser = login->getUser();
            QString requestAuth = login->askForPermission();
    
            if (requestAuth.length() == 0)
            {
                QMessageBox::critical(mParent, "THeating", tr("Ungültiger Benutzername oder Passwort!"));
                delete login;
                return false;
            }
    
            sendRequest(requestAuth);
        }
        else
        {
            QMessageBox::critical(mParent, "THeating", tr("Sie müssen einen gültigen Benutzernamen und ein Passwort eingeben!"));
            delete login;
            return false;
        }
    
        delete login;
        return true;
    }
    

    This is the initialization of the dialog:

    TLogin::TLogin(QWidget *parent)
        : QDialog(parent),
          ui(new Ui::TLogin)
    {
        qDebug() << "DEBUG: TLogin::TLogin(QWidget *parent)";
    
        ui->setupUi(this);
    #if defined(__EMSCRIPTEN__) || defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
        // We'll center the login dialog box
        QSize psize;
        QScreen *screen = parent->screen();
    
        if (screen)
            psize = screen->size();
        else
            psize = parent->size();
    
        QRect lsize = geometry();
        int left = (psize.width() - lsize.width()) / 2;
        int top = (psize.height() - lsize.height()) / 2;
        setGeometry(left, top, lsize.width(), lsize.height());
        ui->lineEditUser->setFocusPolicy(Qt::StrongFocus);
        ui->lineEditPassword->setFocusPolicy(Qt::StrongFocus);
        ui->lineEditUser->setFocus(Qt::ActiveWindowFocusReason);
    #endif
    }
    

    The 3 lines

    ui->lineEditUser->setFocusPolicy(Qt::StrongFocus);
    ui->lineEditPassword->setFocusPolicy(Qt::StrongFocus);
    ui->lineEditUser->setFocus(Qt::ActiveWindowFocusReason);
    

    don't change anything. Without them the behavior is the same.

    Here is a screenshot of my app. You can see the frame around the top input line showing it has the focus.
    On an emulator for iOS I can use the keyboard of my Mac to enter something. This works. But on a real device I have no visible keyboard.
    7ae6f4d3-5499-4d2f-aea3-17ac517c1240-grafik.png

    1 Reply Last reply
    0

    1/1

    6 Feb 2025, 14:23

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved