Results 1 to 6 of 6

Thread: QFileDialog and file sequences

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QFileDialog and file sequences

    OK - beginning to get there.

    I subclassed QSortFilterProxyModel and reimplemented QSortFilterProxyModel::filterAcceptsRow to check for other files in the sequence.

    Somehow QFileDialog::setProxyModel seems to have stopped selected files appearing in the File name LineEdit and I still haven't been able to change the filenames in the current directory view, but it's a start.

    EDIT: Seems that even doing
    Qt Code:
    1. QFileDialog::setProxyModel(new QSortFilterProxyModel() )
    To copy to clipboard, switch view to plain text mode 
    prevents files clicked on in the current directory view appearing as the selected file. Everything else seems to work. Any ideas?
    Last edited by peterhillman; 12th August 2007 at 09:39. Reason: updated contents

  2. #2
    Join Date
    Aug 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QFileDialog and file sequences

    Problem solved - more or less, but it isn't very clean.

    • QT 4.3.2 fixes a bug with the FilterProxyModels which meant that selected files wouldn't appear in the line editor.
    • Since files don't pass through QSortFilterProxyModel::filterAcceptsRow in any predictable order, a list of files seen in each sequence is required to ensure only the one 'standin file' is accepted for each sequence.
    • The FileSystemModel doesn't support DisplayRoles (changing the text for the DisplayRole would be the neat way of getting the name of the sequence to display instead of the standin file) - a very ugly workaround was to create a displayDelegate and override displayText to draw the sequence name rather than the standin. Annoyingly, this approach means the sequence name can't be longer than the name of the standin.
    • A queued signal connection from changedSelection is required to display (via selectFile) the sequence name rather than the standin file when it's clicked.


    Not nice, not pretty, but it works.

Similar Threads

  1. How to read text only as it is from file
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2007, 08:47
  2. Replies: 4
    Last Post: 13th June 2007, 15:37
  3. QFileDialog in Qt designer
    By tpf80 in forum Qt Tools
    Replies: 1
    Last Post: 17th May 2007, 00:41
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.