Results 1 to 20 of 32

Thread: Suggestions/Ideas about a file browser

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Suggestions/Ideas about a file browser

    Not that I know. The only example of QDirModel usage provided with Qt is the Dir View example.
    Neither does the QDirModel documentation provide much of example usage, but the common model/view programming concept applies here too..
    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    SkripT (4th April 2006)

  3. #2
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    23
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    3
    Thanked 4 Times in 3 Posts

    Default Re: Suggestions/Ideas about a file browser

    From my experience of implementing the full-scale file browser, QT documentation is sufficient to get things working if you're familiar with Model/View architecture. If not, you probably shold start with reading the Model/View tutorial that is supplied with QT.

    BTW, there was a nice file browser example in QT3 solutions. Unfortunately it is not yet ported to QT4, causing a lot of troubles for those who need a file browser in their application.

  4. The following user says thank you to Lemming for this useful post:

    SkripT (4th April 2006)

  5. #3
    Join Date
    Mar 2006
    Posts
    172
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    30
    Thanked 2 Times in 2 Posts

    Default Re: Suggestions/Ideas about a file browser

    The simple file browser provided by jpn is a great example..but it does not have the drop facility within the listview itself...(both, on the left as well as right col. of the splitter)...ummm how would you achieve this!!

    Nupul

  6. #4
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    23
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    3
    Thanked 4 Times in 3 Posts

    Question Re: Suggestions/Ideas about a file browser

    You'll have to subclass from QListView and overload the dropEvent

    Qt Code:
    1. //Enabling the drops for the list viewport
    2. list->viewport()->setAcceptDrops( true );
    3.  
    4. void FileExplorerList::dropEvent( QDropEvent *event )
    5. {
    6. [INDENT]if ( event->mimeData()->hasUrls() )
    7. {
    8. [INDENT]
    9. //Getting the dir model of the list
    10. QDirModel *dirModel = qobject_cast<QDirModel*>( list->model() );
    11. //Dropping the mime data
    12. dirModel->dropMimeData( event->mimeData(), event->proposedAction(), parentIndex );
    13. //Note: it's up to you to get the parent index for the drop operation[/INDENT]
    14. }[/INDENT]}
    To copy to clipboard, switch view to plain text mode 

    This should work fine. Actually, there is QDirModel::setReadOnly( bool ) method as well. I'm not sure about it, but setting it to on might possible enable the default drop functionality for the dir model.

  7. The following user says thank you to Lemming for this useful post:

    nupul (5th April 2006)

Similar Threads

  1. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  2. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  3. Adding property editor file browser popup...
    By thawkins in forum Qt Tools
    Replies: 1
    Last Post: 25th April 2007, 23:03
  4. Replies: 11
    Last Post: 4th July 2006, 15:09
  5. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33

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.