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
e32cd328
Commit
e32cd328
authored
Jan 11, 2011
by
Marco Bubke
Browse files
QmlDesigner.NodeInstances: Refactor server
parent
99336fee
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp
View file @
e32cd328
...
...
@@ -155,41 +155,8 @@ void NodeInstanceServer::stopRenderTimer()
void
NodeInstanceServer
::
createScene
(
const
CreateSceneCommand
&
command
)
{
Q_ASSERT
(
!
m_declarativeView
.
data
());
m_declarativeView
=
new
QDeclarativeView
;
m_declarativeView
->
setViewportUpdateMode
(
QGraphicsView
::
NoViewportUpdate
);
m_declarativeView
->
show
();
m_declarativeView
->
setAttribute
(
Qt
::
WA_DontShowOnScreen
,
true
);
if
(
!
command
.
fileUrl
().
isEmpty
())
engine
()
->
setBaseUrl
(
command
.
fileUrl
());
addImports
(
command
.
imports
());
static_cast
<
QGraphicsScenePrivate
*>
(
QObjectPrivate
::
get
(
m_declarativeView
->
scene
()))
->
processDirtyItemsEmitted
=
true
;
QList
<
ServerNodeInstance
>
instanceList
=
createInstances
(
command
.
instances
());
reparentInstances
(
command
.
reparentInstances
());
foreach
(
const
IdContainer
&
container
,
command
.
ids
())
{
if
(
hasInstanceForId
(
container
.
instanceId
()))
instanceForId
(
container
.
instanceId
()).
setId
(
container
.
id
());
}
foreach
(
const
PropertyValueContainer
&
container
,
command
.
valueChanges
())
setInstancePropertyVariant
(
container
);
foreach
(
const
PropertyBindingContainer
&
container
,
command
.
bindingChanges
())
setInstancePropertyBinding
(
container
);
foreach
(
ServerNodeInstance
instance
,
instanceList
)
instance
.
doComponentComplete
();
m_declarativeView
->
scene
()
->
setSceneRect
(
rootNodeInstance
().
boundingRect
());
initializeDeclarativeView
();
QList
<
ServerNodeInstance
>
instanceList
=
setupScene
(
command
);
nodeInstanceClient
()
->
informationChanged
(
createAllInformationChangedCommand
(
instanceList
,
true
));
nodeInstanceClient
()
->
valuesChanged
(
createValuesChangedCommand
(
instanceList
));
...
...
@@ -807,6 +774,52 @@ void NodeInstanceServer::resetAllItems()
static_cast
<
QGraphicsScenePrivate
*>
(
QObjectPrivate
::
get
(
m_declarativeView
->
scene
()))
->
resetDirtyItem
(
item
);
}
void
NodeInstanceServer
::
initializeDeclarativeView
()
{
Q_ASSERT
(
!
m_declarativeView
.
data
());
m_declarativeView
=
new
QDeclarativeView
;
#ifndef Q_WS_MAC
m_declarativeView
->
setAttribute
(
Qt
::
WA_DontShowOnScreen
,
true
);
#endif
m_declarativeView
->
setViewportUpdateMode
(
QGraphicsView
::
NoViewportUpdate
);
m_declarativeView
->
show
();
#ifdef Q_WS_MAC
m_declarativeView
->
setAttribute
(
Qt
::
WA_DontShowOnScreen
,
true
);
#endif
}
QList
<
ServerNodeInstance
>
NodeInstanceServer
::
setupScene
(
const
CreateSceneCommand
&
command
)
{
if
(
!
command
.
fileUrl
().
isEmpty
())
engine
()
->
setBaseUrl
(
command
.
fileUrl
());
addImports
(
command
.
imports
());
static_cast
<
QGraphicsScenePrivate
*>
(
QObjectPrivate
::
get
(
m_declarativeView
->
scene
()))
->
processDirtyItemsEmitted
=
true
;
QList
<
ServerNodeInstance
>
instanceList
=
createInstances
(
command
.
instances
());
reparentInstances
(
command
.
reparentInstances
());
foreach
(
const
IdContainer
&
container
,
command
.
ids
())
{
if
(
hasInstanceForId
(
container
.
instanceId
()))
instanceForId
(
container
.
instanceId
()).
setId
(
container
.
id
());
}
foreach
(
const
PropertyValueContainer
&
container
,
command
.
valueChanges
())
setInstancePropertyVariant
(
container
);
foreach
(
const
PropertyBindingContainer
&
container
,
command
.
bindingChanges
())
setInstancePropertyBinding
(
container
);
foreach
(
ServerNodeInstance
instance
,
instanceList
)
instance
.
doComponentComplete
();
m_declarativeView
->
scene
()
->
setSceneRect
(
rootNodeInstance
().
boundingRect
());
return
instanceList
;
}
void
NodeInstanceServer
::
findItemChangesAndSendChangeCommands
()
{
static
bool
inFunction
=
false
;
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.h
View file @
e32cd328
...
...
@@ -121,6 +121,8 @@ protected:
void
startRenderTimer
();
void
slowDownRenderTimer
();
void
stopRenderTimer
();
void
initializeDeclarativeView
();
QList
<
ServerNodeInstance
>
setupScene
(
const
CreateSceneCommand
&
command
);
private:
ServerNodeInstance
m_rootNodeInstance
;
...
...
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