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
Tobias Hunger
qt-creator
Commits
14d1edd5
Commit
14d1edd5
authored
Feb 11, 2010
by
Marco Bubke
Browse files
Cleanup QmlStateNodeInstance
parent
e8d4b898
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/core/include/nodeinstance.h
View file @
14d1edd5
...
...
@@ -131,6 +131,10 @@ public:
int
penWidth
()
const
;
void
activateState
();
void
deactivateState
();
void
refreshState
();
private:
// functions
NodeInstance
(
const
QSharedPointer
<
Internal
::
ObjectNodeInstance
>
&
abstractInstance
);
...
...
src/plugins/qmldesigner/core/instances/nodeinstance.cpp
View file @
14d1edd5
...
...
@@ -594,4 +594,18 @@ QObject *NodeInstance::internalObject() const
return
m_nodeInstance
->
object
();
}
void
NodeInstance
::
activateState
()
{
m_nodeInstance
->
activateState
();
}
void
NodeInstance
::
deactivateState
()
{
m_nodeInstance
->
deactivateState
();
}
void
NodeInstance
::
refreshState
()
{
m_nodeInstance
->
refreshState
();
}
}
src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp
View file @
14d1edd5
...
...
@@ -592,6 +592,18 @@ void ObjectNodeInstance::paintUpdate()
{
}
void
ObjectNodeInstance
::
activateState
()
{
}
void
ObjectNodeInstance
::
deactivateState
()
{
}
void
ObjectNodeInstance
::
refreshState
()
{
}
QStringList
propertyNameForWritableProperties
(
QObject
*
object
,
const
QString
&
baseName
=
QString
())
{
QStringList
propertyNameList
;
...
...
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
View file @
14d1edd5
...
...
@@ -150,6 +150,10 @@ public:
virtual
void
updateAnchors
();
virtual
void
paintUpdate
();
virtual
void
activateState
();
virtual
void
deactivateState
();
virtual
void
refreshState
();
void
populateResetValueHash
();
QVariant
resetValue
(
const
QString
&
propertyName
)
const
;
...
...
src/plugins/qmldesigner/core/instances/qmlpropertychangesnodeinstance.cpp
View file @
14d1edd5
...
...
@@ -196,7 +196,7 @@ void QmlPropertyChangesNodeInstance::updateStateInstance() const
||
!
qmlStateInstance
.
modelNode
().
isValid
())
return
;
qmlStateInstance
.
setPropertyVariant
(
PROPERTY_STATEACTIONSCHANGED
,
true
);
qmlStateInstance
.
refreshState
(
);
}
}
// namespace Internal
...
...
src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.cpp
View file @
14d1edd5
...
...
@@ -33,9 +33,6 @@
namespace
QmlDesigner
{
namespace
Internal
{
const
char
*
const
ACTIVATESTATEPROPERTY
=
"__activateState"
;
const
char
*
const
STATEACTIONSCHANGED
=
"__stateActionsChanged"
;
/**
\class QmlStateNodeInstance
...
...
@@ -65,52 +62,22 @@ QmlStateNodeInstance::Pointer
return
instance
;
}
void
QmlStateNodeInstance
::
setPropertyVariant
(
const
QString
&
name
,
const
QVariant
&
value
)
void
QmlStateNodeInstance
::
activateState
(
)
{
if
(
name
==
ACTIVATESTATEPROPERTY
)
{
Q_ASSERT
(
value
.
type
()
==
QVariant
::
Bool
);
bool
shouldActivate
=
value
.
toBool
();
if
(
shouldActivate
!=
isStateActive
())
{
if
(
shouldActivate
)
{
// QmlState *currentState = stateGroup()->findState(stateGroup()->state());
// stateObject()->apply(stateGroup(), 0, currentState);
// TODO: Will this activate transitions????
stateGroup
()
->
setState
(
property
(
"name"
).
toString
());
}
else
{
resetProperty
(
name
);
}
}
}
else
if
(
name
==
PROPERTY_STATEACTIONSCHANGED
)
{
if
(
isStateActive
())
{
stateGroup
()
->
setState
(
QString
());
stateGroup
()
->
setState
(
property
(
"name"
).
toString
());
}
}
else
{
ObjectNodeInstance
::
setPropertyVariant
(
name
,
value
);
}
if
(
!
isStateActive
())
stateGroup
()
->
setState
(
property
(
"name"
).
toString
());
}
QVariant
QmlStateNodeInstance
::
property
(
const
QString
&
name
)
const
void
QmlStateNodeInstance
::
deactivateState
()
{
if
(
name
==
ACTIVATESTATEPROPERTY
)
{
return
isStateActive
();
}
else
{
return
ObjectNodeInstance
::
property
(
name
);
}
if
(
isStateActive
())
stateGroup
()
->
setState
(
QString
());
}
void
QmlStateNodeInstance
::
re
setProperty
(
const
QString
&
name
)
void
QmlStateNodeInstance
::
re
freshState
(
)
{
if
(
name
==
ACTIVATESTATEPROPERTY
)
{
if
(
isStateActive
())
{
// TODO: Will this activate transitions????
stateGroup
()
->
setState
(
QString
());
}
}
else
{
ObjectNodeInstance
::
resetProperty
(
name
);
}
deactivateState
();
activateState
();
}
QmlState
*
QmlStateNodeInstance
::
stateObject
()
const
...
...
src/plugins/qmldesigner/core/instances/qmlstatenodeinstance.h
View file @
14d1edd5
...
...
@@ -37,8 +37,6 @@ namespace QmlDesigner {
namespace
Internal
{
const
char
*
const
PROPERTY_STATEACTIONSCHANGED
=
"__stateActionsChanged"
;
class
QmlStateNodeInstance
:
public
ObjectNodeInstance
{
public:
...
...
@@ -47,9 +45,9 @@ public:
static
Pointer
create
(
const
NodeMetaInfo
&
metaInfo
,
QmlContext
*
context
,
QObject
*
objectToBeWrapped
);
v
irtual
void
setPropertyVariant
(
const
QString
&
name
,
const
QVariant
&
value
);
v
irtual
QVariant
property
(
const
QString
&
name
)
const
;
v
irtual
void
resetProperty
(
const
QString
&
name
);
v
oid
activateState
(
);
v
oid
deactivateState
()
;
v
oid
refreshState
(
);
protected:
QmlStateNodeInstance
(
QmlState
*
object
);
...
...
src/plugins/qmldesigner/core/model/qmlmodelview.cpp
View file @
14d1edd5
...
...
@@ -307,14 +307,14 @@ void QmlModelView::stateChanged(const QmlModelState &newQmlModelState, const Qm
NodeInstance
newStateInstance
=
instanceForModelNode
(
newQmlModelState
.
modelNode
());
Q_ASSERT
(
newStateInstance
.
isValid
());
if
(
!
newQmlModelState
.
isBaseState
())
newStateInstance
.
setPropertyVariant
(
"__
activateState
"
,
true
);
newStateInstance
.
activateState
(
);
}
if
(
oldQmlModelState
.
isValid
())
{
NodeInstance
oldStateInstance
=
instanceForModelNode
(
oldQmlModelState
.
modelNode
());
Q_ASSERT
(
oldStateInstance
.
isValid
());
if
(
!
oldQmlModelState
.
isBaseState
())
oldStateInstance
.
setPropertyVariant
(
"__
activateState
"
,
false
);
oldStateInstance
.
de
activateState
(
);
}
}
...
...
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