Skip to content

Commit

Permalink
Add icon to watch groups.
Browse files Browse the repository at this point in the history
A folder icon is used. For empty watch groups, the folder icon is empty.

Icons made in Inkscape 1.1.2.
  • Loading branch information
cristian64 committed May 18, 2024
1 parent bd8f6b0 commit 10fcc8a
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/GUI/MemWatcher/MemWatchModel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "MemWatchModel.h"

#include <QDataStream>
#include <QIcon>
#include <QMimeData>

#include <cassert>
Expand Down Expand Up @@ -277,6 +278,12 @@ QVariant MemWatchModel::data(const QModelIndex& index, int role) const
{
if (index.column() == 0 && (role == Qt::DisplayRole || role == Qt::EditRole))
return item->getGroupName();
if (index.column() == 0 && role == Qt::DecorationRole)
{
static const QIcon s_folderIcon(":/folder.svg");
static const QIcon s_emptyFolderIcon(":/folder_empty.svg");
return item->hasChildren() ? s_folderIcon : s_emptyFolderIcon;
}
}
return {};
}
Expand Down
45 changes: 45 additions & 0 deletions Source/Resources/folder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions Source/Resources/folder_empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Source/Resources/resource.qrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
<file>folder_empty.svg</file>
<file>folder.svg</file>
<file>logo.svg</file>
</qresource>
</RCC>

0 comments on commit 10fcc8a

Please sign in to comment.