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
Tobias Hunger
qt-creator
Commits
1312a042
Commit
1312a042
authored
Dec 09, 2010
by
Marco Bubke
Browse files
QmlDesigner: Add component complete feature
This notifies the views if the instance has be really instanced.
parent
c04797fd
Changes
35
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
View file @
1312a042
...
...
@@ -435,6 +435,11 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const QString &
}
}
void
FormEditorView
::
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
)
{
}
void
FormEditorView
::
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
)
{
if
(
identifier
==
"__start rewriter transaction__"
)
{
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.h
View file @
1312a042
...
...
@@ -101,6 +101,8 @@ public:
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
double
margins
()
const
;
double
spacing
()
const
;
void
deActivateItemCreator
();
...
...
src/plugins/qmldesigner/components/integration/componentview.cpp
View file @
1312a042
...
...
@@ -161,6 +161,7 @@ void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*pro
void
ComponentView
::
rootNodeTypeChanged
(
const
QString
&
/*type*/
,
int
/*majorVersion*/
,
int
/*minorVersion*/
)
{}
void
ComponentView
::
scriptFunctionsChanged
(
const
ModelNode
&
/*node*/
,
const
QStringList
&
/*scriptFunctionList*/
)
{}
void
ComponentView
::
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
/*propertyList*/
)
{};
void
ComponentView
::
instancesCompleted
(
const
QVector
<
ModelNode
>
&
/*completedNodeList*/
)
{}
void
ComponentView
::
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
/*selectedNodeList*/
,
...
...
@@ -170,7 +171,6 @@ void ComponentView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*
void
ComponentView
::
nodeOrderChanged
(
const
NodeListProperty
&
/*listProperty*/
,
const
ModelNode
&
/*movedNode*/
,
int
/*oldIndex*/
)
{}
void
ComponentView
::
importsChanged
()
{}
void
ComponentView
::
auxiliaryDataChanged
(
const
ModelNode
&
/*node*/
,
const
QString
&
/*name*/
,
const
QVariant
&
/*data*/
)
{}
...
...
src/plugins/qmldesigner/components/integration/componentview.h
View file @
1312a042
...
...
@@ -69,6 +69,7 @@ public:
void
rootNodeTypeChanged
(
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
...
...
@@ -77,8 +78,6 @@ public:
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
void
importsChanged
();
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
View file @
1312a042
...
...
@@ -65,6 +65,11 @@ void DesignDocumentControllerView::instancePropertyChange(const QList<QPair<Mode
{
}
void
DesignDocumentControllerView
::
instancesCompleted
(
const
QVector
<
ModelNode
>
&
/*completedNodeList*/
)
{
}
static
QStringList
arrayToStringList
(
const
QByteArray
&
byteArray
)
{
QString
str
(
QString
::
fromLatin1
(
byteArray
));
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
View file @
1312a042
...
...
@@ -60,7 +60,7 @@ public:
virtual
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
virtual
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
ModelNode
insertModel
(
const
ModelNode
&
modelNode
)
{
return
m_modelMerger
.
insertModel
(
modelNode
);
}
...
...
src/plugins/qmldesigner/components/navigator/navigatorview.cpp
View file @
1312a042
...
...
@@ -198,6 +198,10 @@ void NavigatorView::instancePropertyChange(const QList<QPair<ModelNode, QString>
{
}
void
NavigatorView
::
instancesCompleted
(
const
QVector
<
ModelNode
>
&
/*completedNodeList*/
)
{
}
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 @
1312a042
...
...
@@ -82,6 +82,7 @@ public:
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
private
slots
:
// void handleChangedItem(QStandardItem * item);
...
...
src/plugins/qmldesigner/designercore/designercore.pri
View file @
1312a042
...
...
@@ -119,7 +119,9 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/instances/addimportcommand.cpp \
$$PWD/instances/childrenchangedcommand.cpp \
$$PWD/instances/statepreviewimagechangedcommand.cpp \
$$PWD/instances/imagecontainer.cpp
$$PWD/instances/imagecontainer.cpp \
$$PWD/instances/completecomponentcommand.cpp \
$$PWD/instances/componentcompletedcommand.cpp
HEADERS += $$PWD/include/corelib_global.h \
$$PWD/include/abstractview.h \
$$PWD/include/nodeinstanceview.h \
...
...
@@ -237,7 +239,9 @@ HEADERS += $$PWD/include/corelib_global.h \
$$PWD/instances/addimportcommand.h \
$$PWD/instances/childrenchangedcommand.h \
$$PWD/instances/statepreviewimagechangedcommand.h \
$$PWD/instances/imagecontainer.h
$$PWD/instances/imagecontainer.h \
$$PWD/instances/completecomponentcommand.h \
$$PWD/instances/componentcompletedcommand.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin
SOURCES += $$PWD/model/basetexteditmodifier.cpp
...
...
src/plugins/qmldesigner/designercore/include/abstractview.h
View file @
1312a042
...
...
@@ -107,6 +107,7 @@ public:
void
emitCustomNotification
(
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
emitInstancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
emitInstancesCompleted
(
const
QVector
<
ModelNode
>
&
nodeList
);
virtual
void
modelAttached
(
Model
*
model
);
virtual
void
modelAboutToBeDetached
(
Model
*
model
);
...
...
@@ -124,6 +125,8 @@ public:
virtual
void
rootNodeTypeChanged
(
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
)
=
0
;
virtual
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
)
=
0
;
virtual
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
)
=
0
;
virtual
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
)
=
0
;
...
...
src/plugins/qmldesigner/designercore/include/nodeinstanceclientinterface.h
View file @
1312a042
...
...
@@ -10,6 +10,7 @@ class PixmapChangedCommand;
class
InformationChangedCommand
;
class
ChildrenChangedCommand
;
class
StatePreviewImageChangedCommand
;
class
ComponentCompletedCommand
;
class
NodeInstanceClientInterface
{
...
...
@@ -19,6 +20,7 @@ public:
virtual
void
pixmapChanged
(
const
PixmapChangedCommand
&
command
)
=
0
;
virtual
void
childrenChanged
(
const
ChildrenChangedCommand
&
command
)
=
0
;
virtual
void
statePreviewImagesChanged
(
const
StatePreviewImageChangedCommand
&
command
)
=
0
;
virtual
void
componentCompleted
(
const
ComponentCompletedCommand
&
command
)
=
0
;
virtual
void
flush
()
{};
virtual
qint64
bytesToWrite
()
const
{
return
0
;}
...
...
src/plugins/qmldesigner/designercore/include/nodeinstanceserverinterface.h
View file @
1312a042
...
...
@@ -21,6 +21,7 @@ class RemoveInstancesCommand;
class
RemovePropertiesCommand
;
class
ChangeStateCommand
;
class
AddImportCommand
;
class
CompleteComponentCommand
;
class
NodeInstanceServerInterface
:
public
QObject
{
...
...
@@ -40,6 +41,7 @@ public:
virtual
void
changeIds
(
const
ChangeIdsCommand
&
command
)
=
0
;
virtual
void
changeState
(
const
ChangeStateCommand
&
command
)
=
0
;
virtual
void
addImport
(
const
AddImportCommand
&
command
)
=
0
;
virtual
void
completeComponent
(
const
CompleteComponentCommand
&
command
)
=
0
;
virtual
void
setBlockUpdates
(
bool
/*block*/
)
{}
...
...
src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
View file @
1312a042
...
...
@@ -63,6 +63,7 @@ class ChangeIdsCommand;
class
RemoveInstancesCommand
;
class
RemovePropertiesCommand
;
class
AddImportCommand
;
class
CompleteComponentCommand
;
class
CORESHARED_EXPORT
NodeInstanceView
:
public
AbstractView
,
public
NodeInstanceClientInterface
{
...
...
@@ -94,6 +95,7 @@ public:
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
...
...
@@ -118,6 +120,7 @@ public:
void
informationChanged
(
const
InformationChangedCommand
&
command
);
void
childrenChanged
(
const
ChildrenChangedCommand
&
command
);
void
statePreviewImagesChanged
(
const
StatePreviewImageChangedCommand
&
command
);
void
componentCompleted
(
const
ComponentCompletedCommand
&
command
);
private:
// functions
NodeInstance
rootNodeInstance
()
const
;
...
...
@@ -143,6 +146,8 @@ private: // functions
CreateSceneCommand
createCreateSceneCommand
()
const
;
ClearSceneCommand
createClearSceneCommand
()
const
;
CreateInstancesCommand
createCreateInstancesCommand
(
const
QList
<
NodeInstance
>
&
instanceList
)
const
;
CompleteComponentCommand
createComponentCompleteCommand
(
const
QList
<
NodeInstance
>
&
instanceList
)
const
;
ComponentCompletedCommand
createComponentCompletedCommand
(
const
QList
<
NodeInstance
>
&
instanceList
)
const
;
ReparentInstancesCommand
createReparentInstancesCommand
(
const
QList
<
NodeInstance
>
&
instanceList
)
const
;
ReparentInstancesCommand
createReparentInstancesCommand
(
const
ModelNode
&
node
,
const
NodeAbstractProperty
&
newPropertyParent
,
const
NodeAbstractProperty
&
oldPropertyParent
)
const
;
ChangeFileUrlCommand
createChangeFileUrlCommand
(
const
QUrl
&
fileUrl
)
const
;
...
...
src/plugins/qmldesigner/designercore/include/qmlmodelview.h
View file @
1312a042
...
...
@@ -91,6 +91,7 @@ public:
virtual
void
nodeInstancePropertyChanged
(
const
ModelNode
&
node
,
const
QString
&
propertyName
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
void
nodeCreated
(
const
ModelNode
&
createdNode
);
void
nodeRemoved
(
const
ModelNode
&
removedNode
,
const
NodeAbstractProperty
&
parentProperty
,
PropertyChangeFlags
propertyChange
);
...
...
src/plugins/qmldesigner/designercore/include/rewriterview.h
View file @
1312a042
...
...
@@ -135,6 +135,7 @@ public:
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
instancePropertyChange
(
const
QList
<
QPair
<
ModelNode
,
QString
>
>
&
propertyList
);
void
instancesCompleted
(
const
QVector
<
ModelNode
>
&
completedNodeList
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
...
...
src/plugins/qmldesigner/designercore/instances/completecomponentcommand.cpp
0 → 100644
View file @
1312a042
#include "completecomponentcommand.h"
namespace
QmlDesigner
{
CompleteComponentCommand
::
CompleteComponentCommand
()
{
}
CompleteComponentCommand
::
CompleteComponentCommand
(
const
QVector
<
qint32
>
&
container
)
:
m_instanceVector
(
container
)
{
}
QVector
<
qint32
>
CompleteComponentCommand
::
instances
()
const
{
return
m_instanceVector
;
}
QDataStream
&
operator
<<
(
QDataStream
&
out
,
const
CompleteComponentCommand
&
command
)
{
out
<<
command
.
instances
();
return
out
;
}
QDataStream
&
operator
>>
(
QDataStream
&
in
,
CompleteComponentCommand
&
command
)
{
in
>>
command
.
m_instanceVector
;
return
in
;
}
}
// namespace QmlDesigner
src/plugins/qmldesigner/designercore/instances/completecomponentcommand.h
0 → 100644
View file @
1312a042
#ifndef COMPLETECOMPONENT_H
#define COMPLETECOMPONENT_H
#include <QMetaType>
#include <QVector>
namespace
QmlDesigner
{
class
CompleteComponentCommand
{
friend
QDataStream
&
operator
>>
(
QDataStream
&
in
,
CompleteComponentCommand
&
command
);
public:
CompleteComponentCommand
();
CompleteComponentCommand
(
const
QVector
<
qint32
>
&
container
);
QVector
<
qint32
>
instances
()
const
;
private:
QVector
<
qint32
>
m_instanceVector
;
};
QDataStream
&
operator
<<
(
QDataStream
&
out
,
const
CompleteComponentCommand
&
command
);
QDataStream
&
operator
>>
(
QDataStream
&
in
,
CompleteComponentCommand
&
command
);
}
// namespace QmlDesigner
Q_DECLARE_METATYPE
(
QmlDesigner
::
CompleteComponentCommand
);
#endif // COMPLETECOMPONENT_H
src/plugins/qmldesigner/designercore/instances/componentcompletedcommand.cpp
0 → 100644
View file @
1312a042
#include "componentcompletedcommand.h"
namespace
QmlDesigner
{
ComponentCompletedCommand
::
ComponentCompletedCommand
()
{
}
ComponentCompletedCommand
::
ComponentCompletedCommand
(
const
QVector
<
qint32
>
&
container
)
:
m_instanceVector
(
container
)
{
}
QVector
<
qint32
>
ComponentCompletedCommand
::
instances
()
const
{
return
m_instanceVector
;
}
QDataStream
&
operator
<<
(
QDataStream
&
out
,
const
ComponentCompletedCommand
&
command
)
{
out
<<
command
.
instances
();
return
out
;
}
QDataStream
&
operator
>>
(
QDataStream
&
in
,
ComponentCompletedCommand
&
command
)
{
in
>>
command
.
m_instanceVector
;
return
in
;
}
}
// namespace QmlDesigner
src/plugins/qmldesigner/designercore/instances/componentcompletedcommand.h
0 → 100644
View file @
1312a042
#ifndef COMPONENTCOMPLETEDCOMMAND_H
#define COMPONENTCOMPLETEDCOMMAND_H
#include <QMetaType>
#include <QVector>
namespace
QmlDesigner
{
class
ComponentCompletedCommand
{
friend
QDataStream
&
operator
>>
(
QDataStream
&
in
,
ComponentCompletedCommand
&
command
);
public:
ComponentCompletedCommand
();
ComponentCompletedCommand
(
const
QVector
<
qint32
>
&
container
);
QVector
<
qint32
>
instances
()
const
;
private:
QVector
<
qint32
>
m_instanceVector
;
};
QDataStream
&
operator
<<
(
QDataStream
&
out
,
const
ComponentCompletedCommand
&
command
);
QDataStream
&
operator
>>
(
QDataStream
&
in
,
ComponentCompletedCommand
&
command
);
}
// namespace QmlDesigner
Q_DECLARE_METATYPE
(
QmlDesigner
::
ComponentCompletedCommand
);
#endif // COMPONENTCOMPLETEDCOMMAND_H
src/plugins/qmldesigner/designercore/instances/instances.pri
View file @
1312a042
...
...
@@ -3,6 +3,8 @@ INCLUDEPATH += $$PWD/../include
HEADERS += $$PWD/behaviornodeinstance.h
HEADERS += $$PWD/componentcompletedcommand.h
HEADERS += $$PWD//completecomponentcommand.h
HEADERS += $$PWDstatepreviewimagechangedcommand.h
HEADERS += $$PWD//imagecontainer.h
HEADERS += $$PWD/childrenchangedcommand.h
...
...
@@ -45,6 +47,8 @@ HEADERS += $$PWD/../include/nodeinstanceserverinterface.h
SOURCES += $$PWD/behaviornodeinstance.cpp
SOURCES += $$PWD/componentcompletedcommand.cpp
SOURCES += $$PWD/completecomponentcommand.cpp
SOURCES += $$PWD/statepreviewimagechangedcommand.cpp
SOURCES += $$PWD/imagecontainer.cpp
SOURCES += $$PWD/childrenchangedcommand.cpp
...
...
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