# Mixing Juce and Qt

**URL:** <https://forum.juce.com/t/mixing-juce-and-qt/26733>\
**Category:** Development\
**Created:** [March 9, 2018, 9:19pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733 "2018-03-09T21:19:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariusmusicus](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mariusmusicus](https://forum.juce.com/u/mariusmusicus)\
**Post date:** [March 9, 2018, 9:19pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/1 "2018-03-09T21:19:59Z")

</div>

Hello Forum, I am building a graphics+audio application.

1. I need advanced 2D graphics and the ability to render graphics to print and pdfs.  
2 I need to load, play and visually display audio files

I would like to use QT for all the graphics, printing and pdf export functionalities but I want to use Juce for audio playback, wave form drawing and scrolling, etc. How can I combine a Juce waveform view and a QT graphics view in the same application window? Is it even possible?

Regards,

Mariu

---

<div class="post-metadata">

**Author:** ![jonathonracz](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@jonathonracz](https://forum.juce.com/u/jonathonracz)\
**Post date:** [March 9, 2018, 10:42pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/2 "2018-03-09T22:42:13Z")

</div>

It’s certainly possible, but incredibly difficult (obviously).

The first obstacle is merging the build systems. Qt integrates well with CMake, so we’ll use that. You now need to build CMake modules for all the JUCE modules you need and get them all working together in such a way that there’s no symbol conflicts.

Once you have that working you’ll need to build an adapter `QWidget` which can act as a `ComponentPeer` to allow JUCE `Component` objects to talk to Qt, and most likely a `LowLevelGraphicsContext` which can draw to a `QWidget` surface via JUCE’s `LowLevelGraphicsContext`.

You’d probably be best off using one of the other. Qt provides a whole host of audio-related facilities and many major apps are written with it (Ableton Live comes to mind).

---

<div class="post-metadata">

**Author:** ![mcmartin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mcmartin/32/7432_2.png) [@mcmartin](https://forum.juce.com/u/mcmartin)\
**Post date:** [March 9, 2018, 11:23pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/3 "2018-03-09T23:23:50Z")

</div>

Sorry to chime in, but Ableton Live is not written with Qt.

---

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [March 9, 2018, 11:49pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/4 "2018-03-09T23:49:47Z")

</div>

They do use something from Qt, just check the Windows installation folder, it has Qt5Core.dll, Qt5Gui.dll etc. But it’s a safe bet they don’t use anything from Qt for audio. 😉

---

<div class="post-metadata">

**Author:** ![cpenny](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpenny/32/4662_2.png) [@cpenny](https://forum.juce.com/u/cpenny)\
**Post date:** [March 10, 2018, 12:23am UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/5 "2018-03-10T00:23:32Z")

</div>

You could write all your audio functionality as a DLL or static library and link to that from Qt. Just make a basic C API that wraps everything. This worked wonderfully with quite a few different projects of mine, including ReactNative iOS & Android and a python app. I’m sure Qt would be no different — it would be just like using any external library.

I have done that a lot — also works with pretty much any other system as well. A bit more of a pain to develop & test, but it’s probably the simplest answer, and there’s no messy merging of Qt and JUCE. Just a regular Qt app with a library.

---

<div class="post-metadata">

**Author:** ![cpenny](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpenny/32/4662_2.png) [@cpenny](https://forum.juce.com/u/cpenny)\
**Post date:** [March 10, 2018, 12:25am UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/6 "2018-03-10T00:25:25Z")

</div>

I don’t think any of this would be necessary, since they said they wouldn’t be using any of the JUCE GUI functionality…

If they just want the audio bits, it’s a lot simpler to just write that as a DLL or static library and link to it from a regular Qt app. I’ve done this before and it works great.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [March 10, 2018, 12:42am UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/7 "2018-03-10T00:42:34Z")

</div>

Additionally to the said, I would avoid mixing the drawing of both, since this is a crucial point for sudden performance problems, when the two graphics backends need to synchronise.  
I would rather access the audio float arrays for displaying and write Qt rendering code.

All warnings and precautions about multi threading and not blocking the audio thread apply.

---

<div class="post-metadata">

**Author:** ![mariusmusicus](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@mariusmusicus](https://forum.juce.com/u/mariusmusicus)\
**Post date:** [March 11, 2018, 6:49pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/8 "2018-03-11T18:49:43Z")

</div>

Thanks for the reply. That does sound complicated to me. Too bad Juce doesn’t print graphics and export pdfs.

---

<div class="post-metadata">

**Author:** ![MBO](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mbo/32/5045_2.png) [@MBO](https://forum.juce.com/u/MBO)\
**Post date:** [March 11, 2018, 8:00pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/9 "2018-03-11T20:00:12Z")

</div>

They use Qt for display rendering on Push. That’s why the Qt dlls are present in the Ableton folder. More details here:

> **[Ableton Push - Qt in music making - Qt Blog](http://blog.qt.io/blog/2015/12/15/ableton-push-qt-in-music-making/)**
>
> Ableton Push is a digital instrument created with Qt. We got to interview the developers.

---

<div class="post-metadata">

**Author:** ![ivofx](https://avatars.discourse-cdn.com/v4/letter/i/c57346/32.png) [@ivofx](https://forum.juce.com/u/ivofx)\
**Post date:** [May 26, 2018, 6:56pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/10 "2018-05-26T18:56:19Z")

</div>

I am using Qt for UI. Just be sure to disable the web browser and any un-needed features from `juce_gui_basics` and `juce_gui_extra` when composing your project in the projucer. It took me some fiddling as I am a noob, but I got it working fine now.

---

<div class="post-metadata">

**Author:** ![remaininlight](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@remaininlight](https://forum.juce.com/u/remaininlight)\
**Post date:** [November 21, 2018, 11:26pm UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/13 "2018-11-21T23:26:18Z")

</div>

Hi ivofx,

Would you be able to give a little more detail about your approach please? Did you follow jonathonracz’s approach (from the top of this thread) or something different?

Any pointers gratefully received!

---

<div class="post-metadata">

**Author:** ![maxmatteo](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@maxmatteo](https://forum.juce.com/u/maxmatteo)\
**Post date:** [September 6, 2023, 9:42am UTC](https://forum.juce.com/t/mixing-juce-and-qt/26733/14 "2023-09-06T09:42:41Z")

</div>

late but relevant:

> **[JUCE x Qt](https://www.qt.io/blog/juce-x-qt)**
>
> An exploration of using Qt as the UI layer of a JUCE audio plugin.
