forked from qt-creator/qt-creator
QmlPuppet: Move functions from QuickItemNodeInstance to QmlPrivateGate
No need to use private API in QuickItemNodeInstance. Change-Id: I5450ea41571c2787081cc88f59494a28eea5546c Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
e1a19ba229
commit
f86eb9b78c
@@ -29,18 +29,15 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "quickitemnodeinstance.h"
|
#include "quickitemnodeinstance.h"
|
||||||
|
|
||||||
#include "qt5nodeinstanceserver.h"
|
#include "qt5nodeinstanceserver.h"
|
||||||
|
|
||||||
|
#include <qmlprivategate.h>
|
||||||
|
|
||||||
#include <QQmlProperty>
|
#include <QQmlProperty>
|
||||||
#include <QQmlExpression>
|
#include <QQmlExpression>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <private/qquicktext_p.h>
|
|
||||||
#include <private/qquicktextinput_p.h>
|
|
||||||
#include <private/qquicktextedit_p.h>
|
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -193,35 +190,6 @@ bool QuickItemNodeInstance::hasContent() const
|
|||||||
return childItemsHaveContent(quickItem());
|
return childItemsHaveContent(quickItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disableNativeTextRendering(QQuickItem *item)
|
|
||||||
{
|
|
||||||
QQuickText *text = qobject_cast<QQuickText*>(item);
|
|
||||||
if (text)
|
|
||||||
text->setRenderType(QQuickText::QtRendering);
|
|
||||||
|
|
||||||
QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(item);
|
|
||||||
if (textInput)
|
|
||||||
textInput->setRenderType(QQuickTextInput::QtRendering);
|
|
||||||
|
|
||||||
QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(item);
|
|
||||||
if (textEdit)
|
|
||||||
textEdit->setRenderType(QQuickTextEdit::QtRendering);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void disableTextCursor(QQuickItem *item)
|
|
||||||
{
|
|
||||||
foreach (QQuickItem *childItem, item->childItems())
|
|
||||||
disableTextCursor(childItem);
|
|
||||||
|
|
||||||
QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(item);
|
|
||||||
if (textInput)
|
|
||||||
textInput->setCursorVisible(false);
|
|
||||||
|
|
||||||
QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(item);
|
|
||||||
if (textEdit)
|
|
||||||
textEdit->setCursorVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QuickItemNodeInstance::doComponentComplete()
|
void QuickItemNodeInstance::doComponentComplete()
|
||||||
{
|
{
|
||||||
ObjectNodeInstance::doComponentComplete();
|
ObjectNodeInstance::doComponentComplete();
|
||||||
@@ -230,7 +198,7 @@ void QuickItemNodeInstance::doComponentComplete()
|
|||||||
if (contentItemProperty.isValid())
|
if (contentItemProperty.isValid())
|
||||||
m_contentItem = contentItemProperty.read().value<QQuickItem*>();
|
m_contentItem = contentItemProperty.read().value<QQuickItem*>();
|
||||||
|
|
||||||
disableTextCursor(quickItem());
|
QmlPrivateGate::disableTextCursor(quickItem());
|
||||||
|
|
||||||
DesignerSupport::emitComponentCompleteSignalForAttachedProperty(quickItem());
|
DesignerSupport::emitComponentCompleteSignalForAttachedProperty(quickItem());
|
||||||
|
|
||||||
@@ -481,7 +449,7 @@ void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) co
|
|||||||
updateDirtyNodesRecursive(childItem);
|
updateDirtyNodesRecursive(childItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
disableNativeTextRendering(parentItem);
|
QmlPrivateGate::disableNativeTextRendering(parentItem);
|
||||||
DesignerSupport::updateDirtyNode(parentItem);
|
DesignerSupport::updateDirtyNode(parentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,9 +41,12 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include <private/qobject_p.h>
|
#include <private/qobject_p.h>
|
||||||
|
#include <private/qqmltimer_p.h>
|
||||||
#include <private/qquicktransition_p.h>
|
#include <private/qquicktransition_p.h>
|
||||||
#include <private/qquickanimation_p.h>
|
#include <private/qquickanimation_p.h>
|
||||||
#include <private/qqmltimer_p.h>
|
#include <private/qquicktext_p.h>
|
||||||
|
#include <private/qquicktextinput_p.h>
|
||||||
|
#include <private/qquicktextedit_p.h>
|
||||||
|
|
||||||
#include <designersupport.h>
|
#include <designersupport.h>
|
||||||
|
|
||||||
@@ -512,6 +515,7 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName)
|
void keepBindingFromGettingDeleted(QObject *object, QQmlContext *context, const PropertyName &propertyName)
|
||||||
{
|
{
|
||||||
DesignerCustomObjectData::keepBindingFromGettingDeleted(object, context, propertyName);
|
DesignerCustomObjectData::keepBindingFromGettingDeleted(object, context, propertyName);
|
||||||
@@ -522,6 +526,34 @@ bool objectWasDeleted(QObject *object)
|
|||||||
return QObjectPrivate::get(object)->wasDeleted;
|
return QObjectPrivate::get(object)->wasDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void disableNativeTextRendering(QQuickItem *item)
|
||||||
|
{
|
||||||
|
QQuickText *text = qobject_cast<QQuickText*>(item);
|
||||||
|
if (text)
|
||||||
|
text->setRenderType(QQuickText::QtRendering);
|
||||||
|
|
||||||
|
QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(item);
|
||||||
|
if (textInput)
|
||||||
|
textInput->setRenderType(QQuickTextInput::QtRendering);
|
||||||
|
|
||||||
|
QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(item);
|
||||||
|
if (textEdit)
|
||||||
|
textEdit->setRenderType(QQuickTextEdit::QtRendering);
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableTextCursor(QQuickItem *item)
|
||||||
|
{
|
||||||
|
foreach (QQuickItem *childItem, item->childItems())
|
||||||
|
disableTextCursor(childItem);
|
||||||
|
|
||||||
|
QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(item);
|
||||||
|
if (textInput)
|
||||||
|
textInput->setCursorVisible(false);
|
||||||
|
|
||||||
|
QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(item);
|
||||||
|
if (textEdit)
|
||||||
|
textEdit->setCursorVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
ComponentCompleteDisabler::ComponentCompleteDisabler()
|
ComponentCompleteDisabler::ComponentCompleteDisabler()
|
||||||
{
|
{
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QQmlListReference>
|
#include <QQmlListReference>
|
||||||
|
#include <QQuickItem>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -93,6 +94,8 @@ public:
|
|||||||
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
|
void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
|
||||||
|
|
||||||
bool objectWasDeleted(QObject *object);
|
bool objectWasDeleted(QObject *object);
|
||||||
|
void disableNativeTextRendering(QQuickItem *item);
|
||||||
|
void disableTextCursor(QQuickItem *item);
|
||||||
|
|
||||||
} // namespace QmlPrivateGate
|
} // namespace QmlPrivateGate
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user