Results 1 to 2 of 2

Thread: MVC Questions

  1. #1
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Red face MVC Questions

    I need to write a QTreeView which will store an icon based that is their default an a icon when they are away and will have like other icons too. And also will have 2 colours based on what the user sets in the options menu.

    Right now I have a NickDelegate (QStyledItemDelegate) and a NickTree(QTreeView). Well so far the NickDelegate handles the text colour changing based on away and online. This is the other part that confuses me with MVC. Is where do I return the icons? Since pretty much a delegate, view, and model can all handle it (correct me if I'm wrong) has the ability. Which one do I put it.

    And how do I handle custom roles?
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MVC Questions

    The base for data is the Model. You need to provide your data from the model.
    The view arranges how data should be displayed, and asks the delegate to draw for it.

    Delegates are helpful when you want to keep your model intact and provide some modified drawing. For example you return a icon from model. In delegate you see if user is online/offline and generate a pixmap for online/offline and render it. Also you could pass online/offline icons from model also.

    Keeping the data in model helps that you dont write your own delegate. Qt provides default delegates, and if your model is well populated, it will do the drawing. Only where you want to cross the limit the default delegate provides, write your own .

Similar Threads

  1. QTextCursor::insertHtml() questions
    By 24pm in forum Qt Programming
    Replies: 0
    Last Post: 20th October 2008, 08:46
  2. Memory management questions (im new to Qt)
    By scarvenger in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2007, 08:41
  3. application design questions
    By nikita in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2006, 01:35
  4. 2 Questions about layouts
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2006, 14:54
  5. Qt related questions and thoughts about getting job
    By AlexKiriukha in forum General Discussion
    Replies: 4
    Last Post: 26th January 2006, 13:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.