~ubuntu-sdk-team/ubuntu-ui-toolkit/armedFlakes

« back to all changes in this revision

Viewing changes to src/Ubuntu/Components/plugin/ucapplication.h

  • Committer: Tarmac
  • Author(s): Zsombor Egri, Christian Dywan
  • Date: 2016-02-02 18:54:21 UTC
  • mfrom: (1826.1.8 staging)
  • Revision ID: tarmac-20160202185421-jcaz8nu6w9wcpot1
Link singletons used as context properties in root context of the QML Engine to the engine instance. Fixes: https://bugs.launchpad.net/bugs/1539558.

Approved by ubuntu-sdk-build-bot, Zoltan Balogh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
private:
34
34
    Q_DISABLE_COPY(UCApplication)
35
35
    explicit UCApplication(QObject* parent = 0);
36
 
 
 
36
    ~UCApplication();
37
37
 
38
38
public:
39
 
    static UCApplication& instance() {
40
 
        static UCApplication instance;
41
 
        return instance;
 
39
    static UCApplication *instance(QObject *parent = Q_NULLPTR) {
 
40
        if (!m_app) {
 
41
            Q_ASSERT(parent);
 
42
            m_app = new UCApplication(parent);
 
43
        }
 
44
        return m_app;
42
45
    }
43
46
 
44
47
    // getter
53
56
private:
54
57
    QQmlContext* m_context;
55
58
    QObject* m_inputMethod;
 
59
    static UCApplication *m_app;
56
60
 
57
61
Q_SIGNALS:
58
62
    void applicationNameChanged();