First starting with Qt, I urgently wanted to run it with the Visual Studio 2008 addin. I soon regretted this decision, as I wanted to compile a little (official) addon component. I ended up in digging through forums, since I’m not fit with console-based compilation (nmake, qmake, etc.), but in the end, I somehow managed to get it to compile.
And now, as I wanted to test it on some other computers (with no Visual Studio 2008 installed), I couldn’t manage to get the app up and running by half a day. Not even dependency-walker helped me out here…looks like VS links all kinds of not needed crap into the app (woo-hoo, what a rhyme!
).
So I took a short break, and remembered, that back then, in one of my University OGRE-based projects, we had the same problem – remaining unsolved (installing VS2008 redistributables didn’t help either). And then it came to me: “You want it cross platform anyway, so why not try out the Qt Creator?!“. And what should I say: installed it, compiled the addons in no time and now I can run my app on every PC…that’s sweet!
Archive for January, 2010
Qt Creator saves the day
January 31st, 2010Get class and super class
January 27th, 2010For Level Master 2000, I needed two functions:
- getClass, which I stuff in any kind of object, and it returns me its class.
- getSuperClass, which I stuff in it’s class name as string, and it returns me the class name of its parent as string.
Note that first returns the class itself, and the second one works with strings. If you need to e.g. let the second one work with classes also, just adapt it like in the first function.
All in all, you need to import these functions:
import flash.utils.getDefinitionByName; import flash.utils.getQualifiedClassName; import flash.utils.getQualifiedSuperclassName; |
And here are the two functions:
public static function getClass(obj:Object):Class { return Class(getDefinitionByName(getQualifiedClassName(obj))); } |
static public function getSuperClass(className:String):String { return getQualifiedSuperclassName(getDefinitionByName(className)); } |
Note that getSuperClass only returns its direct parent. If you need to go further up the inheritance tree, you need to call it recursively. Highest it can get is “Object”.
Naughty, naughty Qt Designer!
January 14th, 2010As briefly stated in Level Master 2000 goes Qt, Level Master 2000 uses Qt now for it’s main GUI. In able to display the Flash content, it runs a QWebView. Now, I must admit I’m fairly new to Qt, and I wanted to do most of the UI with Qt Designer, as you can see right away how it will look like.
Unfortunately, if you create your WebView with Qt Designer, look up the instance in code and want to add an object to JavaScript with
webView->page()->mainFrame()->addToJavaScriptWindowObject(...) |
it doesn’t seem to work!
After playing around a bit, I figured out, that if I create the instance of QWebView myself in code, it works…now I don’t yet know what I’ve done wrong exactly or what Qt Designer messes up, but problems like this cost a lot of time and more important: nerves. But on the other hand, it’s a big relief, as soon as you figured out how to work around
