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
4a4fc858
Commit
4a4fc858
authored
Jul 14, 2010
by
Lasse Holmstedt
Committed by
Olivier Goffart
Jul 14, 2010
Browse files
update object tree when unknown debug id is received
parent
6532fe5c
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmljsinspector/qmljsclientproxy.cpp
View file @
4a4fc858
...
...
@@ -66,8 +66,8 @@ bool ClientProxy::connectToViewer(const QString &host, quint16 port)
if
(
m_designClient
)
{
disconnect
(
m_designClient
,
SIGNAL
(
currentObjectsChanged
(
QList
<
QDeclarativeDebugObjectReference
>
)),
this
,
S
IGNAL
(
selectedItemsChanged
(
QList
<
QDeclarativeDebugObjectReference
>
)));
disconnect
(
m_designClient
,
SIGNAL
(
currentObjectsChanged
(
QList
<
int
>
)),
this
,
S
LOT
(
onCurrentObjectsChanged
(
QList
<
int
>
)));
disconnect
(
m_designClient
,
SIGNAL
(
colorPickerActivated
()),
this
,
SIGNAL
(
colorPickerActivated
()));
disconnect
(
m_designClient
,
...
...
@@ -113,6 +113,37 @@ bool ClientProxy::connectToViewer(const QString &host, quint16 port)
return
true
;
}
void
ClientProxy
::
onCurrentObjectsChanged
(
const
QList
<
int
>
&
debugIds
)
{
QList
<
QDeclarativeDebugObjectReference
>
selectedItems
;
foreach
(
int
debugId
,
debugIds
)
{
QDeclarativeDebugObjectReference
ref
=
objectReferenceForId
(
debugId
);
if
(
ref
.
debugId
()
!=
-
1
)
{
selectedItems
<<
ref
;
}
else
{
// ### FIXME right now, there's no way in the protocol to
// a) get some item and know its parent (although that's possible by adding it to a separate plugin)
// b) add children to part of an existing tree.
// So the only choice that remains is to update the complete tree when we have an unknown debug id.
if
(
!
m_objectTreeQuery
)
{
m_objectTreeQuery
=
m_client
->
queryObjectRecursive
(
m_rootObject
,
this
);
if
(
!
m_objectTreeQuery
->
isWaiting
())
{
objectTreeFetched
();
}
else
{
connect
(
m_objectTreeQuery
,
SIGNAL
(
stateChanged
(
QDeclarativeDebugQuery
::
State
)),
SLOT
(
objectTreeFetched
(
QDeclarativeDebugQuery
::
State
)));
}
}
}
}
emit
selectedItemsChanged
(
selectedItems
);
}
void
ClientProxy
::
disconnectFromViewer
()
{
m_conn
->
disconnectFromHost
();
...
...
@@ -162,8 +193,8 @@ void ClientProxy::connectionStateChanged()
emit
connected
(
m_client
);
connect
(
m_designClient
,
SIGNAL
(
currentObjectsChanged
(
QList
<
QDeclarativeDebugObjectReference
>
)),
S
IGNAL
(
selectedItemsChanged
(
QList
<
QDeclarativeDebugObjectReference
>
)));
SIGNAL
(
currentObjectsChanged
(
QList
<
int
>
)),
S
LOT
(
onCurrentObjectsChanged
(
QList
<
int
>
)));
connect
(
m_designClient
,
SIGNAL
(
colorPickerActivated
()),
SIGNAL
(
colorPickerActivated
()));
connect
(
m_designClient
,
...
...
src/plugins/qmljsinspector/qmljsclientproxy.h
View file @
4a4fc858
...
...
@@ -112,6 +112,7 @@ private slots:
void
connectionStateChanged
();
void
connectionError
();
void
onCurrentObjectsChanged
(
const
QList
<
int
>
&
debugIds
);
void
updateEngineList
();
void
objectTreeFetched
(
QDeclarativeDebugQuery
::
State
state
=
QDeclarativeDebugQuery
::
Completed
);
...
...
src/plugins/qmljsinspector/qmljsdesigndebugclient.cpp
View file @
4a4fc858
...
...
@@ -61,21 +61,20 @@ void QmlJSDesignDebugClient::messageReceived(const QByteArray &message)
QByteArray
type
;
ds
>>
type
;
QList
<
QDeclarativeDebugObjectReference
>
references
;
if
(
type
==
"CURRENT_OBJECTS_CHANGED"
)
{
int
objectCount
;
ds
>>
objectCount
;
QList
<
int
>
debugIds
;
for
(
int
i
=
0
;
i
<
objectCount
;
++
i
)
{
int
debugId
;
ds
>>
debugId
;
if
(
debugId
!=
-
1
)
{
QDeclarativeDebugObjectReference
ref
=
ClientProxy
::
instance
()
->
objectReferenceForId
(
debugId
);
if
(
ref
.
debugId
()
!=
-
1
)
references
<<
ref
;
debugIds
<<
debugId
;
}
}
emit
currentObjectsChanged
(
references
);
emit
currentObjectsChanged
(
debugIds
);
}
else
if
(
type
==
"TOOL_CHANGED"
)
{
int
toolId
;
ds
>>
toolId
;
...
...
src/plugins/qmljsinspector/qmljsdesigndebugclient.h
View file @
4a4fc858
...
...
@@ -68,7 +68,7 @@ public:
void
applyChangesFromQmlFile
();
signals:
void
currentObjectsChanged
(
const
QList
<
QDeclarativeDebugObjectReference
>
&
currentObject
s
);
void
currentObjectsChanged
(
const
QList
<
int
>
&
debugId
s
);
void
colorPickerActivated
();
void
selectToolActivated
();
void
selectMarqueeToolActivated
();
...
...
src/plugins/qmljsinspector/qmljslivetextpreview.cpp
View file @
4a4fc858
...
...
@@ -143,6 +143,7 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
if
(
doc
&&
m_previousDoc
&&
doc
->
fileName
()
==
m_previousDoc
->
fileName
()
&&
doc
->
qmlProgram
()
&&
m_previousDoc
->
qmlProgram
())
{
if
(
m_debugIds
.
isEmpty
())
m_debugIds
=
m_initialTable
.
value
(
doc
->
fileName
());
Delta
delta
;
m_debugIds
=
delta
(
m_previousDoc
,
doc
,
m_debugIds
);
...
...
src/tools/qml/qmlviewer/editor/selectionindicator.cpp
View file @
4a4fc858
...
...
@@ -68,20 +68,12 @@ void SelectionIndicator::clear()
m_indicatorShapeHash
.
clear
();
}
//static void alignVertices(QPolygonF &polygon, double factor)
//{
// QMutableVectorIterator<QPointF> iterator(polygon);
// while (iterator.hasNext()) {
// QPointF &vertex = iterator.next();
// vertex.setX(std::floor(vertex.x()) + factor);
// vertex.setY(std::floor(vertex.y()) + factor);
// }
//
//}
QPolygonF
SelectionIndicator
::
addBoundingRectToPolygon
(
QGraphicsItem
*
item
,
QPolygonF
&
polygon
)
{
polygon
=
polygon
.
united
(
item
->
mapToScene
(
item
->
boundingRect
()));
// ### remove this if statement when QTBUG-12172 gets fixed
if
(
item
->
boundingRect
()
!=
QRectF
(
0
,
0
,
0
,
0
))
polygon
=
polygon
.
united
(
item
->
mapToScene
(
item
->
boundingRect
()));
foreach
(
QGraphicsItem
*
child
,
item
->
childItems
())
{
if
(
!
m_view
->
isEditorItem
(
child
))
addBoundingRectToPolygon
(
child
,
polygon
);
...
...
@@ -104,7 +96,6 @@ void SelectionIndicator::setItems(const QList<QGraphicsObject*> &itemList)
QPolygonF
boundingRectInLayerItemSpace
=
m_layerItem
->
mapFromScene
(
boundingShapeInSceneSpace
);
QPen
pen
;
pen
.
setColor
(
QColor
(
108
,
141
,
221
));
newSelectionIndicatorGraphicsItem
->
setData
(
Constants
::
EditorItemDataKey
,
QVariant
(
true
));
...
...
src/tools/qml/qmlviewer/qdeclarativedesignview.cpp
View file @
4a4fc858
...
...
@@ -120,10 +120,7 @@ void QDeclarativeDesignView::mouseReleaseEvent(QMouseEvent *event)
m_cursorPos
=
event
->
pos
();
m_currentTool
->
mouseReleaseEvent
(
event
);
if
(
event
->
buttons
()
&
Qt
::
LeftButton
)
{
qDebug
()
<<
"setting current objects"
;
qmlDesignDebugServer
()
->
setCurrentObjects
(
AbstractFormEditorTool
::
toObjectList
(
selectedItems
()));
}
qmlDesignDebugServer
()
->
setCurrentObjects
(
AbstractFormEditorTool
::
toObjectList
(
selectedItems
()));
}
void
QDeclarativeDesignView
::
keyPressEvent
(
QKeyEvent
*
event
)
...
...
@@ -447,17 +444,18 @@ QList<QGraphicsItem*> QDeclarativeDesignView::filterForCurrentContext(QList<QGra
foreach
(
QGraphicsItem
*
item
,
itemlist
)
{
if
(
isEditorItem
(
item
)
||
!
m_subcomponentEditorTool
->
isDirectChildOfContext
(
item
))
{
int
index
=
itemlist
.
indexOf
(
item
);
// if we're a child, but not directly, replace with the parent that is directly in context.
if
(
QGraphicsItem
*
contextParent
=
m_subcomponentEditorTool
->
firstChildOfContext
(
item
))
{
if
(
index
>=
0
)
{
itemlist
.
replace
(
index
,
contextParent
);
}
else
{
itemlist
.
append
(
contextParent
);
if
(
contextParent
!=
item
)
{
if
(
itemlist
.
contains
(
contextParent
))
{
itemlist
.
removeOne
(
item
);
}
else
{
itemlist
.
replace
(
itemlist
.
indexOf
(
item
),
contextParent
);
}
}
}
else
{
itemlist
.
remove
At
(
index
);
itemlist
.
remove
One
(
item
);
}
}
}
...
...
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