Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Layout problems with QtWidget::createWindowContainer

    General and Desktop
    2
    5
    247
    Loading More Posts
    • 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.
    • D
      Desperado17 last edited by

      I try to embed an empty, black QWindow in a Qt Widget application using QtWidget:: createWindowContainer (Qt 5.10.1 on Ubuntu 18.04 X64). The resulting wrapper widget should become the child of another QWidget which serves as a placeholder in the GUI, "ui->wgtScene":

      QVBoxLayout * layout = new QVBoxLayout ( ui->wgtScene );
      ui->wgtScene->setWindowFlags( Qt::FramelessWindowHint );
      QWidget * wrapperWidget = QWidget::createWindowContainer ( new QWindow(), ui->wgtScene, Qt::Widget );
      wrapperWidget->setFixedSize( 1000, 800 );
      wrapperWidget->setStyleSheet ( "background-color:yellow;" );
      wrapperWidget->show();
      wrapperWidget->setFocus();
      layout->addWidget ( wrapperWidget );
      ui->wgtScene->setLayout ( layout );
      The area where the window should be visible looks broken. It looks like the standard Qt gray background but at the edges you can see a small black rim that seems to come from the embedded window slightly off layout. If I replace wrapperWidget by a regular QWidget(), I see a nice yellow field at the right position.

      What am I doing wrong?

      1 Reply Last reply Reply Quote 0
      • D
        Desperado17 last edited by

        Ok, since apparently the answer is not easy let me phrase the question differently:

        Should a QWindow embedded in createWindowContainer generally appear as a black rectangle?

        JKSH 1 Reply Last reply Reply Quote 0
        • JKSH
          JKSH Moderators @Desperado17 last edited by

          @Desperado17 said in Layout problems with QtWidget::createWindowContainer:

          Should a QWindow embedded in createWindowContainer generally appear as a black rectangle?

          What is the purpose of the QWindow?

          I don't know the direct answer to your questions, but I do know that there are issues with trying to embed external windows into Qt widgets: https://bugreports.qt.io/browse/QTBUG-40320

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          D 1 Reply Last reply Reply Quote 0
          • D
            Desperado17 @JKSH last edited by Desperado17

            @JKSH Actually the QWindow is a QVulkanWindow or a custom window class where I switched Vulkan on. I just replaced it for the time being while testing.

            The hello vulkan examples from qt work by the way but I cannot explain why as they do even less to enforce the layout.

            JKSH 1 Reply Last reply Reply Quote 0
            • JKSH
              JKSH Moderators @Desperado17 last edited by

              @Desperado17 said in Layout problems with QtWidget::createWindowContainer:

              The hello vulkan examples from qt work by the way but I cannot explain why as they do even less to enforce the layout.

              I can't see anything obviously wrong with your code.

              I suggest you copy the Hello Vulkan example code into your project, and then gradually integrating it into your existing widget and modifying it to fit what you want.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply Reply Quote 0
              • First post
                Last post