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
Marco Bubke
flatpak-qt-creator
Commits
8936292d
Commit
8936292d
authored
Jul 13, 2010
by
Lasse Holmstedt
Committed by
Olivier Goffart
Jul 14, 2010
Browse files
modified selection to accept items without id's
also cleaned up old stuff
parent
42abd8b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmljseditor/qmljseditor.cpp
View file @
8936292d
...
...
@@ -859,7 +859,6 @@ class SelectedElement: protected Visitor
{
unsigned
cursorPositionStart
;
unsigned
cursorPositionEnd
;
UiObjectMember
*
containedBy
;
QList
<
UiObjectMember
*>
selectedMembers
;
public:
...
...
@@ -868,7 +867,6 @@ public:
QList
<
UiObjectMember
*>
operator
()(
Node
*
root
,
unsigned
startPosition
,
unsigned
endPosition
)
{
containedBy
=
false
;
cursorPositionStart
=
startPosition
;
cursorPositionEnd
=
endPosition
;
selectedMembers
.
clear
();
...
...
@@ -877,6 +875,25 @@ public:
}
protected:
bool
isAcceptableParent
(
UiObjectMember
*
member
)
const
{
UiQualifiedId
*
id
=
0
;
if
(
UiObjectDefinition
*
def
=
cast
<
UiObjectDefinition
*>
(
member
))
id
=
def
->
qualifiedTypeNameId
;
else
if
(
UiObjectBinding
*
binding
=
cast
<
UiObjectBinding
*>
(
member
))
id
=
binding
->
qualifiedTypeNameId
;
if
(
id
)
{
QString
name
=
id
->
name
->
asString
();
if
(
!
name
.
isEmpty
()
&&
name
.
at
(
0
).
isUpper
())
{
return
true
;
}
}
return
false
;
}
UiObjectInitializer
*
initializer
(
UiObjectMember
*
member
)
const
{
if
(
UiObjectDefinition
*
def
=
cast
<
UiObjectDefinition
*>
(
member
))
...
...
@@ -917,8 +934,7 @@ protected:
virtual
void
postVisit
(
Node
*
ast
)
{
if
((
cursorPositionStart
==
cursorPositionEnd
&&
!
selectedMembers
.
isEmpty
())
/*|| (cursorPositionStart != cursorPositionEnd && containedBy != 0)*/
)
if
((
cursorPositionStart
==
cursorPositionEnd
&&
!
selectedMembers
.
isEmpty
()))
return
;
// nothing to do, we already have the results.
if
(
UiObjectMember
*
member
=
ast
->
uiObjectMemberCast
())
{
...
...
@@ -928,12 +944,9 @@ protected:
if
((
cursorPositionStart
!=
cursorPositionEnd
&&
intersectsCursor
(
begin
,
end
))
||
(
cursorPositionStart
==
cursorPositionEnd
&&
containsCursor
(
begin
,
end
)))
{
if
(
containsCursor
(
begin
,
end
))
containedBy
=
member
;
if
(
UiObjectInitializer
*
init
=
initializer
(
member
))
{
for
(
UiObjectMemberList
*
it
=
init
->
members
;
it
;
it
=
it
->
next
)
{
if
(
is
IdBinding
(
it
->
member
))
{
if
(
is
AcceptableParent
(
member
))
{
selectedMembers
<<
member
;
// move start towards end; this facilitates multiselection so that root is usually ignored.
cursorPositionStart
=
qMin
(
end
,
cursorPositionEnd
);
...
...
src/plugins/qmljsinspector/qmljslivetextpreview.cpp
View file @
8936292d
...
...
@@ -94,7 +94,7 @@ void QmlJSLiveTextPreview::changeSelectedElements(QList<int> offsets, const QStr
if
(
offset
>=
0
)
{
QList
<
QDeclarativeDebugObjectReference
>
list
=
objectReferencesForOffset
(
offset
);
if
(
!
containsReference
)
{
if
(
!
containsReference
&&
objectRefUnderCursor
.
debugId
()
!=
-
1
)
{
foreach
(
const
QDeclarativeDebugObjectReference
&
ref
,
list
)
{
if
(
ref
.
debugId
()
==
objectRefUnderCursor
.
debugId
())
{
containsReference
=
true
;
...
...
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