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. Creating a custom-drawn component
Forum Updated to NodeBB v4.3 + New Features

Creating a custom-drawn component

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.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.
  • L Offline
    L Offline
    Lost Marble
    wrote on last edited by
    #1

    I'm experimenting with Qt Quick to create a desktop application that does some audio processing. The audio processing will be implemented in C++, and I'd like to be able to update the drawing of the audio waveform in realtime as the user makes some adjustments.

    The problem I have is that it's not clear what the recommended way is to create a user-drawn component. At first I thought I would create a subclass of QQuickPaintedItem, but the documentation for that class says it should only be used for porting older code. I guess I could use it anyway, but I'd prefer to use the "correct" approach.

    I imagine I could use a QQuickImageProvider, and produce a view of the waveform as an image. Or, I could probably use a Canvas and do the drawing in JavaScript, but I suspect passing the audio data from C++ to JavaScript is going to kill performance. It'll probably be better to just draw it in C++.

    If someone could point me towards an example that shows the recommended way of doing something like this, I would appreciate it. There may already be an example included with Qt 5.2, but I could use a pointer to the "best practice".

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      "Here is a good example that shows the basics":http://developer.nokia.com/community/wiki/CS001627_-_Creating_a_custom_QML_element_with_Qt

      Edit: If you want Qt5, you will have to replace some "old" Qt4 objects with the new ones. But anyway, you have a starting point.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        another one : "usage of dynamic graph":http://developer.nokia.com/community/wiki/QML_Performance_Meter

        This one seems more close to what you want. I haven't tested it though, but seems worth looking at.

        same remark here : it's based on Qt4's QDeclarativeView

        Qt Certified Specialist
        www.edalsolutions.be

        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