Results 1 to 5 of 5

Thread: Complicated QListView

  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

    Default Complicated QListView

    I have a complicated QListView. It's just like a QColumnView. Where I have 3 views that use 1 model to get the information. So when 1 changes the others change with it. I cannot use a QColumnView due to each view being in separate tabs in the configuration dialogue.

    I'm trying to implement a custom QAbstractItemModel on the QListView instead of the List model. The problem is, that the parents don't really work the way they are in a normal TreeView. I have some of it figured out. But some I have no idea how to go about doing 3 models to interact with each other on the same model. Because the data has to be persistent between each other. So if one changes the other has to change with it.

    Currently, I do not know how to tell which view it is calling what data. Do I use the parent() at all? When I insert/remove data does the parent QModelIndex() be used and what not.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Complicated QListView

    I think, but I'm not sure, that you're looking for setRootIndex
    http://doc.qt.nokia.com/4.6/qabstrac...l#setRootIndex

    When you select an item in your first listview (in the first tab), then use that item as the rootitem for your second listview (in the second tab) etc.
    Or did you mean something else?

  3. #3
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Complicated QListView

    I'm not sure I understand your question, but if you want three seperate views on the same data, create one model and set it on those three different views. When the model changes, all attached views will change to reflect the new data, but the data will be maintained in a single place - the model.

  4. #4
    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

    Default Re: Complicated QListView

    Yeah, each view will be displaying separate data. I'm going to be using a QAbstractItemModel. The only issue is. It's a little unusual for this time of data I'm trying to work with. Trying to write the parent function in it and I'm confused on how to write it. Since the data will be stored like so.

    Qt Code:
    1. QList<QPair<Identity*,NetworkManager*>>
    To copy to clipboard, switch view to plain text mode 

    And each Network is contained in the NetworkManager.

    While a traditional Tree model will just use a single item for the tree.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  5. #5
    Join Date
    May 2010
    Posts
    1
    Qt products
    Qt4

    Default Re: Complicated QListView

    hi
    i wrote a QListView. i want to show me the item when i clicked on a member of listview.
    i have QString string;
    i mean my listview has some QStrings(forexample 5 Strings) when i clicked on 3th item, strign changed to that item.
    what's its signal?how can i write connect ?(sorry i dont know english very well)
    thanks
    Last edited by simin; 21st May 2010 at 08:49.

Similar Threads

  1. Replies: 28
    Last Post: 9th March 2010, 08:59
  2. QListView
    By Yayati.Ekbote in forum Qt Programming
    Replies: 2
    Last Post: 1st March 2010, 11:41
  3. help needed with complicated project
    By Muzz in forum Newbie
    Replies: 12
    Last Post: 15th February 2008, 09:54
  4. QListView
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 14:14
  5. [QT3] QListView
    By incapacitant in forum Qt Programming
    Replies: 5
    Last Post: 29th January 2006, 14:31

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.