2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2011-07-06 15:48:52 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2011-07-06 15:48:52 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
2011-06-09 15:50:48 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2012-09-19 15:57:22 +02:00
|
|
|
#ifndef QuickITEMNODEINSTANCE_H
|
|
|
|
#define QuickITEMNODEINSTANCE_H
|
2011-06-09 15:50:48 +02:00
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2014-04-16 17:12:16 +02:00
|
|
|
#include "objectnodeinstance.h"
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2012-09-19 15:57:22 +02:00
|
|
|
#include <QQuickItem>
|
2011-08-31 18:27:41 +02:00
|
|
|
#include <designersupport.h>
|
2011-06-09 15:50:48 +02:00
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
namespace Internal {
|
|
|
|
|
2014-04-16 17:12:16 +02:00
|
|
|
class QuickItemNodeInstance : public ObjectNodeInstance
|
2011-06-09 15:50:48 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-09-19 15:57:22 +02:00
|
|
|
typedef QSharedPointer<QuickItemNodeInstance> Pointer;
|
|
|
|
typedef QWeakPointer<QuickItemNodeInstance> WeakPointer;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2012-09-19 15:57:22 +02:00
|
|
|
~QuickItemNodeInstance();
|
2011-06-09 15:50:48 +02:00
|
|
|
|
|
|
|
static Pointer create(QObject *objectToBeWrapped);
|
2014-04-16 17:12:16 +02:00
|
|
|
static void createEffectItem(bool createEffectItem);
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance) override;
|
2013-05-28 14:14:07 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QQuickItem *contentItem() const override;
|
|
|
|
bool hasContent() const override;
|
2013-05-28 14:14:07 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QRectF contentItemBoundingBox() const override;
|
|
|
|
QRectF boundingRect() const override;
|
|
|
|
QTransform contentTransform() const override;
|
|
|
|
QTransform sceneTransform() const override;
|
|
|
|
double opacity() const override;
|
|
|
|
double rotation() const override;
|
|
|
|
double scale() const override;
|
|
|
|
QPointF transformOriginPoint() const override;
|
|
|
|
double zValue() const override;
|
|
|
|
QPointF position() const override;
|
|
|
|
QSizeF size() const override;
|
|
|
|
QTransform transform() const override;
|
|
|
|
QTransform contentItemTransform() const override;
|
|
|
|
int penWidth() const override;
|
2014-04-16 17:12:16 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QImage renderImage() const override;
|
|
|
|
QImage renderPreviewImage(const QSize &previewImageSize) const override;
|
2014-04-16 17:12:16 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void updateAllDirtyNodesRecursive() override;
|
2014-04-16 17:12:16 +02:00
|
|
|
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QObject *parent() const override;
|
|
|
|
QList<ServerNodeInstance> childItems() const override;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void reparent(const ObjectNodeInstance::Pointer &oldParentInstance, const PropertyName &oldParentProperty, const ObjectNodeInstance::Pointer &newParentInstance, const PropertyName &newParentProperty) override;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void setPropertyVariant(const PropertyName &name, const QVariant &value) override;
|
|
|
|
void setPropertyBinding(const PropertyName &name, const QString &expression) override;
|
|
|
|
QVariant property(const PropertyName &name) const override;
|
|
|
|
void resetProperty(const PropertyName &name) override;
|
2014-04-16 17:12:16 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
bool isAnchoredByChildren() const override;
|
|
|
|
bool hasAnchor(const PropertyName &name) const override;
|
|
|
|
QPair<PropertyName, ServerNodeInstance> anchor(const PropertyName &name) const override;
|
|
|
|
bool isAnchoredBySibling() const override;
|
|
|
|
bool isResizable() const override;
|
|
|
|
bool isMovable() const override;
|
|
|
|
bool isQuickItem() const override;
|
2013-04-15 13:28:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QList<ServerNodeInstance> stateInstances() const override;
|
2014-04-16 17:12:16 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void doComponentComplete() override;
|
2013-05-28 14:14:07 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QList<QQuickItem*> allItemsRecursive() const override;
|
2014-04-16 12:33:50 +02:00
|
|
|
|
2011-06-09 15:50:48 +02:00
|
|
|
protected:
|
2014-04-16 17:12:16 +02:00
|
|
|
explicit QuickItemNodeInstance(QQuickItem*);
|
2012-09-19 15:57:22 +02:00
|
|
|
QQuickItem *quickItem() const;
|
2013-04-18 18:22:15 +02:00
|
|
|
void setMovable(bool movable);
|
|
|
|
void setResizable(bool resizable);
|
2014-04-16 17:12:16 +02:00
|
|
|
void setHasContent(bool hasContent);
|
|
|
|
DesignerSupport *designerSupport() const;
|
|
|
|
Qt5NodeInstanceServer *qt5NodeInstanceServer() const;
|
|
|
|
void updateDirtyNodesRecursive(QQuickItem *parentItem) const;
|
|
|
|
void updateAllDirtyNodesRecursive(QQuickItem *parentItem) const;
|
|
|
|
QRectF boundingRectWithStepChilds(QQuickItem *parentItem) const;
|
|
|
|
void resetHorizontal();
|
|
|
|
void resetVertical();
|
|
|
|
QList<ServerNodeInstance> childItemsForChild(QQuickItem *item) const;
|
|
|
|
void refresh();
|
|
|
|
static bool anyItemHasContent(QQuickItem *quickItem);
|
|
|
|
static bool childItemsHaveContent(QQuickItem *quickItem);
|
|
|
|
|
|
|
|
double x() const;
|
|
|
|
double y() const;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
|
|
|
private: //variables
|
2013-05-28 14:14:07 +02:00
|
|
|
QPointer<QQuickItem> m_contentItem;
|
2011-06-09 15:50:48 +02:00
|
|
|
bool m_isResizable;
|
|
|
|
bool m_isMovable;
|
2014-04-16 17:12:16 +02:00
|
|
|
bool m_hasHeight;
|
|
|
|
bool m_hasWidth;
|
|
|
|
bool m_hasContent;
|
|
|
|
double m_x;
|
|
|
|
double m_y;
|
|
|
|
double m_width;
|
|
|
|
double m_height;
|
|
|
|
static bool s_createEffectItem;
|
2011-06-09 15:50:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace QmlDesigner
|
|
|
|
|
2012-09-19 15:57:22 +02:00
|
|
|
#endif // QuickITEMNODEINSTANCE_H
|
2011-06-09 15:50:48 +02:00
|
|
|
|