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

QDialog as a child window cannot set the window position

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.15.10, 6.6.3
    • QPA: Wayland
    • None
    • Linux/Wayland

    Description

      The following Qt program cannot set the sub-window position under wayland.

      #include <QApplication>
      #include <QWidget>
      #include <QDialog>
      #include <QPushButton>
      #include <QVBoxLayout>

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);

      QWidget mainWindow;
      mainWindow.setWindowTitle("Main Window");
      mainWindow.resize(600,600);

      QPushButton openButton("Open QDialog");
      QVBoxLayout layout(&mainWindow);
      layout.addWidget(&openButton);

      QDialog dialog(&mainWindow);
      dialog.setWindowTitle("QDialog");
      dialog.resize(200, 100);
      // dialog.hide();

      QObject::connect(&openButton, &QPushButton::clicked, [&dialog,&openButton ,&mainWindow]()

      { QPoint point = QPoint(openButton.geometry().x(), openButton.geometry().y() + openButton.geometry().height() + 50); dialog.move(mainWindow.mapToGlobal(point)); // dialog.move(50,50); dialog.show(); }

      );

      mainWindow.show();

      return app.exec();
      }

      Already read the upstream discussion on "Can't set a position for the top-level window":
      https://gitlab.freedesktop.org/wayland/wayland/-/issues/183

      Is there any way to set the position of QDialog when the current QDialog is used as a child window (setting its parent); just like in X11;
      Or whether it is necessary to set the sub-window position with the support of the protocol upstream;

      Attachments

        1. wayland.png
          wayland.png
          21 kB
        2. x11.png
          x11.png
          20 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            dami dami Lu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes