Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Layout problems with QtWidget::createWindowContainer
Forum Update on Monday, May 27th 2025

Layout problems with QtWidget::createWindowContainer

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.1k 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.
  • D Offline
    D Offline
    Desperado17
    wrote on 17 Feb 2021, 21:06 last edited by
    #1

    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
    0
    • D Offline
      D Offline
      Desperado17
      wrote on 18 Feb 2021, 09:28 last edited by
      #2

      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?

      J 1 Reply Last reply 18 Feb 2021, 15:27
      0
      • D Desperado17
        18 Feb 2021, 09:28

        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?

        J Offline
        J Offline
        JKSH
        Moderators
        wrote on 18 Feb 2021, 15:27 last edited by
        #3

        @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 18 Feb 2021, 15:31
        0
        • J JKSH
          18 Feb 2021, 15:27

          @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

          D Offline
          D Offline
          Desperado17
          wrote on 18 Feb 2021, 15:31 last edited by Desperado17
          #4

          @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.

          J 1 Reply Last reply 18 Feb 2021, 22:45
          0
          • D Desperado17
            18 Feb 2021, 15:31

            @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.

            J Offline
            J Offline
            JKSH
            Moderators
            wrote on 18 Feb 2021, 22:45 last edited by
            #5

            @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
            0

            1/5

            17 Feb 2021, 21:06

            • Login

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