Okay, so in my last post I posted a duplicate of my question over on the Qt Dev Forums. Thankfully someone answered quickly and I was able to implement a solution. Mind you, it still has all sorts of kinks and functions that need to be fixed or realized, but it's a start. Considering how much time I spent trying to get this to work, I figured that this is one of those things that I really want to share with the community, so before I delve in deep, I thought I'd stop for a second and post the code to my test application.
All this app does is show a QTreeView using QML. Essentially, it is a boiled down plugin for QML. The QTreeView class is derived from QWidget. The QDeclarativeView where my QML "lives" only accepts elements that are derived from QGraphicsObject. To solve this problem I have wrapped the QTreeView in a QGraphicsProxyWidget.
It sounds complicated, but it really isn't. Without ever having seen it done however, it was quite difficult to discover, especially for the nooborn like me. Answers are much simpler to find once you know what questions to ask. IMHO it is important to always remember this fact lest we start to labor under the misconception that we are actually intelligent beings or that we ourselves are awesome because we know so muich. What follows are the terrible diseases that go by many names including "noobphobia", "lorditoverallsia", "assholiosis", and "I-have-forgotten-plain-english-but-I-think-that-using-technical-terms-makes-me-look-smart-so-no-one-knows-what-I-am-saying-blindness". Just take a look around the forums and through the comments all over the web and you will see that these diseases are spreading like that virus that causes people to turn into flesh eating zombies in the movies. I think I'd prefer the zombies....
Anyway, here is the code. Enjoy. If you have any questions, I'll try to answer, but I'm a noob too, so no promises peeps!
I am using Qt Creator 5.0 Based on Qt 4.8.1 (64 bit) according to Help/About Qt Creator...
This quick test app was created by going to File/New File or Project.../Applications/Qt Quick Application (Built-in Elements). Named the project QTreeTest. I chose only "Desktop" as my target.
The files I am going to share are:
I tried to post the code directly to Blogger and it got all wonky of course, so here is a link to a Google Docs folder instead. Enjoy!
LINK TO ALL THE FILES
NOTE: In order to assign the "treeView" a "hide" state I had to nest it within another rectangle and assign the hide state to the id of that rectangle. The TreeView will reject direct state assignments.
I sure hope this helps somebody. I'm going to come back and clean this up a bit on Monday. Right now, it is almost 6:00 PM and it is FRIDAY! Woo hoo! I am outta here!