QT GUI Interface

Hi,

Has anyone tried implementing QT (http://www.qtsoftware.com/products) for OF? Seems like a nice interface with cross platform capabilities.

Eoghan

Yea, i’ve tried without succes… I tried to make a new ofAppQtWindow, parallel to the glut file… But i stuck in merging a qt and of project together… I’m not good enough in doing include paths etc etc in xcode, and the qt really has a advanced setup (of their own qmake and other stuff)… And vica versa, i could not get of included into their example project, i remember having problems getting poco includes to work…

But it would be really nice! And it is possible im quite sure!

I had the very same problem. The setup for xcode seems overly complex and I lost interest after a while.

Hehe, yea… I think the the most realistic thing to do is include oF in a qt project… Or find a tutorial for adding qt to an exsiting xcode projects…

Good news, i gave it a second try today, and i got it to work!! Expect a xcode template file with of embedded in qt later today :smiley:

Awesome!
Good work. Did you add the OF framework to QT or vice versa?
I’ll be sure to check it out!

It’s the of added to qt, but it will look pretty much the same when im done… I’ve just got draw to work in a window… But got some things to do before it makes sence to share…

Okay, here we go!

This is really a alpha alpha test… There are many oF functions that i havent made yet! But it shows how it can work! I have added suppot for mousePressed, moved, keyPressed etc etc… But i haven’t done it for all of functions yet.

You can download my xcode project from here: http://halfdanj.dk/ofQt/ofQt.zip

To use it, first install QT library completely on your mac.
Secondly download http://halfdanj.dk/ofQt/ofAppQtWindow.zip , and add the two files to /of_install_dir/libs/openFrameworks/app/

and then i think it should be rock’n’roll when you compile the xcode project… Though there might be some wrong hardcoded links to QT on my computer, if so, tell me!

Hello halfdanj!

When trying to compile I get a

  
error: couldn't create directory /Users/jonas/Documents/udvilking/of_preRelease_v0.06_xcode_FAT/apps/jonas/ofQt: Permission denied  

error. Seems to be a hardcoded copy command somewhere, but I can’t find it.
However, I find the app in build/Debug and it runs, but without the Font loaded. When started from within Terminal, I get the typical

  
OF_ERROR: Error : font not allocated -- line 789 in /Users/net/workspace/openFrameworks/of_preRelease_v0.06_xcode_FAT/apps/examples/ofQt/../../../libs/openFrameworks/graphics/ofTrueTypeFont.cpp  

But: LOOKS PROMISING!

Hope you keep up your good work,
Gestalt

Hey Gestalt, thanks… I think i found the error (or i have atleast removed my path from one place)… Updated version uploaded!

hi,

This looks nice! And i like to use your code halfdanj. I use windows with codeblocks and i’m not able to run your program! If i make in codeblocks a new QT4 project it works fine, with examples from QT too. But if i try to build a project with openGL i got linker vtable errors. I think this is because codeblocks isn’t knowing that i use openGL. I tried also a plugin for codeblocks named QtWorkbench. With this plugin i’m able to compile and run example projects with openGL from QT, but with your project it won’t work. i receive compile errors:

  
  
..\..\..\libs\openFrameworks\communication\ofSerial.cpp|434|error: cannot convert `char*' to `const WCHAR*' for argument `1' to `BOOL BuildCommDCBW(const WCHAR*, _DCB*)'|  

Can you help me with this problem? I think these errors are because OF takes other librarys from QT!?

Hi

Thats a hard one! I have myself tried to compile it under anything else then xcode on mac… And i must say that i don’t really know what that error means!

I have now fixed this error. This is because Qt works with compiler setting UNICODE. When i #undef UNICODE in this *.hpp file i don’t receive this error. But then while linking files it gives me an error! I will give it tomorrow another try.

I think if i have time i will try to write a interface class and compile the whole Qt with this interface to a library, then i could use it with OF. But i’m not yet sure if this will work.

I’ve been banging on this source for awhile now but the main challenge I run in to is that every time I qmake a new interface my new xcode project gets completely butchered, and I am missing all the dependencies. Truly, this seems to require either a shit-ton of patience to integrate, a special trick I don’t know about xcode, or a mastery of qmake config files that I don’t have. :?

How the hell did you get your xcode project to blend with the generated Qt xcode project?

(I’m subscribing to this thread because i just came across qt, which seems like a really nice framework which I’d love to combine with OF’s capabilities in the near future. I’ve yet to try following the instructions here).

Anyone here have success incorporate Qt to Of ?

I have created a Qt GUI window and i would like to using CCV or OF to do the following.

  1. Resize the GUI window
  2. Scale and Rotate the GUI window

Optional:
3. Click event GUI window
4. Text Input

Please help.

Thanks.

hi

i am on ubuntu jaunty trying to compile the QT example posted in this thread. I took the empty example and replaced the main files, then added the extra files to the project. i get the error below. Do I have to let the CodeBlock’s project where to find the QT headers or something like that?

I just checked and I made sure that the Qt 4 OpenGL module is installed in my system.

this is the error. thanks!

/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|43|warning: QtGui: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|44|warning: QtOpenGL: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|46|warning: QGLWidget: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|47|warning: QTime: No such file or directory|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|50|error: expected class-name before ‘{’ token|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|51|error: ISO C++ forbids declaration of ‘Q_OBJECT’ with no type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|53|error: expected ‘;’ before ‘public’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|57|error: ‘QSize’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|58|error: ‘QSize’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|64|error: expected `:’ before ‘slots’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|65|error: expected primary-expression before ‘void’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|65|error: ISO C++ forbids declaration of ‘slots’ with no type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|65|error: expected ‘;’ before ‘void’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|70|error: expected primary-expression before ‘void’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|70|error: ISO C++ forbids declaration of ‘signals’ with no type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|70|error: expected ‘;’ before ‘void’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|76|error: ‘QMouseEvent’ has not been declared|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|77|error: ‘QMouseEvent’ has not been declared|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|78|error: ‘QMouseEvent’ has not been declared|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|82|error: ‘QPoint’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|85|error: ‘QTime’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|51|error: ‘QWidget’ has not been declared|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|51|error: prototype for ‘GLWidget::GLWidget(ofBaseApp*, int*)’ does not match any in class ‘GLWidget’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|50|error: candidates are: GLWidget::GLWidget(const GLWidget&)|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.h|50|error: GLWidget::GLWidget()|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp||In destructor ‘GLWidget::~GLWidget()’:|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|62|error: ‘makeCurrent’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|65|error: ‘QSize’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|70|error: ‘QSize’ does not name a type|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|75|error: no ‘void GLWidget::setXRotation(int)’ member function declared in class ‘GLWidget’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp||In member function ‘void GLWidget::paintGL()’:|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|94|error: request for member ‘elapsed’ in ‘time’, which is of non-class type ‘time_t ()(time_t*)throw ()’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|95|error: ‘frameRateChanged’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|97|error: request for member ‘start’ in ‘time’, which is of non-class type ‘time_t ()(time_t*)throw ()’|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|130|error: variable or field ‘mousePressEvent’ declared void|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|130|error: ‘QMouseEvent’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|130|error: ‘event’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|137|error: variable or field ‘mouseReleaseEvent’ declared void|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|137|error: ‘QMouseEvent’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|137|error: ‘event’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|144|error: variable or field ‘mouseMoveEvent’ declared void|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|144|error: ‘QMouseEvent’ was not declared in this scope|
/home/r2d2/Mahaigaina/C++/of/of_preRelease_v0.06_linux_cb_FAT/apps/examples/ofQt/src/glwidget.cpp|144|error: ‘event’ was not declared in this scope|
||=== Build finished: 37 errors, 4 warnings ===|

ah!. i added all folders under /usr/include/qt4 to “Project > build options > search directories”. I am now getting this next error

/usr/include/qt4/QtCore/qdatastream.h|49|error: #error qdatastream.h must be included before any header file that defines Status|

i searched in google but could not find anything meaningful… sorry, i am still trying to get to understand fully the linking part of the compiling and find this type of errors very confusing.

wow :smiley: works! great!

[quote author=“halfdanj”]Okay, here we go!

This is really a alpha alpha test… There are many oF functions that i havent made yet! But it shows how it can work! I have added suppot for mousePressed, moved, keyPressed etc etc… But i haven’t done it for all of functions yet.

You can download my xcode project from here: http://halfdanj.dk/ofQt/ofQt.zip

To use it, first install QT library completely on your mac.
Secondly download http://halfdanj.dk/ofQt/ofAppQtWindow.zip , and add the two files to /of_install_dir/libs/openFrameworks/app/

and then i think it should be rock’n’roll when you compile the xcode project… Though there might be some wrong hardcoded links to QT on my computer, if so, tell me!

[/quote]

Hellö halfdanj, the link is broken. Can you attach it again please?

Are there any progress with Qt and OF by the way? Anyone? thanks yo