ofQt: openFrameworks + Qt UI's


I have been working with James George on a way to integrate OF with Qt, i.e. compile OF apps that spawn and utilize Qt UI windows. While there has been discussion about using Qt Creator as an IDE for OF on Linux, this is instead an attempt at integrating Qt and OF. Our motivation for doing this is to develop a cross-platform workflow for OF apps that require robust, native UI’s.

Here’s what we could use help with:

  • This only compiles with the 64-bit OF 0.9.0, which I had to modify slightly for qmake to compile it. Specifically, I changed some file extensions from .cpp to .mm. I couldn’t figure out how to compile OF + Qt with the 32-bit version of OF or unmodified 64-bit version, but would appreciate any suggestions as the current setup is a bit of a hack.
  • Currently, you have to manually add libfmodex.dylib to ofTestApp > Contents > MacOS for the example app to link properly. Is there a way to avoid doing this with a copy script, maybe something in the ofTestApp .pro file?
  • ofQt has only been tested on OSX 10.10. Does this approach work on Windows?

Other notes:

  • OF + Qt has only been tested with Qt Creator
  • Executing the QApplication in main.cpp prevents OF from starting, although the QApplication must be initialized for the Qt window to open in the first place. This shouldn’t be a problem if you’re only using Qt for a UI.

Steps to get ofQt running:

  1. Download Qt and Qt Creator.

  2. Clone ofQt from our repo

  3. In Qt Creator: File > Open File or Project > [/path/to/ofQt.pro] > Configure Project

  4. Expand the project tree on the left panel and select “openFrameworksLib”

  5. Build > Build Subproject “openFrameworksLib” (this will take a few minutes)

  6. Build > Build Project “ofQt” (Note: you may get an error “Library not loaded: ./libfmodex.dylib”; to fix this, manually copy from libfmodex.dylib from of_v0.9.0/libs/fmodex/lib/osx to build-ofQt-Desktop_Qt_5_4_2_clang_64bit-Debug/ofTestApp/ofTestApp/Contents/MacOS/, thenbuild again)

  7. Build > Run

ofQt contains a simple example that lets you control the size of an ellipse with a Qt slider, and manipulate values in a Qt table. You should be able to compile the project in Qt Creator without any special setup, so long as you use the custom copy of OF included in the repo.

ofQt uses the layout described in this StackOverflow post. This is what Qt Creator calls a “subdirs project”, in which OF is a static library and ofTestApp is a subproject. The tree structure looks like this:

The main .pro file ofQt.pro shows the relationships between the container project, the subproject and static lib:

TEMPLATE = subdirs
CONFIG += ordered

   ofTestApp \
ofTestApp.depends = openFrameworksLib

There are three .pro files in total: 1) the container project ofQt, 2) the app subproject ofTestApp which contains the OF app and the Qt UI file, 3) openFrameworksLib, or the OF static library. The Qt UI is defined in mainwindow.ui, which you can edit visually in Qt Creator.


Hi Mileshiroo,

I’m working on an university project where I need to develop a robust GUI for an open frameworks project.
I would love it if you could explain how to accomplish what you have done. I mean, integrating my OF project in QT so I can develop the UI.

Can you list the steps to do this?


First of all, thank you for this fantastic job!

I would like to know if it is possible to integrate the OF window inside the QT window.
I needed to use the camera module of OF in a QT project, since the camera module in QT is currently very limited in both mac and windows.

Hi thank you very much for this!

I’ve been trying to compile on windows but i get errors when trying to compile openframeworksLib. I created an issue here:

Anyone else running Qt UI with openframeworks?