mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Remove superfluous QScopedPointer<>s in singletons
There was a curious pattern of singletons being implemented based on QScopedPointer<>s. This is an unnecessary level of indirection: The lifetime of the smart pointer is the same as that of the pointed-to object. Therefore, replace these pointers by the respective objects. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4c4222d611
commit
130f109442
6 changed files with 12 additions and 12 deletions
|
@ -18,8 +18,8 @@ void gettextFromC::reset(void)
|
||||||
|
|
||||||
gettextFromC *gettextFromC::instance()
|
gettextFromC *gettextFromC::instance()
|
||||||
{
|
{
|
||||||
static QScopedPointer<gettextFromC> self(new gettextFromC());
|
static gettextFromC self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" const char *trGettext(const char *text)
|
extern "C" const char *trGettext(const char *text)
|
||||||
|
|
|
@ -31,8 +31,8 @@ QVariant CylindersModel::headerData(int section, Qt::Orientation orientation, in
|
||||||
CylindersModel *CylindersModel::instance()
|
CylindersModel *CylindersModel::instance()
|
||||||
{
|
{
|
||||||
|
|
||||||
static QScopedPointer<CylindersModel> self(new CylindersModel());
|
static CylindersModel self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString get_cylinder_string(cylinder_t *cyl)
|
static QString get_cylinder_string(cylinder_t *cyl)
|
||||||
|
|
|
@ -412,8 +412,8 @@ DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTable
|
||||||
|
|
||||||
DivePlannerPointsModel *DivePlannerPointsModel::instance()
|
DivePlannerPointsModel *DivePlannerPointsModel::instance()
|
||||||
{
|
{
|
||||||
static QScopedPointer<DivePlannerPointsModel> self(new DivePlannerPointsModel());
|
static DivePlannerPointsModel self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::emitDataChanged()
|
void DivePlannerPointsModel::emitDataChanged()
|
||||||
|
|
|
@ -32,8 +32,8 @@ Qt::ItemFlags GasSelectionModel::flags(const QModelIndex &index) const
|
||||||
|
|
||||||
GasSelectionModel *GasSelectionModel::instance()
|
GasSelectionModel *GasSelectionModel::instance()
|
||||||
{
|
{
|
||||||
static QScopedPointer<GasSelectionModel> self(new GasSelectionModel());
|
static GasSelectionModel self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Remove this #include here when the issue below is fixed.
|
//TODO: Remove this #include here when the issue below is fixed.
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
TankInfoModel *TankInfoModel::instance()
|
TankInfoModel *TankInfoModel::instance()
|
||||||
{
|
{
|
||||||
static QScopedPointer<TankInfoModel> self(new TankInfoModel());
|
static TankInfoModel self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &TankInfoModel::biggerString() const
|
const QString &TankInfoModel::biggerString() const
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
WSInfoModel *WSInfoModel::instance()
|
WSInfoModel *WSInfoModel::instance()
|
||||||
{
|
{
|
||||||
static QScopedPointer<WSInfoModel> self(new WSInfoModel());
|
static WSInfoModel self;
|
||||||
return self.data();
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WSInfoModel::insertRows(int row, int count, const QModelIndex &parent)
|
bool WSInfoModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||||
|
|
Loading…
Reference in a new issue