Results 1 to 4 of 4

Thread: [NewBe] A Contact List with QTreeView or Widget

  1. #1
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Question [NewBe] A Contact List with QTreeView or Widget

    Hello Qt Centre Community,

    I'm new to the whole Qt-Framework and although I've read countless tutorials
    I haven't found where to really begin when trying to do what I want to do.

    What I want to do is implement a QTreeView to display my contact-list, but
    change the whole appearance of the Tree/List.

    To really customize the whole thing i have come to the (possibly wrong)
    conclusion that I will need delegates and/or override the print event.

    But I have no clue as to where to start. I realized that it isn't the smartest
    move to try to create my custom contact list and learning how to
    work with delegates and print events at the same time, but rather
    start learning that first and doing my own thing later.

    My questions I guess are thus:
    • Do I need both delegates and the print event to make a contact list that lists more than an icon and a string in one entry and expends an item to view a little bit more (or embiggen the icon) when it is selected?
    • I want different behavior in parent and child items (e.g. indentation)
    • Is QTreeView the right Widget to customize or does QListView have Child and Parent Nodes that you can collapse and expand too? Which one of the two (or possibly a completely other solution) should i use?
    • What should I learn first and whats the best source/tutorial to learn that specific topic and the implementation?
    • How should I use the stuff that I need first in order to grasp the theory completely?


    I realize that some might think those questions signs of laziness, and unwillingness to research.
    But I really don't know where to start first and what i really need to make what I want

    So please be patient with me and try to help me out a little.

    (With my qt knowledge base being what it is at the moment i could realize the whole project right here and now, but
    it wouldn't look good and miss a lot of functionality that i wish it to have. I just want to do as much as possible
    right from the start, so that I won't have to rework as much later on)

    Kind regards, comuun




    EDIT: Omg sorry, for some reason either my brain didn't want to see the newbie section on this board!! Could someone be so kind as to move the thread into the right section? Thanks a million

    EDIT2: I read somewhere that QToolBox might be a good solution, too? I really don't know wether i should use ToolBox TreeView ListView and whatnot :'(
    Last edited by comuun; 1st November 2013 at 22:44.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: [NewBe] A Contact List with QTreeView or Widget

    You probably won't have to touch QTreeView:aintEvent() unless you need to change how the tree visuals are painted.
    You will need delegates to change how the cells/rows are rendered.

    QTreeView is very likely the right approach when displaying a unknown amount of data in a tree like structure but you could also have a look at QColumnView which displays tree like data in a "drill-down" kind of fashion.

    My suggestion would be to start with learning how to handle the QPainter API but by using simple QWidget painting first.
    I.e. create a custom widget and implement paintEvent()

    Once you have reach a state where you are satisfied with the visualization, you can easily take that into delegates and are then free to concentrate on the delegate and model/view specific things.

    Cheers,
    _

  3. The following 2 users say thank you to anda_skoa for this useful post:

    ChrisW67 (2nd November 2013), comuun (2nd November 2013)

  4. #3
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Windows Android

    Default Re: [NewBe] A Contact List with QTreeView or Widget

    Thank you for taking the time to read my long question
    and thank you even more for giving such a wonderful answer!

    Like you said I will concentrate on the QPainter API first
    and move on to Delegates afterwards.

    I finally how to approach the problem.
    Thank you!!

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: [NewBe] A Contact List with QTreeView or Widget

    QColumnView... How, after all this time, have I nver noticed that before? Thanks anda_skoa.

Similar Threads

  1. Replies: 0
    Last Post: 1st June 2011, 15:17
  2. How to create collapsing type contact list
    By The Storm in forum Qt Programming
    Replies: 38
    Last Post: 10th October 2009, 13:34
  3. Newbe questions
    By Doug Broadwell in forum Newbie
    Replies: 2
    Last Post: 18th January 2009, 12:42
  4. newbe question about signals / slots
    By Walsi in forum Qt Programming
    Replies: 19
    Last Post: 20th April 2007, 10:54
  5. 4.1.1 to 4.2 upgrade, newbe question.
    By Doug Broadwell in forum Installation and Deployment
    Replies: 2
    Last Post: 10th October 2006, 19:30

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.