PDA

View Full Version : Few questions



ComaWhite
19th March 2009, 03:28
I really love the videos. I hope to see more in the future especially on QtScript and QtDBus maybe? Anyways I have a few questions on the MVC.

I noticed a few examples here and there are quite different. Like for example the ones on Qt's examples has a normal class that doesn't inherit from anything not even QObject and injected into the model. And some don't do this and inject directly into the model if you understand what I'm saying. Which is the most better approach or what?

Correct me if I'm wrong. If a delegate is mainly for giving the "special effects". Would it be more appropriate to handle it returning it in the delegate than letting a model or view handle that?

wysota
19th March 2009, 10:23
Like for example the ones on Qt's examples has a normal class that doesn't inherit from anything not even QObject and injected into the model. And some don't do this and inject directly into the model if you understand what I'm saying. Which is the most better approach or what?
Could you rephrase your question? Or give a short example of what you mean as it's hard to understand what classes you are talking about.


Correct me if I'm wrong. If a delegate is mainly for giving the "special effects".
It's not. It's for changing the way a single item behaves.

Would it be more appropriate to handle it returning it in the delegate than letting a model or view handle that?
Handle what? What is "it"?

ComaWhite
19th March 2009, 20:46
Here is one of Qt's examples. http://doc.trolltech.com/4.5/itemviews-simpletreemodel.html

It uses a regular class called TreeItem. To insert information and to get info from it. Like some examples I have found on the net or have read in books don't always use this kind of approach when doing MVC.

I forgot what the last question was suppose to handle :(

wysota
19th March 2009, 23:28
It uses a regular class called TreeItem. To insert information and to get info from it. Like some examples I have found on the net or have read in books don't always use this kind of approach when doing MVC.

Ok, but what is the question?

A model operates on some data... it can either be generated on the fly or stored somewhere outside the model or in the model and the item objects are there exactly to store the data in the model... I'm not sure what you're asking about :)

Maybe this article helps:
http://blog.wysota.eu.org/index.php/2007/12/17/itemviews-data-redundancy/

ComaWhite
20th March 2009, 05:10
Thank you that helped clear a few things. :D:o