diff options
Diffstat (limited to 'framework/actions/context.cpp')
-rw-r--r-- | framework/actions/context.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/framework/actions/context.cpp b/framework/actions/context.cpp index 8f370a0b..45b660a9 100644 --- a/framework/actions/context.cpp +++ b/framework/actions/context.cpp | |||
@@ -29,6 +29,20 @@ Context::Context(QObject *parent) | |||
29 | 29 | ||
30 | } | 30 | } |
31 | 31 | ||
32 | Context::Context(const Context &other) | ||
33 | : QObject() | ||
34 | { | ||
35 | *this = other; | ||
36 | } | ||
37 | |||
38 | Context &Context::operator=(const Context &other) | ||
39 | { | ||
40 | for (const auto &p : other.availableProperties()) { | ||
41 | setProperty(p, other.property(p)); | ||
42 | } | ||
43 | return *this; | ||
44 | } | ||
45 | |||
32 | void Context::clear() | 46 | void Context::clear() |
33 | { | 47 | { |
34 | auto meta = metaObject(); | 48 | auto meta = metaObject(); |
@@ -41,6 +55,20 @@ void Context::clear() | |||
41 | } | 55 | } |
42 | } | 56 | } |
43 | 57 | ||
58 | QSet<QByteArray> Context::availableProperties() const | ||
59 | { | ||
60 | QSet<QByteArray> names; | ||
61 | auto meta = metaObject(); | ||
62 | for (auto i = meta->propertyOffset(); i < meta->propertyCount(); i++) { | ||
63 | auto property = meta->property(i); | ||
64 | names << property.name(); | ||
65 | } | ||
66 | for (const auto &p : dynamicPropertyNames()) { | ||
67 | names << p; | ||
68 | } | ||
69 | return names; | ||
70 | } | ||
71 | |||
44 | QDebug operator<<(QDebug dbg, const Kube::Context &context) | 72 | QDebug operator<<(QDebug dbg, const Kube::Context &context) |
45 | { | 73 | { |
46 | dbg << "Kube::Context {\n"; | 74 | dbg << "Kube::Context {\n"; |
@@ -55,3 +83,9 @@ QDebug operator<<(QDebug dbg, const Kube::Context &context) | |||
55 | dbg << "\n}"; | 83 | dbg << "\n}"; |
56 | return dbg; | 84 | return dbg; |
57 | } | 85 | } |
86 | |||
87 | QDebug operator<<(QDebug dbg, const Kube::ContextWrapper &context) | ||
88 | { | ||
89 | dbg << context.context; | ||
90 | return dbg; | ||
91 | } | ||