How to make files preview like in native file manager?
-
Hello.
Tell me please a way how to make previews of specified files on Qt + Windows.
I want to make previews like in Windows Explorer when you select View→Lafge Icons (an image below). In general files won't be located in the same folder.Thank you for attention.
-
Hi and welcome to devnet,
A starting point would be:
And maybe:
-
What makes you think you can't return bigger icons ?
-
@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... -
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.
-
@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) :).
-
QFileIconProvider only returns you the default icons according to the extension. Anything else you have to write on your own.
-
@Christian-Ehrlicher Thank you for answer =) Does QFileDialog just call native Windows dialog (It shows thumbnails pretty nice)?
-
Thank you all!
Problem is resolved!
I used this: http://www.cplusplus.com/forum/windows/100661/ -
This post is deleted!