QWidget subclass setSurfaceType(...)
-
I'd like to do Vulkan things in a widget that lives within a designer-composed,
uic-generated ui.
This hits (apparent) problems along each path I have considered;uicdoesn't allow me to inject aQWidget::createWindowContainer()-created object among its generated boilerplate code, and- I haven't (yet?) found a way for a subclass of QWidget to influence the
QSurface::SurfaceTypeof its window.- I have tried (not exhaustively) to
windowHandle()->setSurfaceType(QSurface::VulkanSurface)at a few different possibilities inside my subclass, but I'm absolutely sure I'm not holding it right. In bipolar fits, it keeps doing either nothing at all, or blowing up violently.
- I have tried (not exhaustively) to
It seems I'm missing something trivial; any ideas?
(I also suspect that I am deeply misunderstanding what a QWindow really is; probably mentally typecasting it into an X11 window in order to imagine that each QWidget will have its own private, impervious rectangle to act within.)
-
Sometimes just asking the question brings the answer.
I added a plain QWidget 'receptacle' in the .ui, then in my own mainwindow code I foist a layout on it holding my vulkan-equipped subwidget.ui_->setupUi(this); auto* vw = new QVulkanWindow{}; ... auto* layout = new QVBoxLayout{}; layout->addWidget(QWidget::createWindowContainer(vw)); ui_->receptacle->setLayout(layout);