mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 01:53:24 +00:00
Cleanup: use QScopedPointer for DiveComputerManagementDialog::model
Not necessary to do own memory management. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0bc9edf855
commit
f54764cdbc
2 changed files with 5 additions and 7 deletions
|
@ -6,8 +6,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
|
||||||
DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f),
|
DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
model(0)
|
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
init();
|
init();
|
||||||
|
@ -20,9 +19,8 @@ DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget *parent, Qt::
|
||||||
|
|
||||||
void DiveComputerManagementDialog::init()
|
void DiveComputerManagementDialog::init()
|
||||||
{
|
{
|
||||||
delete model;
|
model.reset(new DiveComputerModel(dcList.dcMap));
|
||||||
model = new DiveComputerModel(dcList.dcMap);
|
ui.tableView->setModel(model.data());
|
||||||
ui.tableView->setModel(model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveComputerManagementDialog *DiveComputerManagementDialog::instance()
|
DiveComputerManagementDialog *DiveComputerManagementDialog::instance()
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#define DIVECOMPUTERMANAGEMENTDIALOG_H
|
#define DIVECOMPUTERMANAGEMENTDIALOG_H
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "ui_divecomputermanagementdialog.h"
|
#include "ui_divecomputermanagementdialog.h"
|
||||||
|
#include "qt-models/divecomputermodel.h"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class DiveComputerModel;
|
|
||||||
|
|
||||||
class DiveComputerManagementDialog : public QDialog {
|
class DiveComputerManagementDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -24,7 +24,7 @@ slots:
|
||||||
private:
|
private:
|
||||||
explicit DiveComputerManagementDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
explicit DiveComputerManagementDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||||
Ui::DiveComputerManagementDialog ui;
|
Ui::DiveComputerManagementDialog ui;
|
||||||
DiveComputerModel *model;
|
QScopedPointer<DiveComputerModel> model;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIVECOMPUTERMANAGEMENTDIALOG_H
|
#endif // DIVECOMPUTERMANAGEMENTDIALOG_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue