Nominate our 2022 Qt Champions!

QT QVulkanWindow overlay widgets

  • 0
    down vote

    I'm searching a way to draw any QT widget overlay on QVulkanWindow. I cannot find solution. Child/parent hierarchy and QT flags don't bring expected behaviour. Is it possible to draw QT widgets on the top of QVulkanWindow?

  • Lifetime Qt Champion

    @JiuShei said in QT QVulkanWindow overlay widgets:


    What exactly does not work? QVulkanWindow is a QWindow - you should be able to use it as any other window.

  • @jsulm said in QT QVulkanWindow overlay widgets:

    ndow - you should be able to use it as any other window.

    I've tried the following but e.g. QLabel always draws behind of QVulkanWindow

    1. attempt to create QWidget and Vulkan window from one parent QWidget
    auto widget = new QWidget;
    widget->resize(m_default_width, m_default_height);
    m_label = new QLabel("text.", widget);
    m_vulkan_window = std::make_shared<WSQVulkanWindow>(this);
    auto wrapper = QWidget::createWindowContainer(m_vulkan_window.get(), widget);
    wrapper->resize(m_default_width, m_default_height);
    1. Added the following flags
    m_label->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::CoverWindow);

    Label is shown on top of vulkan window but it doesn't follow vulkan window position

    1. Attempt to add QWidget::createWindowContainer of VulkanWindow and QLabel widget to one parent widget with QGridLayout or QVBoxLayout.

    It has no effect

    1. Create QVulkanWindow with parent newwidget->windowHandle() with following creation QLabel widget on newwidget parent

    2. Create new QWindow with parent QVulkanWindow. After that create widget from QWindow and create child QLabel for mentioned widget.

Log in to reply