2022-08-11 13:02:07 +08:00
|
|
|
// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2017-08-03 11:28:43 +08:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include "base/dsingleton.h"
|
|
|
|
|
|
2021-02-26 17:23:56 +08:00
|
|
|
class Singleton : public QObject
|
|
|
|
|
, public Dtk::Core::DSingleton<Singleton>
|
2017-08-03 11:28:43 +08:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
friend class Dtk::Core::DSingleton<Singleton>;
|
2021-02-26 17:23:56 +08:00
|
|
|
|
2017-08-03 11:28:43 +08:00
|
|
|
public:
|
2018-02-28 14:48:48 +08:00
|
|
|
explicit Singleton(QObject *parent = nullptr);
|
2017-08-03 11:28:43 +08:00
|
|
|
|
2021-08-18 13:23:41 +08:00
|
|
|
QAtomicInt count;
|
2017-08-03 11:28:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MultiSingletonTester : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2018-02-28 14:48:48 +08:00
|
|
|
explicit MultiSingletonTester(QObject *parent = nullptr);
|
2017-08-03 11:28:43 +08:00
|
|
|
|
2021-08-18 13:23:41 +08:00
|
|
|
int count() const;
|
|
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
2017-08-03 11:28:43 +08:00
|
|
|
void run();
|
|
|
|
|
};
|