Results 1 to 4 of 4

Thread: QSqlQueryModel -> QTreeView

  1. #1

    Unhappy QSqlQueryModel -> QTreeView

    Hello,
    i have problem with make tree model from flat sql data (by parent_id), i dont find simple example.
    I must use proxy model ? Or its any new feautures for QSqlQueryModel ?

    thx for help

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSqlQueryModel -> QTreeView

    You have to implement a proxy model. It's not that hard (although not trivial in this particular case), believe me.

  3. #3

    Default Re: QSqlQueryModel -> QTreeView

    Quote Originally Posted by wysota View Post
    You have to implement a proxy model. It's not that hard (although not trivial in this particular case), believe me.

    and exist any example?? again lost

    i must make 'recruisive foreach'?
    Last edited by smrtak; 23rd August 2008 at 15:11.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSqlQueryModel -> QTreeView

    I have the code that does something like that but I can't show it to you I can give you a hint though. Think how to map indexes between a flat model and a hierarchical one. Write down the solution on a piece of paper and then implement mapFromIndex() and mapToIndex() according to your notes. The rest should be easy.

Similar Threads

  1. QTreeView repaint
    By graeme in forum Qt Programming
    Replies: 17
    Last Post: 13th March 2012, 13:27
  2. QDirModel and QTreeView cut and paste
    By Micawber in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2008, 20:16
  3. QTreeView help
    By bepaald in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2007, 21:22
  4. background image in QTreeView
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2007, 06:25
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.