Line | Source Code | Coverage |
---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
4 | ** Contact: http://www.qt-project.org/legal | - |
5 | ** | - |
6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and Digia. For licensing terms and | - |
14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
24 | ** | - |
25 | ** In addition, as a special exception, Digia gives you certain additional | - |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
28 | ** | - |
29 | ** GNU General Public License Usage | - |
30 | ** Alternatively, this file may be used under the terms of the GNU | - |
31 | ** General Public License version 3.0 as published by the Free Software | - |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
33 | ** packaging of this file. Please review the following information to | - |
34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
36 | ** | - |
37 | ** | - |
38 | ** $QT_END_LICENSE$ | - |
39 | ** | - |
40 | ****************************************************************************/ | - |
41 | | - |
42 | #include "qvariant.h" | - |
43 | | - |
44 | #include "qsizepolicy.h" | - |
45 | #include "qwidget.h" | - |
46 | | - |
47 | #include "private/qvariant_p.h" | - |
48 | #include <private/qmetatype_p.h> | - |
49 | | - |
50 | QT_BEGIN_NAMESPACE | - |
51 | | - |
52 | namespace { | - |
53 | static void construct(QVariant::Private *x, const void *copy) | - |
54 | { | - |
55 | switch (x->type) { | - |
56 | case QVariant::SizePolicy: | - |
57 | v_construct<QSizePolicy>(x, copy); executed (the execution status of this line is deduced): v_construct<QSizePolicy>(x, copy); | - |
58 | break; executed: break; Execution Count:6 | 6 |
59 | default: | - |
60 | qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type); never executed (the execution status of this line is deduced): QMessageLogger("kernel/qwidgetsvariant.cpp", 60, __PRETTY_FUNCTION__).warning("Trying to construct an instance of an invalid type, type id: %i", x->type); | - |
61 | x->type = QVariant::Invalid; never executed (the execution status of this line is deduced): x->type = QVariant::Invalid; | - |
62 | return; | 0 |
63 | } | - |
64 | x->is_null = !copy; executed (the execution status of this line is deduced): x->is_null = !copy; | - |
65 | } executed: } Execution Count:6 | 6 |
66 | | - |
67 | static void clear(QVariant::Private *d) | - |
68 | { | - |
69 | switch (d->type) { | - |
70 | case QVariant::SizePolicy: | - |
71 | v_clear<QSizePolicy>(d); executed (the execution status of this line is deduced): v_clear<QSizePolicy>(d); | - |
72 | break; executed: break; Execution Count:6 | 6 |
73 | default: | - |
74 | Q_ASSERT(false); never executed (the execution status of this line is deduced): qt_noop(); | - |
75 | return; | 0 |
76 | } | - |
77 | | - |
78 | d->type = QVariant::Invalid; executed (the execution status of this line is deduced): d->type = QVariant::Invalid; | - |
79 | d->is_null = true; executed (the execution status of this line is deduced): d->is_null = true; | - |
80 | d->is_shared = false; executed (the execution status of this line is deduced): d->is_shared = false; | - |
81 | } executed: } Execution Count:6 | 6 |
82 | | - |
83 | | - |
84 | static bool isNull(const QVariant::Private *) | - |
85 | { | - |
86 | return false; executed: return false; Execution Count:1 | 1 |
87 | } | - |
88 | | - |
89 | static bool compare(const QVariant::Private *a, const QVariant::Private *b) | - |
90 | { | - |
91 | Q_ASSERT(a->type == b->type); never executed (the execution status of this line is deduced): qt_noop(); | - |
92 | switch(a->type) { | - |
93 | case QVariant::SizePolicy: | - |
94 | return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b); never executed: return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b); | 0 |
95 | default: | - |
96 | Q_ASSERT(false); never executed (the execution status of this line is deduced): qt_noop(); | - |
97 | } | 0 |
98 | return false; never executed: return false; | 0 |
99 | } | - |
100 | | - |
101 | static bool convert(const QVariant::Private *d, int type, void *result, bool *ok) | - |
102 | { | - |
103 | Q_UNUSED(d); never executed (the execution status of this line is deduced): (void)d;; | - |
104 | Q_UNUSED(type); never executed (the execution status of this line is deduced): (void)type;; | - |
105 | Q_UNUSED(result); never executed (the execution status of this line is deduced): (void)result;; | - |
106 | if (ok) | 0 |
107 | *ok = false; never executed: *ok = false; | 0 |
108 | return false; never executed: return false; | 0 |
109 | } | - |
110 | | - |
111 | #if !defined(QT_NO_DEBUG_STREAM) | - |
112 | static void streamDebug(QDebug dbg, const QVariant &v) | - |
113 | { | - |
114 | QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr()); executed (the execution status of this line is deduced): QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr()); | - |
115 | switch (d->type) { | - |
116 | case QVariant::SizePolicy: | - |
117 | dbg.nospace() << *v_cast<QSizePolicy>(d); executed (the execution status of this line is deduced): dbg.nospace() << *v_cast<QSizePolicy>(d); | - |
118 | break; executed: break; Execution Count:1 | 1 |
119 | default: | - |
120 | dbg.nospace() << "QMetaType::Type(" << d->type << ")"; never executed (the execution status of this line is deduced): dbg.nospace() << "QMetaType::Type(" << d->type << ")"; | - |
121 | } | 0 |
122 | } executed: } Execution Count:1 | 1 |
123 | #endif | - |
124 | | - |
125 | static const QVariant::Handler widgets_handler = { | - |
126 | construct, | - |
127 | clear, | - |
128 | isNull, | - |
129 | #ifndef QT_NO_DATASTREAM | - |
130 | 0, | - |
131 | 0, | - |
132 | #endif | - |
133 | compare, | - |
134 | convert, | - |
135 | 0, | - |
136 | #if !defined(QT_NO_DEBUG_STREAM) | - |
137 | streamDebug | - |
138 | #else | - |
139 | 0 | - |
140 | #endif | - |
141 | }; | - |
142 | | - |
143 | #define QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES(MetaTypeName, MetaTypeId, RealName) \ | - |
144 | QT_METATYPE_INTERFACE_INIT(RealName), | - |
145 | | - |
146 | static const QMetaTypeInterface qVariantWidgetsHelper[] = { | - |
147 | QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES) | - |
148 | }; | - |
149 | | - |
150 | #undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES | - |
151 | | - |
152 | } // namespace | - |
153 | | - |
154 | extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper; | - |
155 | | - |
156 | void qRegisterWidgetsVariant() | - |
157 | { | - |
158 | qRegisterMetaType<QWidget*>(); executed (the execution status of this line is deduced): qRegisterMetaType<QWidget*>(); | - |
159 | qMetaTypeWidgetsHelper = qVariantWidgetsHelper; executed (the execution status of this line is deduced): qMetaTypeWidgetsHelper = qVariantWidgetsHelper; | - |
160 | QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler); executed (the execution status of this line is deduced): QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler); | - |
161 | } executed: } Execution Count:351 | 351 |
162 | Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) executed: } Execution Count:136 | 136 |
163 | | - |
164 | QT_END_NAMESPACE | - |
165 | | - |
| | |