~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
}
80
80
 
81
81
QTransform QuickItemNodeInstance::transform() const
82
 
{
83
 
    return transformForItem(quickItem(), nodeInstanceServer());
 
82
{   if (quickItem()->parentItem())
 
83
        return DesignerSupport::parentTransform(quickItem());
 
84
 
 
85
    return QTransform();
84
86
}
85
87
 
86
88
 
146
148
    return QRectF();
147
149
}
148
150
 
 
151
static QTransform contentItemTransformForItem(QQuickItem *item, NodeInstanceServer *nodeInstanceServer)
 
152
{
 
153
    QTransform toParentTransform = DesignerSupport::parentTransform(item);
 
154
    if (item->parentItem() && !nodeInstanceServer->hasInstanceForObject(item->parentItem())) {
 
155
 
 
156
        return transformForItem(item->parentItem(), nodeInstanceServer) * toParentTransform;
 
157
    }
 
158
 
 
159
    return toParentTransform;
 
160
}
 
161
 
149
162
QTransform QuickItemNodeInstance::contentItemTransform() const
150
163
{
151
 
    return DesignerSupport::parentTransform(contentItem());
 
164
    if (contentItem())
 
165
        return contentItemTransformForItem(contentItem(), nodeInstanceServer());
 
166
 
 
167
    return QTransform();
152
168
}
153
169
 
154
170
 
172
188
 
173
189
void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty)
174
190
{
175
 
    if (oldParentInstance && oldParentInstance->isPositioner()) {
 
191
    if (oldParentInstance && oldParentInstance->isLayoutable()) {
176
192
        setInLayoutable(false);
177
193
        setMovable(true);
178
194
    }
179
195
 
180
196
    ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
181
197
 
182
 
    if (newParentInstance && newParentInstance->isPositioner()) {
 
198
    if (newParentInstance && newParentInstance->isLayoutable()) {
183
199
        setInLayoutable(true);
184
200
        setMovable(false);
185
201
    }
186
202
 
187
 
    if (oldParentInstance && oldParentInstance->isPositioner() && !(newParentInstance && newParentInstance->isPositioner())) {
 
203
    if (oldParentInstance && oldParentInstance->isLayoutable() && !(newParentInstance && newParentInstance->isLayoutable())) {
188
204
        if (!hasBindingForProperty("x"))
189
205
            setPropertyVariant("x", x());
190
206