Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT QVulkanWindow overlay widgets



  • 0
    down vote
    favorite

    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?


  • Qt Champions 2019

    @JiuShei said in QT QVulkanWindow overlay widgets:

    QVulkanWindow

    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);
    widget->show();
    
    
    m_label = new QLabel("text.", widget);
    m_label->show();
    
    m_vulkan_window = std::make_shared<WSQVulkanWindow>(this);
    
    m_vulkan_window->setVulkanInstance(&m_qt_vk_instance);
    
    m_vulkan_window->show();
    
    auto wrapper = QWidget::createWindowContainer(m_vulkan_window.get(), widget);
    
    wrapper->resize(m_default_width, m_default_height);
    
    wrapper->show();
    
    1. Added the following flags
    m_label->setAttribute(Qt::WA_NoSystemBackground);
    m_label->setAttribute(Qt::WA_TranslucentBackground);
    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