mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
d4282e2689
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>
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef CLEANERTABLEMODEL_H
|
|
#define CLEANERTABLEMODEL_H
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QStringList>
|
|
#include <QPixmap>
|
|
|
|
/* 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
|
|
* and headers.
|
|
* Most subsurface classes uses this one to save loads of lines
|
|
* of code and share a consistent layout. */
|
|
|
|
class CleanerTableModel : public QAbstractTableModel {
|
|
Q_OBJECT
|
|
public:
|
|
explicit CleanerTableModel(QObject *parent = 0);
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
|
|
|
protected:
|
|
void setHeaderDataStrings(const QStringList &headers);
|
|
signals:
|
|
|
|
/* instead of using QMessageBox directly, wire a QWidget to this signal and display the result.
|
|
* This is because the QModels will be used from the Mobile version and the desktop version. */
|
|
void warningMessage(const QString& title, const QString& message);
|
|
|
|
private:
|
|
QStringList headers;
|
|
};
|
|
|
|
/* Has the string value changed */
|
|
#define CHANGED() \
|
|
(vString = value.toString()) != data(index, role).toString()
|
|
|
|
#endif
|