Important: Please read the Qt Code of Conduct -

Is calling requestUpdate() in QEvent::UpdateRequest valid?

  • Hey there,
    I want to render with Vulkan to my Qt surface. From the examples and the existing code I've figured to call requestUpdate() inside of an UpdateRequest event callback, to enforce continuous rendering.

    Can someone tell me if this is the correct approach?

    (I want to subclass directly from QWindow and not use QVulkanWindow)

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What example are you talking about ?

  • Hello SGaist, thanks!

    Example is actually the wrong word, I looked into the source files of the QVulkanWindow class:

    My primary goal is to render with Vulkan on a surface provided by Qt.
    I know that QVulkanWindow exists, but it already provides a SwapChain(etc.) which I prefer to create myself. So in the details description of QVulkanWindow it says:

    Note: QVulkanWindow does not always eliminate the need to implement a fully custom QWindow subclass as it will not necessarily be sufficient in advanced use cases.

    I want to make use of Qts platform independency while doing the Vulkan stuff myself. So I wonder if calling requestUpdate() out of a callback from QEvent::UpdateRequest is the right approach.

    bool event(QEvent* event) override
        switch (event->type()) 
        case QEvent::UpdateRequest:
            return true;
            return QWindow::event(event);
    void renderNow()
        // ... render code

    Thanks for bothering.

  • So after more research, I finally found the solution to what I was looking for myself:

    I wonder how I could have missed that, during my hour long researches... probably because I didn't knew what exactly I was looking for.

Log in to reply