Skip to content
GitLab
Menu
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
35263628
Commit
35263628
authored
Jun 10, 2010
by
Marco Bubke
Browse files
Add script function to the model
This is needed to suppert inline script function of Qml in the designer
parent
24f07b7a
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
View file @
35263628
...
...
@@ -235,7 +235,7 @@ FormEditorWidget *FormEditorView::widget() const
void
FormEditorView
::
nodeIdChanged
(
const
ModelNode
&
node
,
const
QString
&
newId
,
const
QString
&
oldId
)
{
nodeInstanceView
()
->
nodeIdChanged
(
node
,
newId
,
oldId
);
QmlModelView
::
nodeIdChanged
(
node
,
newId
,
oldId
);
}
void
FormEditorView
::
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
...
...
@@ -258,6 +258,12 @@ void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
m_scene
->
update
();
}
void
FormEditorView
::
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
)
{
QmlModelView
::
scriptFunctionsChanged
(
node
,
scriptFunctionList
);
}
AbstractFormEditorTool
*
FormEditorView
::
currentTool
()
const
{
return
m_currentTool
;
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.h
View file @
35263628
...
...
@@ -77,6 +77,7 @@ public:
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
// FormEditorView
FormEditorWidget
*
widget
()
const
;
...
...
src/plugins/qmldesigner/components/integration/componentview.cpp
View file @
35263628
...
...
@@ -159,6 +159,7 @@ void ComponentView::propertiesRemoved(const QList<AbstractProperty>& /*propertyL
void
ComponentView
::
variantPropertiesChanged
(
const
QList
<
VariantProperty
>&
/*propertyList*/
,
PropertyChangeFlags
/*propertyChange*/
)
{}
void
ComponentView
::
bindingPropertiesChanged
(
const
QList
<
BindingProperty
>&
/*propertyList*/
,
PropertyChangeFlags
/*propertyChange*/
)
{}
void
ComponentView
::
rootNodeTypeChanged
(
const
QString
&
/*type*/
,
int
/*majorVersion*/
,
int
/*minorVersion*/
)
{}
void
ComponentView
::
scriptFunctionsChanged
(
const
ModelNode
&
/*node*/
,
const
QStringList
&
/*scriptFunctionList*/
)
{}
...
...
src/plugins/qmldesigner/components/integration/componentview.h
View file @
35263628
...
...
@@ -66,7 +66,7 @@ public:
void
variantPropertiesChanged
(
const
QList
<
VariantProperty
>&
propertyList
,
PropertyChangeFlags
propertyChange
);
void
bindingPropertiesChanged
(
const
QList
<
BindingProperty
>&
propertyList
,
PropertyChangeFlags
propertyChange
);
void
rootNodeTypeChanged
(
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
View file @
35263628
...
...
@@ -56,6 +56,11 @@ void DesignDocumentControllerView::selectedNodesChanged(const QList<ModelNode> &
void
DesignDocumentControllerView
::
nodeOrderChanged
(
const
NodeListProperty
&
/*listProperty*/
,
const
ModelNode
&
/*movedNode*/
,
int
/*oldIndex*/
)
{};
void
DesignDocumentControllerView
::
scriptFunctionsChanged
(
const
ModelNode
&
/*node*/
,
const
QStringList
&
/*scriptFunctionList*/
)
{
}
static
QStringList
arrayToStringList
(
const
QByteArray
&
byteArray
)
{
QString
str
(
QString
::
fromLatin1
(
byteArray
));
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
View file @
35263628
...
...
@@ -57,6 +57,7 @@ public:
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
virtual
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
virtual
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
ModelNode
insertModel
(
const
ModelNode
&
modelNode
)
{
return
m_modelMerger
.
insertModel
(
modelNode
);
}
...
...
src/plugins/qmldesigner/components/navigator/navigatorview.cpp
View file @
35263628
...
...
@@ -186,6 +186,11 @@ void NavigatorView::auxiliaryDataChanged(const ModelNode &node, const QString &
}
}
void
NavigatorView
::
scriptFunctionsChanged
(
const
ModelNode
&
/*node*/
,
const
QStringList
&
/*scriptFunctionList*/
)
{
}
void
NavigatorView
::
nodeOrderChanged
(
const
NodeListProperty
&
/*listProperty*/
,
const
ModelNode
&
node
,
int
/*oldIndex*/
)
{
if
(
m_treeModel
->
isInTree
(
node
))
...
...
src/plugins/qmldesigner/components/navigator/navigatorview.h
View file @
35263628
...
...
@@ -80,6 +80,7 @@ public:
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
private
slots
:
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
View file @
35263628
...
...
@@ -798,6 +798,11 @@ void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId,
}
}
void
PropertyEditor
::
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
)
{
QmlModelView
::
scriptFunctionsChanged
(
node
,
scriptFunctionList
);
}
void
PropertyEditor
::
select
(
const
ModelNode
&
node
)
{
if
(
QmlItemNode
(
node
).
isValid
())
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h
View file @
35263628
...
...
@@ -101,6 +101,7 @@ public:
void
bindingPropertiesChanged
(
const
QList
<
BindingProperty
>&
propertyList
,
PropertyChangeFlags
propertyChange
);
void
nodeIdChanged
(
const
ModelNode
&
node
,
const
QString
&
newId
,
const
QString
&
oldId
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
protected:
void
timerEvent
(
QTimerEvent
*
event
);
...
...
src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
View file @
35263628
...
...
@@ -399,6 +399,15 @@ void StatesEditorView::customNotification(const AbstractView * view, const QStri
QmlModelView
::
customNotification
(
view
,
identifier
,
nodeList
,
data
);
}
void
StatesEditorView
::
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
)
{
if
(
debug
)
qDebug
()
<<
__FUNCTION__
;
QmlModelView
::
scriptFunctionsChanged
(
node
,
scriptFunctionList
);
}
QPixmap
StatesEditorView
::
renderState
(
int
i
)
{
if
(
debug
)
...
...
src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
View file @
35263628
...
...
@@ -57,7 +57,6 @@ public:
void
nodeInstancePropertyChanged
(
const
ModelNode
&
node
,
const
QString
&
propertyName
);
protected:
// AbstractView
void
modelAttached
(
Model
*
model
);
void
modelAboutToBeDetached
(
Model
*
model
);
...
...
@@ -76,6 +75,7 @@ protected:
void
otherPropertyChanged
(
const
QmlObjectNode
&
qmlObjectNode
,
const
QString
&
propertyName
);
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
protected:
...
...
src/plugins/qmldesigner/designercore/include/abstractview.h
View file @
35263628
...
...
@@ -129,6 +129,8 @@ public:
virtual
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
virtual
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
)
=
0
;
QmlModelView
*
toQmlModelView
();
void
changeRootNodeType
(
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
);
...
...
src/plugins/qmldesigner/designercore/include/forwardview.h
View file @
35263628
...
...
@@ -76,6 +76,7 @@ public:
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
protected:
void
appendView
(
ViewType
*
view
);
...
...
@@ -245,6 +246,13 @@ void ForwardView<ViewType>::auxiliaryDataChanged(const ModelNode &node, const QS
view
->
auxiliaryDataChanged
(
ModelNode
(
node
,
view
.
data
()),
name
,
data
);
}
template
<
class
ViewType
>
void
ForwardView
<
ViewType
>::
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
)
{
foreach
(
const
ViewTypePointer
&
view
,
m_targetViewList
)
view
->
scriptFunctionsChanged
(
node
,
scriptFunctionList
);
}
template
<
class
ViewType
>
void
ForwardView
<
ViewType
>::
appendView
(
ViewType
*
view
)
{
...
...
src/plugins/qmldesigner/designercore/include/modelnode.h
View file @
35263628
...
...
@@ -135,6 +135,10 @@ public:
bool
hasNodeProperty
(
const
QString
&
name
)
const
;
bool
hasNodeListProperty
(
const
QString
&
name
)
const
;
void
setScriptFunctions
(
const
QStringList
&
scriptFunctionList
);
QStringList
scriptFunctions
()
const
;
//###
void
destroy
();
...
...
src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
View file @
35263628
...
...
@@ -84,6 +84,8 @@ public:
void
nodeIdChanged
(
const
ModelNode
&
node
,
const
QString
&
newId
,
const
QString
&
oldId
);
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
QList
<
NodeInstance
>
instances
()
const
;
NodeInstance
instanceForNode
(
const
ModelNode
&
node
);
...
...
src/plugins/qmldesigner/designercore/include/rewriterview.h
View file @
35263628
...
...
@@ -124,6 +124,7 @@ public:
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
void
rootNodeTypeChanged
(
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
);
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp
View file @
35263628
...
...
@@ -374,6 +374,10 @@ void NodeInstanceView::selectedNodesChanged(const QList<ModelNode> &/*selectedNo
{
}
void
NodeInstanceView
::
scriptFunctionsChanged
(
const
ModelNode
&
/*node*/
,
const
QStringList
&
/*scriptFunctionList*/
)
{
}
//\}
...
...
src/plugins/qmldesigner/designercore/model/internalnode.cpp
View file @
35263628
...
...
@@ -311,5 +311,15 @@ bool operator <(const InternalNode::Pointer &firstNode, const InternalNode::Poin
return
firstNode
.
data
()
<
secondNode
.
data
();
}
void
InternalNode
::
setScriptFunctions
(
const
QStringList
&
scriptFunctionList
)
{
m_scriptFunctionList
=
scriptFunctionList
;
}
QStringList
InternalNode
::
scriptFunctions
()
const
{
return
m_scriptFunctionList
;
}
}
}
src/plugins/qmldesigner/designercore/model/internalnode_p.h
View file @
35263628
...
...
@@ -34,6 +34,7 @@
#include <QHash>
#include <QSharedPointer>
#include <QWeakPointer>
#include <QStringList>
#include "internalproperty.h"
#include "internalvariantproperty.h"
#include "internalbindingproperty.h"
...
...
@@ -112,6 +113,9 @@ public:
QList
<
InternalNode
::
Pointer
>
allSubNodes
()
const
;
QList
<
InternalNode
::
Pointer
>
allDirectSubNodes
()
const
;
void
setScriptFunctions
(
const
QStringList
&
scriptFunctionList
);
QStringList
scriptFunctions
()
const
;
protected:
Pointer
internalPointer
()
const
;
void
setInternalWeakPointer
(
const
Pointer
&
pointer
);
...
...
@@ -133,6 +137,7 @@ private:
bool
m_valid
;
QHash
<
QString
,
InternalPropertyPointer
>
m_namePropertyHash
;
QStringList
m_scriptFunctionList
;
};
uint
qHash
(
const
InternalNodePointer
&
node
);
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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