Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
dd14b75f
Commit
dd14b75f
authored
15 years ago
by
Marco Bubke
Browse files
Options
Downloads
Patches
Plain Diff
Change id removing
parent
355d5a32
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp
+23
-20
23 additions, 20 deletions
...plugins/qmldesigner/core/instances/objectnodeinstance.cpp
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
+1
-0
1 addition, 0 deletions
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
with
24 additions
and
20 deletions
src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp
+
23
−
20
View file @
dd14b75f
...
@@ -106,27 +106,30 @@ static void specialRemoveParentForQmlGraphicsItemChildren(QObject *object)
...
@@ -106,27 +106,30 @@ static void specialRemoveParentForQmlGraphicsItemChildren(QObject *object)
void
ObjectNodeInstance
::
destroy
()
void
ObjectNodeInstance
::
destroy
()
{
{
// Remove from old property
if
(
deleteHeldInstance
())
{
if
(
object
()
&&
modelNode
().
isValid
()
&&
modelNode
().
parentProperty
().
isValid
())
{
// Remove from old property
NodeAbstractProperty
parentProperty
=
modelNode
().
parentProperty
();
if
(
object
()
&&
modelNode
().
isValid
()
&&
modelNode
().
parentProperty
().
isValid
())
{
ModelNode
parentNode
=
parentProperty
.
parentModelNode
();
NodeAbstractProperty
parentProperty
=
modelNode
().
parentProperty
();
if
(
parentNode
.
isValid
()
&&
nodeInstanceView
()
->
hasInstanceForNode
(
parentNode
))
{
ModelNode
parentNode
=
parentProperty
.
parentModelNode
();
NodeInstance
parentInstance
=
nodeInstanceView
()
->
instanceForNode
(
parentNode
);
if
(
parentNode
.
isValid
()
&&
nodeInstanceView
()
->
hasInstanceForNode
(
parentNode
))
{
if
(
parentInstance
.
isQmlGraphicsItem
()
&&
isChildrenProperty
(
parentProperty
.
name
()))
{
NodeInstance
parentInstance
=
nodeInstanceView
()
->
instanceForNode
(
parentNode
);
specialRemoveParentForQmlGraphicsItemChildren
(
object
());
if
(
parentInstance
.
isQmlGraphicsItem
()
&&
isChildrenProperty
(
parentProperty
.
name
()))
{
}
else
{
specialRemoveParentForQmlGraphicsItemChildren
(
object
());
removeFromOldProperty
(
object
(),
parentInstance
.
internalObject
(),
parentProperty
.
name
());
}
else
{
removeFromOldProperty
(
object
(),
parentInstance
.
internalObject
(),
parentProperty
.
name
());
}
}
}
}
}
}
if
(
deleteHeldInstance
()
&&
object
())
{
if
(
!
m_id
.
isEmpty
())
{
if
(
!
object
()
->
objectName
().
isEmpty
())
{
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
m_id
,
0
);
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
object
()
->
objectName
(),
0
);
}
if
(
object
())
{
QObject
*
obj
=
object
();
m_object
.
clear
();
delete
obj
;
}
}
QObject
*
obj
=
object
();
m_object
.
clear
();
delete
obj
;
}
}
}
}
...
@@ -152,15 +155,15 @@ void ObjectNodeInstance::setNodeInstance(NodeInstanceView *view)
...
@@ -152,15 +155,15 @@ void ObjectNodeInstance::setNodeInstance(NodeInstanceView *view)
void
ObjectNodeInstance
::
setId
(
const
QString
&
id
)
void
ObjectNodeInstance
::
setId
(
const
QString
&
id
)
{
{
if
(
!
object
()
->
objectName
()
.
isEmpty
())
{
if
(
!
m_id
.
isEmpty
())
{
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
object
()
->
objectName
()
,
0
);
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
m_id
,
0
);
}
}
if
(
!
id
.
isEmpty
())
{
if
(
!
id
.
isEmpty
())
{
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
id
,
object
());
// will also force refresh of all bindings
context
()
->
engine
()
->
rootContext
()
->
setContextProperty
(
id
,
object
());
// will also force refresh of all bindings
}
}
object
()
->
setObjectName
(
id
)
;
m_id
=
id
;
}
}
bool
ObjectNodeInstance
::
isQmlGraphicsItem
()
const
bool
ObjectNodeInstance
::
isQmlGraphicsItem
()
const
...
...
This diff is collapsed.
Click to expand it.
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
+
1
−
0
View file @
dd14b75f
...
@@ -174,6 +174,7 @@ private:
...
@@ -174,6 +174,7 @@ private:
QHash
<
QString
,
QVariant
>
m_resetValueHash
;
QHash
<
QString
,
QVariant
>
m_resetValueHash
;
QHash
<
QString
,
NodeInstance
>
m_modelAbstractPropertyHash
;
QHash
<
QString
,
NodeInstance
>
m_modelAbstractPropertyHash
;
ModelNode
m_modelNode
;
ModelNode
m_modelNode
;
QString
m_id
;
QWeakPointer
<
NodeInstanceView
>
m_nodeInstanceView
;
QWeakPointer
<
NodeInstanceView
>
m_nodeInstanceView
;
bool
m_deleteHeldInstance
;
bool
m_deleteHeldInstance
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment