Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Creating a custom-drawn component

$
0
0
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”.

Viewing all articles
Browse latest Browse all 4972

Trending Articles