aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc/QmltcTests/cpptypes/testattachedtype.cpp
blob: b44945fba02eba5d18b360df3c66db500a794805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "testattachedtype.h"

TestTypeAttached::TestTypeAttached(QObject *parent) : QObject(parent), m_count(0)
{
    ++creationCount;
}

int TestTypeAttached::creationCount = 0;

int TestTypeAttached::getAttachedCount() const
{
    return m_count.value();
}

void TestTypeAttached::setAttachedCount(int v)
{
    m_count.setValue(v);
    emit attachedCountChanged();
}

QBindable<int> TestTypeAttached::bindableAttachedCount()
{
    return QBindable<int>(&m_count);
}

int TestTypeAttached::getAttachedFormula() const
{
    return m_formula.value();
}

void TestTypeAttached::setAttachedFormula(int v)
{
    m_formula.setValue(v);
}

QBindable<int> TestTypeAttached::bindableAttachedFormula()
{
    return QBindable<int>(&m_formula);
}

QObject *TestTypeAttached::getAttachedObject() const
{
    return m_object.value();
}
void TestTypeAttached::setAttachedObject(QObject *v)
{
    m_object.setValue(v);
}
QBindable<QObject *> TestTypeAttached::bindableAttachedObject()
{
    return QBindable<QObject *>(&m_object);
}

TestType::TestType(QObject *parent) : QObject(parent) { }

TestTypeAttached *TestType::qmlAttachedProperties(QObject *parent)
{
    return new TestTypeAttached(parent);
}