Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
a31ac153
Commit
a31ac153
authored
Sep 23, 2010
by
Thomas Hartmann
Browse files
QmlDesigner.NodeInstances: reparenting and componentComplete
Set the parent if no parentItem exists Call componentComplete
parent
fff4c2b2
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/designercore/include/nodeinstance.h
View file @
a31ac153
...
...
@@ -141,6 +141,8 @@ public:
static
void
registerDeclarativeTypes
();
void
doComponentComplete
();
QString
id
()
const
;
#ifdef QTCREATOR_TEST
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp
View file @
a31ac153
...
...
@@ -644,6 +644,11 @@ void NodeInstance::registerDeclarativeTypes()
// qmlRegisterType<QmlDesigner::Internal::QmlPropertyChangesObject>();
}
void
NodeInstance
::
doComponentComplete
()
{
}
QString
NodeInstance
::
id
()
const
{
return
m_nodeInstance
->
id
();
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
View file @
a31ac153
...
...
@@ -140,7 +140,10 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model)
*/
void
NodeInstanceView
::
nodeCreated
(
const
ModelNode
&
createdNode
)
{
loadNode
(
createdNode
);
NodeInstance
instance
=
loadNode
(
createdNode
);
if
(
instance
.
isValid
())
instance
.
doComponentComplete
();
}
/*! \brief Notifing the view that a node was created.
...
...
@@ -401,6 +404,9 @@ void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList)
foreach
(
const
BindingProperty
&
property
,
node
.
bindingProperties
())
instanceForNode
(
node
).
setPropertyBinding
(
property
.
name
(),
property
.
expression
());
}
foreach
(
NodeInstance
instance
,
m_objectInstanceHash
.
values
())
instance
.
doComponentComplete
();
}
// TODO: Set base state as current model state
...
...
src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp
View file @
a31ac153
...
...
@@ -381,6 +381,9 @@ void ObjectNodeInstance::removeFromOldProperty(QObject *object, QObject *oldPare
nodeInstanceView
()
->
instanceForObject
(
oldParent
).
resetProperty
(
oldParentProperty
);
}
}
if
(
object
&&
object
->
parent
())
object
->
setParent
(
0
);
}
void
ObjectNodeInstance
::
addToNewProperty
(
QObject
*
object
,
QObject
*
newParent
,
const
QString
&
newParentProperty
)
...
...
@@ -400,6 +403,11 @@ void ObjectNodeInstance::addToNewProperty(QObject *object, QObject *newParent, c
property
.
write
(
objectToVariant
(
object
));
}
QGraphicsObject
*
graphicsObject
=
qobject_cast
<
QGraphicsObject
*>
(
object
);
if
(
object
&&
!
(
graphicsObject
&&
graphicsObject
->
parentItem
()))
object
->
setParent
(
newParent
);
Q_ASSERT
(
objectToVariant
(
object
).
isValid
());
}
...
...
@@ -972,6 +980,11 @@ NodeInstance ObjectNodeInstance::nodeInstanceParentForObject(QObject *currentObj
return
nodeInstanceParentForObject
(
parentObject
);
}
void
ObjectNodeInstance
::
doComponentComplete
()
{
}
}
}
src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h
View file @
a31ac153
...
...
@@ -179,6 +179,9 @@ public:
NodeInstance
nodeInstanceParentForObject
(
QObject
*
currentObject
)
const
;
virtual
void
doComponentComplete
();
protected:
static
QObject
*
createInstance
(
const
NodeMetaInfo
&
metaInfo
,
QDeclarativeContext
*
parentContext
);
...
...
src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp
View file @
a31ac153
...
...
@@ -286,6 +286,12 @@ void QmlGraphicsItemNodeInstance::resetVertical()
setPropertyVariant
(
"height"
,
qmlGraphicsItem
()
->
implicitHeight
());
}
void
QmlGraphicsItemNodeInstance
::
doComponentComplete
()
{
if
(
qmlGraphicsItem
())
static_cast
<
QDeclarativeParserStatus
*>
(
qmlGraphicsItem
())
->
componentComplete
();
}
int
QmlGraphicsItemNodeInstance
::
penWidth
()
const
{
QDeclarativeRectangle
*
rectangle
=
qobject_cast
<
QDeclarativeRectangle
*>
(
object
());
...
...
@@ -337,6 +343,11 @@ void QmlGraphicsItemNodeInstance::resetProperty(const QString &name)
}
}
void
QmlGraphicsItemNodeInstance
::
reparent
(
const
NodeInstance
&
oldParentInstance
,
const
QString
&
oldParentProperty
,
const
NodeInstance
&
newParentInstance
,
const
QString
&
newParentProperty
)
{
GraphicsObjectNodeInstance
::
reparent
(
oldParentInstance
,
oldParentProperty
,
newParentInstance
,
newParentProperty
);
}
//void QmlGraphicsItemNodeInstance::updateAnchors()
//{
// NodeAnchors anchors(modelNode());
...
...
src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.h
View file @
a31ac153
...
...
@@ -60,19 +60,22 @@ public:
QVariant
property
(
const
QString
&
name
)
const
;
void
resetProperty
(
const
QString
&
name
);
void
reparent
(
const
NodeInstance
&
oldParentInstance
,
const
QString
&
oldParentProperty
,
const
NodeInstance
&
newParentInstance
,
const
QString
&
newParentProperty
);
int
penWidth
()
const
;
bool
hasAnchor
(
const
QString
&
name
)
const
;
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
bool
isAnchoredBySibling
()
const
;
bool
isAnchoredByChildren
()
const
;
void
doComponentComplete
();
protected:
QmlGraphicsItemNodeInstance
(
QDeclarativeItem
*
item
,
bool
hasContent
);
QDeclarativeItem
*
qmlGraphicsItem
()
const
;
QDeclarativeAnchors
*
anchors
()
const
;
void
resetHorizontal
();
void
resetVertical
();
void
resetVertical
();
private:
//variables
bool
m_hasHeight
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment