forked from qt-creator/qt-creator
fixed singleselection for states qml file
This commit is contained in:
@@ -1002,6 +1002,11 @@ protected:
|
|||||||
return (cursorPositionEnd >= begin && cursorPositionStart <= end);
|
return (cursorPositionEnd >= begin && cursorPositionStart <= end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isRangeSelected() const
|
||||||
|
{
|
||||||
|
return (cursorPositionStart != cursorPositionEnd);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void postVisit(Node *ast)
|
virtual void postVisit(Node *ast)
|
||||||
{
|
{
|
||||||
if ((cursorPositionStart == cursorPositionEnd && !selectedMembers.isEmpty()))
|
if ((cursorPositionStart == cursorPositionEnd && !selectedMembers.isEmpty()))
|
||||||
@@ -1011,12 +1016,13 @@ protected:
|
|||||||
unsigned begin = member->firstSourceLocation().begin();
|
unsigned begin = member->firstSourceLocation().begin();
|
||||||
unsigned end = member->lastSourceLocation().end();
|
unsigned end = member->lastSourceLocation().end();
|
||||||
|
|
||||||
if ((cursorPositionStart != cursorPositionEnd && intersectsCursor(begin, end))
|
if ((isRangeSelected() && intersectsCursor(begin, end))
|
||||||
|| (cursorPositionStart == cursorPositionEnd && containsCursor(begin, end)))
|
|| (!isRangeSelected() && containsCursor(begin, end)))
|
||||||
{
|
{
|
||||||
if (UiObjectInitializer *init = initializer(member)) {
|
if (UiObjectInitializer *init = initializer(member)) {
|
||||||
for (UiObjectMemberList *it = init->members; it; it = it->next) {
|
for (UiObjectMemberList *it = init->members; it; it = it->next) {
|
||||||
if (isAcceptableParent(member)) {
|
if ((isRangeSelected() && isAcceptableParent(member))
|
||||||
|
|| (!isRangeSelected() && isIdBinding(it->member))) {
|
||||||
selectedMembers << member;
|
selectedMembers << member;
|
||||||
// move start towards end; this facilitates multiselection so that root is usually ignored.
|
// move start towards end; this facilitates multiselection so that root is usually ignored.
|
||||||
cursorPositionStart = qMin(end, cursorPositionEnd);
|
cursorPositionStart = qMin(end, cursorPositionEnd);
|
||||||
|
Reference in New Issue
Block a user