Results 1 to 8 of 8

Thread: Cusomize QFileDialog: add new column to the file view of the QFileDialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cusomize QFileDialog: add new column to the file view of the QFileDialog

    Yes, try overwriting the index() method and handle creation of indexes for your column yourself.
    Another thing, just to make sure it isn't he cause, would be to always return 5 in the columnCount method,

    Cheers,
    _

  2. #2
    Join Date
    Mar 2014
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Cusomize QFileDialog: add new column to the file view of the QFileDialog

    I have overwritten the index() method and handle the custom column in the proxy model itself.
    Now a custom column is displayed with a custom header and custom contents. perfect.
    But I have another problem with the selection of a file.
    I cannot choose a file anymore. I can select a file, but no file is displayed in the "File Name" QLineEdit and the "OK" Button is disabled.
    The following methods are also overwritten in the QFileDialogProxyModel class: (the signature i have already checked)
    Qt Code:
    1. virtual QItemSelection mapSelectionToSource ( const QItemSelection & proxySelection ) const;
    2. virtual QItemSelection mapSelectionFromSource ( const QItemSelection & sourceSelection ) const;
    3.  
    4. QItemSelection QFileDialogProxyModel::mapSelectionFromSource ( const QItemSelection & sourceSelection ) const{
    5. return QSortFilterProxyModel::mapSelectionFromSource(sourceSelection);
    6. }
    7.  
    8.  
    9.  
    10. QItemSelection QFileDialogProxyModel::mapSelectionToSource ( const QItemSelection & proxySelection ) const{
    11. return QSortFilterProxyModel::mapSelectionToSource(proxySelection);
    12. }
    To copy to clipboard, switch view to plain text mode 
    but the debugger doesn´t stop here at no time.
    I expected that I get a debugger stop at Line 5 or Line 11.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cusomize QFileDialog: add new column to the file view of the QFileDialog

    Maybe also needs to implement mapFromSource/mapToSource?

    Cheers,
    _

Similar Threads

  1. How to save file with QFileDialog
    By pnikolov in forum Qt Programming
    Replies: 11
    Last Post: 1st June 2012, 10:23
  2. QFileDialog and file extension
    By calhal in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2010, 12:54
  3. QFileDialog and file sequences
    By peterhillman in forum Qt Programming
    Replies: 5
    Last Post: 24th November 2007, 10:16
  4. QFileDialog no thumnail view?
    By sincnarf in forum Qt Programming
    Replies: 8
    Last Post: 14th October 2007, 09:51
  5. copy file/s from QFileDialog
    By raphaelf in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 14:26

Tags for this Thread

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.