Icons: cache small edit icon

In analogy to the trash-icons, cache a small rendered version of
the edit icon. This will be used in the dive-site table. Rename
the icon alias from "duplicate-edit-icon" to "edit-icon", as
it actually is not a duplicated. The other "edit" icon is an
"undo" icon!

Move the accessor functions to cleanertablemode.cpp. This is not
the ideal place, but since the functions are declared in
cleanertablemodel.h it's certainly better than the old place
(models.cpp)!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-16 11:14:42 +01:00 committed by Dirk Hohndel
parent 434990dcd4
commit d4282e2689
5 changed files with 20 additions and 16 deletions

View file

@ -2,6 +2,24 @@
#include "cleanertablemodel.h"
#include "core/metrics.h"
const QPixmap &trashIcon()
{
static QPixmap trash = QPixmap(":list-remove-icon").scaledToHeight(defaultIconMetrics().sz_small);
return trash;
}
const QPixmap &trashForbiddenIcon()
{
static QPixmap trash = QPixmap(":list-remove-disabled-icon").scaledToHeight(defaultIconMetrics().sz_small);
return trash;
}
const QPixmap &editIcon()
{
static QPixmap edit = QPixmap(":edit-icon").scaledToHeight(defaultIconMetrics().sz_small);
return edit;
}
CleanerTableModel::CleanerTableModel(QObject *parent) : QAbstractTableModel(parent)
{
}

View file

@ -9,6 +9,7 @@
/* Retrieve the trash icon pixmap, common to most table models */
const QPixmap &trashIcon();
const QPixmap &trashForbiddenIcon();
const QPixmap &editIcon();
/* When using a QAbstractTableModel, consider using this instead
* of the default implementation, as it's easyer to setup the columns

View file

@ -11,20 +11,6 @@
#include <QLocale>
// initialize the trash icon if necessary
const QPixmap &trashIcon()
{
static QPixmap trash = QPixmap(":list-remove-icon").scaledToHeight(defaultIconMetrics().sz_small);
return trash;
}
const QPixmap &trashForbiddenIcon()
{
static QPixmap trash = QPixmap(":list-remove-disabled-icon").scaledToHeight(defaultIconMetrics().sz_small);
return trash;
}
Qt::ItemFlags GasSelectionModel::flags(const QModelIndex&) const
{
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;

View file

@ -44,7 +44,6 @@ slots:
void repopulate();
};
class LanguageModel : public QAbstractListModel {
Q_OBJECT
public:

View file

@ -83,7 +83,7 @@
<file alias="edit-clear-icon">icons/edit-undo.svg</file>
<file alias="show-icon">icons/go-top.svg</file>
<file alias="filter-close">icons/process-stop.svg</file>
<file alias="duplicate-edit-icon">icons/edit-circled.svg</file>
<file alias="edit-icon">icons/edit-circled.svg</file>
<file alias="globe-icon">icons/Emblem-earth.svg</file>
<file alias="geotag-icon">icons/geocode.svg</file>
<file alias="photo-in-icon">icons/duringPhoto.png</file>