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. [Solved] List files like QFileDialog

[Solved] List files like QFileDialog

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.9k 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.
  • H Offline
    H Offline
    HuXiKa
    wrote on last edited by
    #1

    Hi,

    I have the "following":http://huxi.uw.hu/hidden/Qt/got.jpg (I know, it's bad :D) view. I would like to list the files I drag and drop / browse and add to the model like "this":http://huxi.uw.hu/hidden/Qt/want.jpg (with the option to switch detailed / normal mode). I was wondering if there was an easy way to achieve this. Currently I have my own subclass of QTreeView with drag and drop (the first, really bad looking one), and I tried to look for easy solutions (like QFileSystemModel), but none of them could achive this. So my questions are:

    1: Is there an easy way to achive this view, or
    2: How could I make the view look like the one in the picture (I mean the non-detailed list of files, the detailed is easy with QTreeView I guess, but I don't know how to make QListView have multiple columns like this).

    Thanks in advance!

    If you can find faults of spelling in the text above, you can keep them.

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      You need using QListView class
      for detailed / normal mode you can change viewMode property:

      @enum QListView::ViewMode@

      bq.
      QListView::ListMode -The items are laid out using TopToBottom flow, with Small size and Static movement
      QListView::IconMode - The items are laid out using LeftToRight flow, with Large size and Free movement

      --
      Vasiliy

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        For a detailed view, yiou need a QTreeView or a QTableView.
        QFileDialog uses a QTreeView for detailed mode and a QListView for normalMode.

        Have a look at the implementation of QFileDialog to see, how it is done

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HuXiKa
          wrote on last edited by
          #4

          Vass thank you, I have no idea how I slipped over that. That solved everything :)
          Thanks Gerolf for confirming my thoughts, and I've checked QFileDialog sources too, it works and looks perfect now.

          If you can find faults of spelling in the text above, you can keep them.

          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