Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Subclassing QAbstractProxyModel to work with QFileDialog

Subclassing QAbstractProxyModel to work with QFileDialog

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kepz
    wrote on last edited by
    #1

    Hello,
    I would like to create a custom QFileDialog that has a special behaviour:

    I'd like the files in the directory to be represented as 1 file if they belong to such a sequence:

    @file0.jpg
    file1.jpg
    file2.jpg
    ...@

    would be represented as only 1 item: @file#.jpg@

    Also whenever the user would select file#.jpg I'd like the file dialog to return all the associated file names.

    After reading all the Qt documentation I find it really hard to pull-off.
    I figured I'd have to subclass @QAbstractProxyModel@ and call @QFileDialog::setProxyModel@ but I don't really know what to do with the @QAbstractProxyModel@
    Does anybody have any idea on how to get started on this?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Santosh Reddy
      wrote on last edited by
      #2

      As far as model is concerned you will need to implement rowCount(), data(), mapToSource() and mapFromSource().

      Also you will need to have a custom QFileDialog because it has to return multiple files when selected.

      SS

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kepz
        wrote on last edited by
        #3

        Do you mean deriving QFileDialog or make my own file dialog?
        In the later case, how would you custom the view so it has a behaviour as such :

        • when the user clicks the directory, it show the content of the directory, it does not unfold an item in a QtreeView

        Here is a picture of what I'd like it to be,
        http://img20.imageshack.us/img20/2613/desired.png

        and here is what I have with QTreeView:

        http://img822.imageshack.us/img822/7787/minep.png

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved