search: show file type icons in addition to name in results

这个提交包含在:
Albert S. 2018-02-10 13:59:27 +01:00
父节点 4b9ccc50da
当前提交 96fe3e08f6

查看文件

@ -23,6 +23,7 @@
#include <QDate>
#include <QHeaderView>
#include <QDesktopServices>
#include <QFileIconProvider>
Window::Window(const QVector<EntryConfig> &configs, const QString &dbpath)
{
this->userEntryButtons = generateEntryButtons(configs);
@ -363,6 +364,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
{
clearGrid();
treeFileSearchResults.clear();
QFileIconProvider provider;
for(const QString &path : results)
{
QFileInfo pathInfo(path);
@ -371,6 +373,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
QString datestr = pathInfo.lastModified().toString(Qt::ISODate);
QTreeWidgetItem *item = new QTreeWidgetItem(&treeFileSearchResults);
item->setText(0, fileName);
item->setIcon(0, provider.icon(pathInfo));
item->setText(1, absPath);
item->setText(2, datestr);