Results 1 to 18 of 18

Thread: Custom QDirModel

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    7
    Thanked 11 Times in 8 Posts

    Default Re: Custom QDirModel

    Hi,
    I've already tried to write model you need

    My model didn't used modelProxy(i didn't know something like this exists) so i've subclassed QDirModel with own setWinFilePath etc. methods(those original aren't virtual).

    I actually left it behind because of some strange behavior i couldn't debug(it wasn't as important as time consuming).
    I had also custom iconProvider(that's in use and generates thumbnails for images for standard QDirModel) so i had to refresh model after thumbnails changes(because QDirModel have internally cached data). Model crashes on refreshing after entering/leaving my documents (i think the fact that same modelIndex can be retrieved via 2 different paths causes some recursion in QDirModels internal cache). Maybe you could figure it out - i would be glad to get it back in use.


    Maybe you can even use it as is, if you don't need refreshes.

    Attached model returns same values as QDirModel
    change theRefreshing = true to false in CWinDirModelPrivate constructor to get behavior with my computer & myDocuments. It's because i blocked added feature instead of removing whole class hoping i'll fix it later, but there's still lots of other things to do so its pending.

    Oh, almost forgot - im getting myDocuments path by
    Qt Code:
    1. QString CWinDirModel::getMyDocsPath()const
    2. {
    3. WCHAR docs[1024];
    4. LPITEMIDLIST doc = new ITEMIDLIST;
    5.  
    6. SHGetSpecialFolderLocation(qApp->activeWindow()->winId(), CSIDL_PERSONAL ,&doc);
    7. SHGetPathFromIDList(doc, docs);
    8. char cast[1024];
    9. for(int i=0; i < 1024;i++)
    10. cast[i] = docs[i];
    11. return QString(cast);
    12. }
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    See GrEEn (Graphics Effects Environment)
    http://sourceforge.net/project/platf...roup_id=232746
    a qt-based plugins oriented MDI image processing application(contains also qt plugins like styles & imageformats).

Similar Threads

  1. Custom proxy model issue
    By Khal Drogo in forum Qt Programming
    Replies: 13
    Last Post: 30th November 2007, 12:41
  2. custom plug-in widget in another custom plug-in widget.
    By MrGarbage in forum Qt Programming
    Replies: 6
    Last Post: 27th August 2007, 15:38
  3. Replies: 1
    Last Post: 5th March 2007, 20:50
  4. Custom Qt dll name
    By tony007 in forum Installation and Deployment
    Replies: 2
    Last Post: 10th March 2006, 15:29
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Qt is a trademark of The Qt Company.