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. Canvas / Context2D in Qt4.8
Forum Updated to NodeBB v4.3 + New Features

Canvas / Context2D in Qt4.8

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 1.1k Views 2 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    With a project I need to use the very old Qt4.8 and I cannot use the Canvas object to draw with Context2D. I tried to search in the docs but I'm not sure what was the right method on that release.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What are you trying to do ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mark81
        wrote on last edited by Mark81
        #3

        Something like this:

        Canvas {
                id: canvas
                anchors.fill: parent
        
                onPaint: {
                    var ctx = canvas.getContext('2d');
                    ctx.reset();
        
                    ctx.lineWidth = 4;
                    ctx.strokeStyle = "red"
                    ctx.beginPath()
                    ctx.moveTo(root.width / 2, 24)
                    ctx.lineTo(root.width * 0.9, 24)
                    ctx.stroke()
        
                    ctx.beginPath()
                    ctx.fillStyle = "red"
                    ctx.arc(root.width * 0.9, 24, 6, 0, 360)
                    ctx.fill()
             }
        }
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You'll have to do a "reverse port". See here for the differences between QtQuick 1 and 2

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Mark81
            wrote on last edited by
            #5

            Most of the link lead to error 404. I will try to Google them. Thanks

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              The documentation has changed a bit. The links have been updated.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

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