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. [QtQuick - QML] Dynamic curves
Forum Updated to NodeBB v4.3 + New Features

[QtQuick - QML] Dynamic curves

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.7k 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.
  • W Offline
    W Offline
    Wroman
    wrote on 14 Jun 2012, 08:34 last edited by
    #1

    Hello,

    I would like to display a graph in which there's a curve which has to evolve over time.

    A timer would be what i'm thinking of to make it happen but i haven't found how to display curves in my QML...

    What i've made actually is :

    @ Rectangle {
    id: rect3;
    //x: 25
    anchors.fill: parent
    width: 720;
    height: 480;
    color: "#00000000"
    PathView {
    id: paV3;
    opacity: 0.7
    anchors.fill: parent;
    model: 950;
    delegate: Rectangle {
    id: dot3;
    width: 1.0625; height: 1.0625;
    color: "#00c0ff";
    smooth: true
    }

                    path: Path {
                        id: ph3;
                        startX: 16.0; startY: paV3.height/2.0;
                        pathElements: [
                            PathQuad {
                                x: 40.0; y: paV3.height/2.0;
                                controlX: 20.0; controlY: ph3.startY +145.0;
                            },
                            PathQuad {
                                x: 80.0; y: paV3.height/2.0;
                                controlX: 60.0; controlY: ph3.startY -60.0;
                            },
                            PathQuad {
                                x: 120.0; y: paV3.height/2.0;
                                controlX: 100.0; controlY: ph3.startY +145.0;
                            },
                            PathQuad {
                                x: 160.0; y: paV3.height/2.0;
                                controlX: 140.0; controlY: ph3.startY -60.0;
                            },
                            PathQuad {
                                x: 200.0; y: paV3.height/2.0;
                                controlX: 180.0; controlY: ph3.startY +145.0;
                            },
                            PathQuad {
                                x: 240.0; y: paV3.height/2.0;
                                controlX: 220.0; controlY: ph3.startY -60.0;
                            },
                            PathQuad {
                                x: 284.0; y: paV3.height/2.0;
                                controlX: 260.0; controlY: ph3.startY +120.0;
                            }
                        ]
                    }
                }
            }@
    

    And a function that swap values to move the curves up and down.

    But how can I put data in to draw the curves dynamically ?

    Trust me, i'm an engineer !

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on 18 Jun 2012, 03:14 last edited by
      #2

      Hi,

      QtQuick 2.0 introduces a Canvas element that might be useful for this. Another option might be creating a custom item for drawing the curve (there are no built-in curve drawing items, besides the newly added Canvas).

      Regards,
      Michael

      1 Reply Last reply
      0

      1/2

      14 Jun 2012, 08:34

      • Login

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