Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QT QVulkanWindow overlay widgets
JiuShei last edited by JiuShei
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?
What exactly does not work? QVulkanWindow is a QWindow - you should be able to use it as any other window.
JiuShei last edited by
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
- 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();
- 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
- Attempt to add QWidget::createWindowContainer of VulkanWindow and QLabel widget to one parent widget with QGridLayout or QVBoxLayout.
It has no effect
Create QVulkanWindow with parent newwidget->windowHandle() with following creation QLabel widget on newwidget parent
Create new QWindow with parent QVulkanWindow. After that create widget from QWindow and create child QLabel for mentioned widget.