Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Hunger
qt-creator
Commits
e5367131
Commit
e5367131
authored
Feb 02, 2010
by
Erik Verbruggen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the import notifications to distinguish between adds/removes.
parent
1cbee8cd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
27 deletions
+66
-27
src/plugins/qmldesigner/core/include/abstractview.h
src/plugins/qmldesigner/core/include/abstractview.h
+2
-1
src/plugins/qmldesigner/core/include/forwardview.h
src/plugins/qmldesigner/core/include/forwardview.h
+14
-4
src/plugins/qmldesigner/core/include/rewriterview.h
src/plugins/qmldesigner/core/include/rewriterview.h
+3
-0
src/plugins/qmldesigner/core/model/abstractview.cpp
src/plugins/qmldesigner/core/model/abstractview.cpp
+11
-3
src/plugins/qmldesigner/core/model/model.cpp
src/plugins/qmldesigner/core/model/model.cpp
+10
-17
src/plugins/qmldesigner/core/model/model_p.h
src/plugins/qmldesigner/core/model/model_p.h
+2
-2
src/plugins/qmldesigner/core/model/rewriterview.cpp
src/plugins/qmldesigner/core/model/rewriterview.cpp
+24
-0
No files found.
src/plugins/qmldesigner/core/include/abstractview.h
View file @
e5367131
...
...
@@ -120,7 +120,8 @@ public:
virtual
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
)
=
0
;
virtual
void
importsChanged
();
virtual
void
importAdded
(
const
Import
&
import
);
virtual
void
importRemoved
(
const
Import
&
import
);
virtual
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
...
...
src/plugins/qmldesigner/core/include/forwardview.h
View file @
e5367131
...
...
@@ -71,7 +71,8 @@ public:
void
nodeOrderChanged
(
const
NodeListProperty
&
listProperty
,
const
ModelNode
&
movedNode
,
int
oldIndex
);
void
importsChanged
();
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
auxiliaryDataChanged
(
const
ModelNode
&
node
,
const
QString
&
name
,
const
QVariant
&
data
);
...
...
@@ -218,12 +219,21 @@ void ForwardView<ViewType>::nodeOrderChanged(const NodeListProperty &listPropert
}
template
<
class
ViewType
>
void
ForwardView
<
ViewType
>::
import
sChanged
(
)
void
ForwardView
<
ViewType
>::
import
Added
(
const
Import
&
import
)
{
AbstractView
::
import
sChanged
(
);
AbstractView
::
import
Added
(
import
);
foreach
(
const
ViewTypePointer
&
view
,
m_targetViewList
)
view
->
importsChanged
();
view
->
importAdded
(
import
);
}
template
<
class
ViewType
>
void
ForwardView
<
ViewType
>::
importRemoved
(
const
Import
&
import
)
{
AbstractView
::
importRemoved
(
import
);
foreach
(
const
ViewTypePointer
&
view
,
m_targetViewList
)
view
->
importRemoved
(
import
);
}
template
<
class
ViewType
>
...
...
src/plugins/qmldesigner/core/include/rewriterview.h
View file @
e5367131
...
...
@@ -125,6 +125,9 @@ public:
void
nodeTypeChanged
(
const
ModelNode
&
node
,
const
QString
&
type
,
int
majorVersion
,
int
minorVersion
);
void
customNotification
(
const
AbstractView
*
view
,
const
QString
&
identifier
,
const
QList
<
ModelNode
>
&
nodeList
,
const
QList
<
QVariant
>
&
data
);
void
importAdded
(
const
Import
&
import
);
void
importRemoved
(
const
Import
&
import
);
void
fileUrlChanged
(
const
QUrl
&
oldUrl
,
const
QUrl
&
newUrl
);
void
selectedNodesChanged
(
const
QList
<
ModelNode
>
&
selectedNodeList
,
const
QList
<
ModelNode
>
&
lastSelectedNodeList
);
...
...
src/plugins/qmldesigner/core/model/abstractview.cpp
View file @
e5367131
...
...
@@ -203,10 +203,18 @@ void AbstractView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*/
}
/*!
\fn AbstractView::import
sChanged(
)
\brief Called when
the imports for the model change.
\fn AbstractView::import
Added(const Import &import
)
\brief Called when
an import has been added to the model
*/
void
AbstractView
::
importsChanged
()
void
AbstractView
::
importAdded
(
const
Import
&
/*import*/
)
{
}
/*!
\fn AbstractView::importRemoved(const Import &import)
\brief Called when an import has been removed from the model
*/
void
AbstractView
::
importRemoved
(
const
Import
&
/*import*/
)
{
}
...
...
src/plugins/qmldesigner/core/model/model.cpp
View file @
e5367131
...
...
@@ -117,26 +117,13 @@ Model *ModelPrivate::create(QString type, int major, int minor)
return
model
;
}
void
ModelPrivate
::
setImports
(
const
QSet
<
Import
>
&
imports
)
{
QList
<
Import
>
added
=
QSet
<
Import
>
(
imports
).
subtract
(
m_imports
).
toList
();
QList
<
Import
>
removed
=
QSet
<
Import
>
(
m_imports
).
subtract
(
imports
).
toList
();
if
(
added
.
isEmpty
()
&&
removed
.
isEmpty
())
return
;
m_imports
=
imports
;
notifyImportsChanged
();
}
void
ModelPrivate
::
addImport
(
const
Import
&
import
)
{
if
(
m_imports
.
contains
(
import
))
return
;
m_imports
.
insert
(
import
);
notifyImport
sChanged
(
);
notifyImport
Added
(
import
);
}
void
ModelPrivate
::
removeImport
(
const
Import
&
import
)
...
...
@@ -144,13 +131,19 @@ void ModelPrivate::removeImport(const Import &import)
if
(
!
m_imports
.
remove
(
import
))
return
;
notifyImportsChanged
();
notifyImportRemoved
(
import
);
}
void
ModelPrivate
::
notifyImportAdded
(
const
Import
&
import
)
const
{
foreach
(
const
QWeakPointer
<
AbstractView
>
&
view
,
m_viewList
)
view
->
importAdded
(
import
);
}
void
ModelPrivate
::
notifyImport
sChanged
(
)
const
void
ModelPrivate
::
notifyImport
Removed
(
const
Import
&
import
)
const
{
foreach
(
const
QWeakPointer
<
AbstractView
>
&
view
,
m_viewList
)
view
->
import
sChanged
(
);
view
->
import
Removed
(
import
);
}
QUrl
ModelPrivate
::
fileUrl
()
const
...
...
src/plugins/qmldesigner/core/model/model_p.h
View file @
e5367131
...
...
@@ -155,10 +155,10 @@ public:
// Imports:
QSet
<
Import
>
imports
()
const
{
return
m_imports
;
}
void
setImports
(
const
QSet
<
Import
>
&
imports
);
void
addImport
(
const
Import
&
import
);
void
removeImport
(
const
Import
&
import
);
void
notifyImportsChanged
()
const
;
void
notifyImportAdded
(
const
Import
&
import
)
const
;
void
notifyImportRemoved
(
const
Import
&
import
)
const
;
//node state property manipulation
...
...
src/plugins/qmldesigner/core/model/rewriterview.cpp
View file @
e5367131
...
...
@@ -261,6 +261,30 @@ void RewriterView::nodeReparented(const ModelNode &node, const NodeAbstractPrope
applyChanges
();
}
void
RewriterView
::
importAdded
(
const
Import
&
import
)
{
Q_ASSERT
(
textModifier
());
if
(
textToModelMerger
()
->
isActive
())
return
;
modelToTextMerger
()
->
addImport
(
import
);
if
(
!
isModificationGroupActive
())
applyChanges
();
}
void
RewriterView
::
importRemoved
(
const
Import
&
import
)
{
Q_ASSERT
(
textModifier
());
if
(
textToModelMerger
()
->
isActive
())
return
;
modelToTextMerger
()
->
removeImport
(
import
);
if
(
!
isModificationGroupActive
())
applyChanges
();
}
void
RewriterView
::
fileUrlChanged
(
const
QUrl
&
/*oldUrl*/
,
const
QUrl
&
/*newUrl*/
)
{
}
...
...
Write
Preview
Markdown
is supported
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