Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Scene Graph Basic Drawing Example
Forum Updated to NodeBB v4.3 + New Features

Qt Scene Graph Basic Drawing Example

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 2.4k 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.
  • A Offline
    A Offline
    Alien
    wrote on 1 Jan 2018, 09:12 last edited by
    #1

    Hi,
    I want to inheritance from QQuickItem and implement updatePaintNode function to draw some basic shapes but I couldn't find a simple way to draw circle,ellipse,arc,... just I found QSGSimpleRectNode that can create a simple rectangle.

    Where is a good and complete tutorial to start with QSG(that explain all classes with examples and also cover the shaders and so on)?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      timday
      wrote on 3 Jan 2018, 17:23 last edited by
      #2

      Hmmm what's the end point you're actually trying to get to? If your goal is to draw things like ellipses and arcs then it's not obvious diving into QSG is going to help you (there's nothing in QSG which supports drawing those things directly). Possibly QQuickPaintedItem and QPainter would be a better starting point for you (and there's also the option of using the QML Canvas type and doing everything in QML+JS).

      A 1 Reply Last reply 4 Jan 2018, 19:42
      0
      • T timday
        3 Jan 2018, 17:23

        Hmmm what's the end point you're actually trying to get to? If your goal is to draw things like ellipses and arcs then it's not obvious diving into QSG is going to help you (there's nothing in QSG which supports drawing those things directly). Possibly QQuickPaintedItem and QPainter would be a better starting point for you (and there's also the option of using the QML Canvas type and doing everything in QML+JS).

        A Offline
        A Offline
        Alien
        wrote on 4 Jan 2018, 19:42 last edited by
        #3

        Dear @timday,
        I just want to have some portable and reusable drawing as a QML component, also performance is really important to me, some special drawing like draw a gauge or some shapes as a independent package as a library which other developers can use them as a QML component.

        T 1 Reply Last reply 4 Jan 2018, 23:17
        0
        • A Alien
          4 Jan 2018, 19:42

          Dear @timday,
          I just want to have some portable and reusable drawing as a QML component, also performance is really important to me, some special drawing like draw a gauge or some shapes as a independent package as a library which other developers can use them as a QML component.

          T Offline
          T Offline
          timday
          wrote on 4 Jan 2018, 23:17 last edited by timday 1 Apr 2018, 23:20
          #4

          @Alien If I wanted to do something like that I'd probably take a look at the sources of QML components like CircularGauge and Gauge to see how they (and associated styling) are implemented.

          I've found you can do some nice work using the bits of QML which support SVG/bezier curves etc (e.g Image, Canvas) provided you make sure they're only rendered once at the necessary size and then everything subsequently (e.g rotations) is done using HW-accelerated raster operations (all doable from pure QML). But if you ever get into a situation where you're animating the size of something rendering from SVG each render... that's too slow.

          T A 2 Replies Last reply 4 Jan 2018, 23:18
          1
          • T timday
            4 Jan 2018, 23:17

            @Alien If I wanted to do something like that I'd probably take a look at the sources of QML components like CircularGauge and Gauge to see how they (and associated styling) are implemented.

            I've found you can do some nice work using the bits of QML which support SVG/bezier curves etc (e.g Image, Canvas) provided you make sure they're only rendered once at the necessary size and then everything subsequently (e.g rotations) is done using HW-accelerated raster operations (all doable from pure QML). But if you ever get into a situation where you're animating the size of something rendering from SVG each render... that's too slow.

            T Offline
            T Offline
            timday
            wrote on 4 Jan 2018, 23:18 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • T timday
              4 Jan 2018, 23:17

              @Alien If I wanted to do something like that I'd probably take a look at the sources of QML components like CircularGauge and Gauge to see how they (and associated styling) are implemented.

              I've found you can do some nice work using the bits of QML which support SVG/bezier curves etc (e.g Image, Canvas) provided you make sure they're only rendered once at the necessary size and then everything subsequently (e.g rotations) is done using HW-accelerated raster operations (all doable from pure QML). But if you ever get into a situation where you're animating the size of something rendering from SVG each render... that's too slow.

              A Offline
              A Offline
              Alien
              wrote on 5 Jan 2018, 14:18 last edited by
              #6

              @timday ,
              Thanks for your reply,so far as I understand QT doesn't have great documentation on QSG and I have to read the code to get appropriate knowledge about QSG.

              thanks for your help.

              T 1 Reply Last reply 5 Jan 2018, 18:54
              0
              • A Alien
                5 Jan 2018, 14:18

                @timday ,
                Thanks for your reply,so far as I understand QT doesn't have great documentation on QSG and I have to read the code to get appropriate knowledge about QSG.

                thanks for your help.

                T Offline
                T Offline
                timday
                wrote on 5 Jan 2018, 18:54 last edited by
                #7

                @Alien That's not what I'm saying. QSG is very well documented; start here. However, there's nothing there which will really help you with drawing ellipses and arcs because that's not what QSG is about. That sort of thing is more the realm of QPainter or QML Canvas.

                1 Reply Last reply
                1

                1/7

                1 Jan 2018, 09:12

                • Login

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