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. How to make files preview like in native file manager?
Forum Updated to NodeBB v4.3 + New Features

How to make files preview like in native file manager?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 4 Posters 2.5k 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.
  • SGaistS SGaist

    Hi and welcome to devnet,

    A starting point would be:

    • QListView
    • QFileSystemModel
    • QFileIconProvider

    And maybe:

    • QStyledItemDelegate
    T Offline
    T Offline
    Tundra
    wrote on last edited by
    #3

    @SGaist , thank you for answer!
    I found that QFileIconProvider can to provide small icons (it provides them for QDirModel and the QFileSystemModel classes).
    How to get Large ones with thumbnails and etc - I didn't find yet :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #4

      What makes you think you can't return bigger icons ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      2
      • SGaistS SGaist

        What makes you think you can't return bigger icons ?

        T Offline
        T Offline
        Tundra
        wrote on last edited by Tundra
        #5

        @SGaist I'm trying to find a way to get not just bigger ones, but "Large icons" in Windows Explorer terminology which are thumbnails for videos and images and icons for other files :)
        I tried QFileIconProvider ::icon() ─ it returns a small icon assotiated for file's extension.
        Maybe I do something wrong...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Can you show the code you are using ?

          On a side note, QStyledItemDelegate gives you more freedom to paint what you want to get in your view.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          1
          • SGaistS SGaist

            Can you show the code you are using ?

            On a side note, QStyledItemDelegate gives you more freedom to paint what you want to get in your view.

            T Offline
            T Offline
            Tundra
            wrote on last edited by Tundra
            #7

            @SGaist , I tested it by this code (node.originalPath is file path in QString):

            QList<QTreeWidgetItem *> items;
            QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0, QStringList(node.originalPath));
            QFileIconProvider provider;
            item->setIcon(0, QIcon(provider.icon(node.originalPath)));
            items.append(item);
            treeWidget->insertTopLevelItems(0, items);
            

            @SGaist said in How to make files preview like in native file manager?:

            On a side note, QStyledItemDelegate gives you more freedom to paint what you want to get in your view.

            Doesn't it mean that I should to render thumbnails by my own code for any new file format? It seems too expensive. I was hoping to get icons which are already generated by Windows Explorer (even for odt, pdf, mp4 etc, not only popular images) :).

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #8

              QFileIconProvider only returns you the default icons according to the extension. Anything else you have to write on your own.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              T 1 Reply Last reply
              1
              • Christian EhrlicherC Christian Ehrlicher

                QFileIconProvider only returns you the default icons according to the extension. Anything else you have to write on your own.

                T Offline
                T Offline
                Tundra
                wrote on last edited by Tundra
                #9

                @Christian-Ehrlicher Thank you for answer =) Does QFileDialog just call native Windows dialog (It shows thumbnails pretty nice)?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Tundra
                  wrote on last edited by Tundra
                  #10

                  Thank you all!
                  Problem is resolved!
                  I used this: http://www.cplusplus.com/forum/windows/100661/

                  T 1 Reply Last reply
                  1
                  • T Tundra

                    Thank you all!
                    Problem is resolved!
                    I used this: http://www.cplusplus.com/forum/windows/100661/

                    T Offline
                    T Offline
                    Tundra
                    wrote on last edited by
                    #11

                    Upd: Be careful ─ code in http://www.cplusplus.com/forum/windows/100661/ conteins an error. There should be resource releasing:

                    pIExtract->Release();
                    
                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      RobertZamors56
                      Banned
                      wrote on last edited by
                      #12
                      This post is deleted!
                      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