Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Painting on top of QQuickView
Qt 6.11 is out! See what's new in the release blog

Painting on top of QQuickView

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 983 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • webzoidW Offline
    webzoidW Offline
    webzoid
    wrote on last edited by
    #1

    Is it at all possible to paint (using QPainter) on top of (i.e. like an overlay) a QQuickView?

    I have a QML OSM map plugin loaded into a QWidget and I would like to draw on top of this using QPainter (rather than using QML). Is this achieveable?

    There appears to be no paintEvent or equivalent available when sub-classing QQuickView

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can create a transaprent QQuickPaintedItem that stretches over your whole QML window, and paint there.

      Just keep in mind that painting with QPainter is slower than with QML or OpenGL.

      (Z(:^

      1 Reply Last reply
      1
      • webzoidW Offline
        webzoidW Offline
        webzoid
        wrote on last edited by
        #3

        @sierdzio Thanks for your comments. Unfortunately I don't think what I ultimately want to do is possible due to the way QML and the QQuickPaintedItem is implemented.

        Basically, I have a 3rd party COM object which draws nautical charts. My existing QWidget application allows me to draw these charts in the paintEvent where I capture the winId of the QWidget and pass it to the BeginPaint/EndPaint functions ready for painting this 3rd party chart.

        The act of obtaining the winId in a QQuickPaintedItem causes a lot of issues and results in the underlying QML not being rendered.

        I've managed to implement this another way and it works so far.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved