Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-136221

[Reg 6.2.2 -> 6.9] QDialog is only responsive if resized to full screen

    XMLWordPrintable

Details

    • Android
    • 2025wk18s1QtforAndroid

    Description

      When a QDialog is opened, it's not responsive, except if you resize it to occupy full screen.

      See simple example here:

      main.cpp:

       

      #include <QApplication>
      #include "mainwindow.h"
      int main( int argc, char* argv[] )
      {
          QApplication app(argc, argv);
          MainWindow wnd; 
          wnd.show();
          return app.exec();
      }
      

      mainwindow.h:

       

      #pragma once
      #include <QMainWindow>
      class MainWindow : public QMainWindow
      {
          Q_OBJECT
      public:
          MainWindow(QWidget* parent = NULL);
      public slots:
          void showDialog();
      };
      

      mainwindow.cpp:

       

      #include "mainwindow.h"
      #include <QDialog>
      #include <QPushButton>
      #include <QVBoxLayout>
      #include <QDialogButtonBox>
      MainWindow::MainWindow( QWidget* parent ) : QMainWindow(parent)
      {
          QPushButton* centralWidget = new QPushButton("Open dialog",this);
          setCentralWidget(centralWidget);
          connect( centralWidget, &QPushButton::clicked, this, &MainWindow::showDialog );
      }
      void MainWindow::showDialog()
      {
          QDialog dlg;
          dlg.setLayout(new QVBoxLayout);
          QDialogButtonBox* box = new QDialogButtonBox(QDialogButtonBox::Ok,&dlg);
          connect( box, &QDialogButtonBox::accepted, &dlg, &QDialog::accept );
          dlg.layout()->addWidget(box);
          QRect geometry = this->geometry();
          dlg.setGeometry( geometry );
          dlg.exec();
      }
      

      With this code, QDIalog's "OK" button can be clicked.

      If you comment `dlg.setGeometry( geometry );`, then the OK button cannot be clicked. Dialog does not get any user input (any Qt control is not responsive, not only buttons).

      Note that hitting phones "bakc" button closes the QDialog, so the app is still running fine, only user inputs on screen are not taken into account.

      I did not see this issue with odre version of Qt like 6.2.2.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtandroidteam Qt Android Team
              jpo38 Jean Porcherot
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes