Tuesday, March 9, 2010

Qt Fun and Games

I love being a noob again, all the fun and exitement of trolling forums for hours and ripping large clumps of hair out.

I have been doing my usual thing of diving head first into a project and over the last couple of day been trying to create a basic custom OpenGL widget for Qt on windows 7.  Now remember I think these are all windows related bugs.

The first peice of Qt awesomeness I found is that when you compile any of the test custom widgets you can't actually use them in the designer.  Why? Because apparently Qt Creator and Designer have been compiled with MSCV 2005, and by default Qt uses mingGW as it's compiler, making the plugin binaries incompatible with the main app.  So to fix this you either need to download the Creator/Designer src and compile it yourself with minGW (which looks to be a Shit Onion all of it's own).  Or create your own build chain using MS nMake for which there is little information on and no help.

So I thought "Who needs the designer, I can just code all the UI for now" *vomit*. So I started trying to load my plugin into another test app, then awesomeness part two came along.

Qt seems to have a way of interrogating DLLs similar to .Net reflection, but for this to happen you need to invoke the Meta-Object-Compiler (moc).  This generates moc src files that are used for linkage.  And of course my project wasn't generating them.  So after some trolling I found this post which pointed to the path to moc.exe being wrong in the make files.  That's a Bingo!  I changed the forward slashes to back slashes in my make files and it worked fine.

It really seems Windows was kinda forgotton by the Qt developers...