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
e3376b6d
Commit
e3376b6d
authored
Feb 10, 2011
by
Marco Bubke
Browse files
QmlDesigner: Change importAdded and importRemoved in importsChanged
parent
1b3f8c57
Changes
30
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/dragtool.cpp
View file @
e3376b6d
...
...
@@ -262,6 +262,7 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
{
if
(
event
->
mimeData
()
->
hasFormat
(
"application/vnd.bauhaus.itemlibraryinfo"
)
||
event
->
mimeData
()
->
hasFormat
(
"application/vnd.bauhaus.libraryresource"
))
{
QList
<
Import
>
importToBeAddedList
;
m_blockMove
=
false
;
if
(
event
->
mimeData
()
->
hasFormat
(
"application/vnd.bauhaus.itemlibraryinfo"
))
{
Q_ASSERT
(
!
event
->
mimeData
()
->
data
(
"application/vnd.bauhaus.itemlibraryinfo"
).
isEmpty
());
...
...
@@ -272,12 +273,14 @@ void DragTool::dragEnterEvent(QGraphicsSceneDragDropEvent * event)
Import
newImport
=
Import
::
createLibraryImport
(
newImportUrl
,
newImportVersion
);
if
(
!
view
()
->
model
()
->
imports
().
contains
(
newImport
))
{
view
()
->
model
()
->
addImport
(
newImport
);
importToBeAddedList
.
append
(
newImport
);
}
}
}
view
()
->
model
()
->
changeImports
(
importToBeAddedList
,
QList
<
Import
>
());
if
(
!
m_rewriterTransaction
.
isValid
())
{
view
()
->
clearSelectedModelNodes
();
m_rewriterTransaction
=
view
()
->
beginRewriterTransaction
();
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
View file @
e3376b6d
...
...
@@ -148,12 +148,7 @@ void FormEditorView::modelAboutToBeDetached(Model *model)
QmlModelView
::
modelAboutToBeDetached
(
model
);
}
void
FormEditorView
::
importAdded
(
const
Import
&
)
{
reset
();
}
void
FormEditorView
::
importRemoved
(
const
Import
&
)
void
FormEditorView
::
importsChanged
(
const
QList
<
Import
>
&
/*addedImports*/
,
const
QList
<
Import
>
&
/*removedImports*/
)
{
reset
();
}
...
...
src/plugins/qmldesigner/components/formeditor/formeditorview.h
View file @
e3376b6d
...
...
@@ -70,8 +70,7 @@ public:
void
modelAttached
(
Model
*
model
);
void
modelAboutToBeDetached
(
Model
*
model
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
nodeCreated
(
const
ModelNode
&
createdNode
);
void
nodeAboutToBeRemoved
(
const
ModelNode
&
removedNode
);
...
...
src/plugins/qmldesigner/components/integration/componentview.cpp
View file @
e3376b6d
...
...
@@ -185,6 +185,6 @@ void ComponentView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, c
void
ComponentView
::
auxiliaryDataChanged
(
const
ModelNode
&
/*node*/
,
const
QString
&
/*name*/
,
const
QVariant
&
/*data*/
)
{}
void
ComponentView
::
customNotification
(
const
AbstractView
*
/*view*/
,
const
QString
&
/*identifier*/
,
const
QList
<
ModelNode
>
&
/*nodeList*/
,
const
QList
<
QVariant
>
&
/*data*/
)
{}
void
ComponentView
::
importsChanged
(
const
QList
<
Import
>
&
/*addedImports*/
,
const
QList
<
Import
>
&
/*removedImports*/
)
{}
}
// namespace QmlDesigner
src/plugins/qmldesigner/components/integration/componentview.h
View file @
e3376b6d
...
...
@@ -95,6 +95,7 @@ public:
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
QStandardItemModel
*
standardItemModel
()
const
;
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
View file @
e3376b6d
...
...
@@ -481,8 +481,7 @@ void DesignDocumentController::copySelected()
QScopedPointer
<
Model
>
model
(
Model
::
create
(
"Qt/Rectangle"
));
model
->
setMetaInfo
(
m_d
->
model
->
metaInfo
());
model
->
setFileUrl
(
m_d
->
model
->
fileUrl
());
foreach
(
const
Import
&
import
,
m_d
->
model
->
imports
())
model
->
addImport
(
import
);
model
->
changeImports
(
m_d
->
model
->
imports
(),
QList
<
Import
>
());
Q_ASSERT
(
model
);
...
...
@@ -578,8 +577,8 @@ void DesignDocumentController::paste()
QScopedPointer
<
Model
>
model
(
Model
::
create
(
"empty"
));
model
->
setMetaInfo
(
m_d
->
model
->
metaInfo
());
model
->
setFileUrl
(
m_d
->
model
->
fileUrl
());
foreach
(
const
Import
&
import
,
m_d
->
model
->
imports
()
)
model
->
addImport
(
import
);
model
->
changeImports
(
m_d
->
model
->
imports
()
,
QList
<
Import
>
());
Q_ASSERT
(
model
);
if
(
!
m_d
->
model
)
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
View file @
e3376b6d
...
...
@@ -107,6 +107,11 @@ void DesignDocumentControllerView::actualStateChanged(const ModelNode &/*node*/)
{
}
void
DesignDocumentControllerView
::
importsChanged
(
const
QList
<
Import
>
&
/*addedImports*/
,
const
QList
<
Import
>
&
/*removedImports*/
)
{
}
static
QStringList
arrayToStringList
(
const
QByteArray
&
byteArray
)
{
QString
str
(
QString
::
fromLatin1
(
byteArray
));
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.h
View file @
e3376b6d
...
...
@@ -75,6 +75,8 @@ public:
void
actualStateChanged
(
const
ModelNode
&
node
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
ModelNode
insertModel
(
const
ModelNode
&
modelNode
)
{
return
m_modelMerger
.
insertModel
(
modelNode
);
}
void
replaceModel
(
const
ModelNode
&
modelNode
)
...
...
src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp
View file @
e3376b6d
...
...
@@ -32,12 +32,7 @@ void ItemLibraryView::modelAboutToBeDetached(Model *model)
m_widget
->
setModel
(
0
);
}
void
ItemLibraryView
::
importAdded
(
const
Import
&
)
{
updateImports
();
}
void
ItemLibraryView
::
importRemoved
(
const
Import
&
)
void
ItemLibraryView
::
importsChanged
(
const
QList
<
Import
>
&
/*addedImports*/
,
const
QList
<
Import
>
&
/*removedImports*/
)
{
updateImports
();
}
...
...
src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.h
View file @
e3376b6d
...
...
@@ -58,8 +58,7 @@ public:
void
modelAttached
(
Model
*
model
);
void
modelAboutToBeDetached
(
Model
*
model
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
nodeCreated
(
const
ModelNode
&
createdNode
);
void
nodeRemoved
(
const
ModelNode
&
removedNode
,
const
NodeAbstractProperty
&
parentProperty
,
PropertyChangeFlags
propertyChange
);
...
...
src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp
View file @
e3376b6d
...
...
@@ -500,18 +500,20 @@ void ItemLibraryWidget::wheelEvent(QWheelEvent *event)
{
if
(
!
m_d
->
model
)
return
;
QList
<
Import
>
toBeRemovedImportList
;
foreach
(
const
Import
&
import
,
m_d
->
model
->
imports
())
if
(
import
.
isLibraryImport
()
&&
import
.
url
().
compare
(
name
,
Qt
::
CaseInsensitive
)
==
0
)
m_d
->
model
->
removeImport
(
import
);
toBeRemovedImportList
.
append
(
import
);
m_d
->
model
->
changeImports
(
QList
<
Import
>
(),
toBeRemovedImportList
);
}
void
ItemLibraryWidget
::
addImport
(
const
QString
&
name
,
const
QString
&
version
)
{
if
(
!
m_d
->
model
)
return
;
m_d
->
model
->
addImport
(
Import
::
createLibraryImport
(
name
,
version
));
m_d
->
model
->
changeImports
(
QList
<
Import
>
()
<<
Import
::
createLibraryImport
(
name
,
version
),
QList
<
Import
>
());
}
}
src/plugins/qmldesigner/components/navigator/navigatorview.cpp
View file @
e3376b6d
...
...
@@ -111,17 +111,11 @@ void NavigatorView::modelAboutToBeDetached(Model *model)
AbstractView
::
modelAboutToBeDetached
(
model
);
}
void
NavigatorView
::
import
Added
(
const
Import
&
)
void
NavigatorView
::
import
sChanged
(
const
QList
<
Import
>
&
/*addedImports*/
,
const
QList
<
Import
>
&
/*removedImports*/
)
{
treeWidget
()
->
update
();
}
void
NavigatorView
::
importRemoved
(
const
Import
&
)
{
treeWidget
()
->
update
();
}
void
NavigatorView
::
nodeCreated
(
const
ModelNode
&
/*createdNode*/
)
{
}
...
...
src/plugins/qmldesigner/components/navigator/navigatorview.h
View file @
e3376b6d
...
...
@@ -66,8 +66,7 @@ public:
void
modelAttached
(
Model
*
model
);
void
modelAboutToBeDetached
(
Model
*
model
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
nodeCreated
(
const
ModelNode
&
createdNode
);
void
nodeRemoved
(
const
ModelNode
&
removedNode
,
const
NodeAbstractProperty
&
parentProperty
,
PropertyChangeFlags
propertyChange
);
...
...
src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
View file @
e3376b6d
...
...
@@ -141,7 +141,7 @@ void StatesEditorView::addState()
try
{
if
(
rootStateGroup
().
allStates
().
count
()
<
1
)
model
()
->
addImport
(
Import
::
createLibraryImport
(
"QtQuick"
,
"1.0"
));
model
()
->
changeImports
(
QList
<
Import
>
()
<<
Import
::
createLibraryImport
(
"QtQuick"
,
"1.0"
)
,
QList
<
Import
>
()
);
ModelNode
newState
=
rootStateGroup
().
addState
(
newStateName
);
setCurrentState
(
newState
);
}
catch
(
RewritingException
&
e
)
{
...
...
src/plugins/qmldesigner/designercore/include/abstractview.h
View file @
e3376b6d
...
...
@@ -154,8 +154,7 @@ public:
virtual
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
)
=
0
;
virtual
void
importAdded
(
const
Import
&
import
);
virtual
void
importRemoved
(
const
Import
&
import
);
virtual
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
)
=
0
;
virtual
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
...
...
src/plugins/qmldesigner/designercore/include/forwardview.h
View file @
e3376b6d
...
...
@@ -74,9 +74,7 @@ public:
void
fileUrlChanged
(
const
QUrl
&
oldUrl
,
const
QUrl
&
newUrl
);
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
...
...
@@ -224,12 +222,10 @@ void ForwardView<ViewType>::nodeOrderChanged(const NodeListProperty &listPropert
}
template
<
class
ViewType
>
void
ForwardView
<
ViewType
>::
import
Add
ed
(
const
Import
&
import
)
void
ForwardView
<
ViewType
>::
import
Chang
ed
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
)
{
AbstractView
::
importAdded
(
import
);
foreach
(
const
ViewTypePointer
&
view
,
m_targetViewList
)
view
->
import
Added
(
i
mport
);
view
->
import
Changed
(
addedImport
,
removedI
mport
);
}
template
<
class
ViewType
>
...
...
src/plugins/qmldesigner/designercore/include/model.h
View file @
e3376b6d
...
...
@@ -105,8 +105,7 @@ public:
// Imports:
QList
<
Import
>
imports
()
const
;
void
addImport
(
const
Import
&
import
);
void
removeImport
(
const
Import
&
import
);
void
changeImports
(
const
QList
<
Import
>
&
importsToBeAdded
,
const
QList
<
Import
>
&
importsToBeRemoved
);
RewriterView
*
rewriterView
()
const
;
...
...
src/plugins/qmldesigner/designercore/include/nodeinstanceview.h
View file @
e3376b6d
...
...
@@ -103,8 +103,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
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
instanceInformationsChange
(
const
QVector
<
ModelNode
>
&
nodeList
);
void
instancesRenderImageChanged
(
const
QVector
<
ModelNode
>
&
nodeList
);
void
instancesPreviewImageChanged
(
const
QVector
<
ModelNode
>
&
nodeList
);
...
...
src/plugins/qmldesigner/designercore/include/qmlmodelview.h
View file @
e3376b6d
...
...
@@ -119,6 +119,7 @@ public:
void
scriptFunctionsChanged
(
const
ModelNode
&
node
,
const
QStringList
&
scriptFunctionList
);
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
protected:
NodeInstance
instanceForModelNode
(
const
ModelNode
&
modelNode
);
...
...
src/plugins/qmldesigner/designercore/include/rewriterview.h
View file @
e3376b6d
...
...
@@ -152,6 +152,7 @@ public:
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
importsChanged
(
const
QList
<
Import
>
&
addedImports
,
const
QList
<
Import
>
&
removedImports
);
void
fileUrlChanged
(
const
QUrl
&
oldUrl
,
const
QUrl
&
newUrl
);
...
...
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