search: show file type icons in addition to name in results
This commit is contained in:
parent
4b9ccc50da
commit
96fe3e08f6
@ -23,6 +23,7 @@
|
|||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QFileIconProvider>
|
||||||
Window::Window(const QVector<EntryConfig> &configs, const QString &dbpath)
|
Window::Window(const QVector<EntryConfig> &configs, const QString &dbpath)
|
||||||
{
|
{
|
||||||
this->userEntryButtons = generateEntryButtons(configs);
|
this->userEntryButtons = generateEntryButtons(configs);
|
||||||
@ -363,6 +364,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
|
|||||||
{
|
{
|
||||||
clearGrid();
|
clearGrid();
|
||||||
treeFileSearchResults.clear();
|
treeFileSearchResults.clear();
|
||||||
|
QFileIconProvider provider;
|
||||||
for(const QString &path : results)
|
for(const QString &path : results)
|
||||||
{
|
{
|
||||||
QFileInfo pathInfo(path);
|
QFileInfo pathInfo(path);
|
||||||
@ -371,6 +373,7 @@ void Window::handleSearchResults(const QVector<QString> &results)
|
|||||||
QString datestr = pathInfo.lastModified().toString(Qt::ISODate);
|
QString datestr = pathInfo.lastModified().toString(Qt::ISODate);
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem(&treeFileSearchResults);
|
QTreeWidgetItem *item = new QTreeWidgetItem(&treeFileSearchResults);
|
||||||
item->setText(0, fileName);
|
item->setText(0, fileName);
|
||||||
|
item->setIcon(0, provider.icon(pathInfo));
|
||||||
item->setText(1, absPath);
|
item->setText(1, absPath);
|
||||||
item->setText(2, datestr);
|
item->setText(2, datestr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user