mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add a static 'instance()' member for the Photos model.
This will make referencing it from a few places more easy. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f53b5c4d3f
commit
eb24d90c8e
3 changed files with 10 additions and 3 deletions
|
@ -8,7 +8,13 @@ void DivePictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
|
||||||
QStyledItemDelegate::paint(painter, option, index);
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
DivePictureModel::DivePictureModel(QObject *parent): QAbstractTableModel(parent)
|
DivePictureModel *DivePictureModel::instance()
|
||||||
|
{
|
||||||
|
static DivePictureModel* self = new DivePictureModel();
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
DivePictureModel::DivePictureModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,13 @@
|
||||||
class DivePictureModel : public QAbstractTableModel {
|
class DivePictureModel : public QAbstractTableModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DivePictureModel(QObject *parent);
|
static DivePictureModel *instance();
|
||||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
void updateDivePictures(int divenr);
|
void updateDivePictures(int divenr);
|
||||||
private:
|
private:
|
||||||
|
DivePictureModel();
|
||||||
int numberOfPictures;
|
int numberOfPictures;
|
||||||
// Currently, load the images on the fly
|
// Currently, load the images on the fly
|
||||||
// Later, use a thread to load the images
|
// Later, use a thread to load the images
|
||||||
|
|
|
@ -32,7 +32,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
weightModel(new WeightModel(this)),
|
weightModel(new WeightModel(this)),
|
||||||
cylindersModel(CylindersModel::instance()),
|
cylindersModel(CylindersModel::instance()),
|
||||||
editMode(NONE),
|
editMode(NONE),
|
||||||
divePictureModel(new DivePictureModel(this))
|
divePictureModel(DivePictureModel::instance())
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue