2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2016-01-15 14:59:14 +01:00
|
|
|
|
2013-04-22 17:25:46 +02:00
|
|
|
#include "layoutnodeinstance.h"
|
|
|
|
|
|
2017-07-06 09:31:41 +02:00
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
2013-04-22 17:25:46 +02:00
|
|
|
namespace QmlDesigner {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
LayoutNodeInstance::LayoutNodeInstance(QQuickItem *item)
|
|
|
|
|
: QuickItemNodeInstance(item)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LayoutNodeInstance::isLayoutable() const
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LayoutNodeInstance::isResizable() const
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LayoutNodeInstance::Pointer LayoutNodeInstance::create(QObject *object)
|
|
|
|
|
{
|
|
|
|
|
QQuickItem *item = qobject_cast<QQuickItem*>(object);
|
|
|
|
|
|
|
|
|
|
Q_ASSERT(item);
|
|
|
|
|
|
|
|
|
|
Pointer instance(new LayoutNodeInstance(item));
|
|
|
|
|
|
|
|
|
|
instance->setHasContent(anyItemHasContent(item));
|
|
|
|
|
item->setFlag(QQuickItem::ItemHasContents, true);
|
|
|
|
|
|
|
|
|
|
static_cast<QQmlParserStatus*>(item)->classBegin();
|
|
|
|
|
|
|
|
|
|
instance->populateResetHashes();
|
|
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LayoutNodeInstance::refreshLayoutable()
|
|
|
|
|
{
|
|
|
|
|
if (quickItem()->parent())
|
|
|
|
|
QCoreApplication::postEvent(quickItem(), new QEvent(QEvent::LayoutRequest));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-17 17:41:18 +02:00
|
|
|
PropertyNameList LayoutNodeInstance::ignoredProperties() const
|
|
|
|
|
{
|
2016-06-20 14:36:52 +02:00
|
|
|
static const PropertyNameList properties({"move", "add", "populate"});
|
|
|
|
|
return properties;
|
2014-04-17 17:41:18 +02:00
|
|
|
}
|
|
|
|
|
|
2013-04-22 17:25:46 +02:00
|
|
|
}
|
|
|
|
|
} // namespace QmlDesigner
|