| 1 |
// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <QObject> |
| 8 |
|
| 9 |
#include "base/dsingleton.h" |
| 10 |
|
| 11 |
class Singleton : public QObject |
| 12 |
, public Dtk::Core::DSingleton<Singleton> |
| 13 |
{ |
| 14 |
Q_OBJECT |
| 15 |
friend class Dtk::Core::DSingleton<Singleton>; |
| 16 |
|
| 17 |
public: |
| 18 |
explicit Singleton(QObject *parent = nullptr); |
| 19 |
|
| 20 |
QAtomicInt count; |
| 21 |
}; |
| 22 |
|
| 23 |
class MultiSingletonTester : public QObject |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
public: |
| 27 |
explicit MultiSingletonTester(QObject *parent = nullptr); |
| 28 |
|
| 29 |
int count() const; |
| 30 |
|
| 31 |
public Q_SLOTS: |
| 32 |
void run(); |
| 33 |
}; |