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
a5d3fcbc
Commit
a5d3fcbc
authored
Feb 22, 2011
by
Thorbjørn Lindeijer
Browse files
QmlJSDebugger: Code cosmetics
parent
b23c24d2
Changes
14
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/qml/qmljsdebugger/editor/abstractliveedittool.cpp
View file @
a5d3fcbc
...
...
@@ -151,7 +151,7 @@ QList<QGraphicsObject*> AbstractLiveEditTool::toGraphicsObjectList(const QList<Q
&
itemList
)
{
QList
<
QGraphicsObject
*>
gfxObjects
;
foreach
(
QGraphicsItem
*
item
,
itemList
)
{
foreach
(
QGraphicsItem
*
item
,
itemList
)
{
QGraphicsObject
*
obj
=
item
->
toGraphicsObject
();
if
(
obj
)
gfxObjects
<<
obj
;
...
...
share/qtcreator/qml/qmljsdebugger/editor/boundingrecthighlighter.cpp
View file @
a5d3fcbc
...
...
@@ -106,7 +106,7 @@ void BoundingRectHighlighter::animTimeout()
qreal
alpha
=
m_animFrame
/
float
(
AnimFrames
);
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
box
->
highlightPolygonEdge
->
setOpacity
(
alpha
);
}
}
...
...
@@ -116,7 +116,7 @@ void BoundingRectHighlighter::clear()
if
(
m_boxes
.
length
())
{
m_animTimer
->
stop
();
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
freeBoundingBox
(
box
);
}
}
...
...
@@ -124,7 +124,7 @@ void BoundingRectHighlighter::clear()
BoundingBox
*
BoundingRectHighlighter
::
boxFor
(
QGraphicsObject
*
item
)
const
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
if
(
box
->
highlightedObject
.
data
()
==
item
)
{
return
box
;
}
...
...
@@ -140,7 +140,7 @@ void BoundingRectHighlighter::highlight(QList<QGraphicsObject*> items)
bool
animate
=
false
;
QList
<
BoundingBox
*>
newBoxes
;
foreach
(
QGraphicsObject
*
itemToHighlight
,
items
)
{
foreach
(
QGraphicsObject
*
itemToHighlight
,
items
)
{
BoundingBox
*
box
=
boxFor
(
itemToHighlight
);
if
(
!
box
)
{
box
=
createBoundingBox
(
itemToHighlight
);
...
...
@@ -227,7 +227,7 @@ void BoundingRectHighlighter::freeBoundingBox(BoundingBox *box)
void
BoundingRectHighlighter
::
itemDestroyed
(
QObject
*
obj
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
if
(
box
->
highlightedObject
.
data
()
==
obj
)
{
freeBoundingBox
(
box
);
break
;
...
...
@@ -237,7 +237,7 @@ void BoundingRectHighlighter::itemDestroyed(QObject *obj)
void
BoundingRectHighlighter
::
highlightAll
(
bool
animate
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
foreach
(
BoundingBox
*
box
,
m_boxes
)
{
if
(
box
&&
box
->
highlightedObject
.
isNull
())
{
// clear all highlights
clear
();
...
...
share/qtcreator/qml/qmljsdebugger/editor/liveselectionindicator.cpp
View file @
a5d3fcbc
...
...
@@ -93,7 +93,7 @@ QPolygonF LiveSelectionIndicator::addBoundingRectToPolygon(QGraphicsItem *item,
polygon
=
polygon
.
united
(
bounding
);
}
foreach
(
QGraphicsItem
*
child
,
item
->
childItems
())
{
foreach
(
QGraphicsItem
*
child
,
item
->
childItems
())
{
if
(
!
QDeclarativeViewObserverPrivate
::
get
(
m_view
)
->
isEditorItem
(
child
))
addBoundingRectToPolygon
(
child
,
polygon
);
}
...
...
share/qtcreator/qml/qmljsdebugger/editor/liveselectiontool.cpp
View file @
a5d3fcbc
...
...
@@ -96,11 +96,9 @@ bool LiveSelectionTool::alreadySelected(const QList<QGraphicsItem*> &itemList) c
if
(
selectedItems
.
isEmpty
())
return
false
;
foreach
(
QGraphicsItem
*
item
,
itemList
)
{
if
(
selectedItems
.
contains
(
item
))
{
foreach
(
QGraphicsItem
*
item
,
itemList
)
if
(
selectedItems
.
contains
(
item
))
return
true
;
}
}
return
false
;
}
...
...
@@ -143,7 +141,7 @@ void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint
bool
addKeySequence
=
true
;
int
i
=
0
;
foreach
(
QGraphicsItem
*
const
item
,
itemList
)
{
foreach
(
QGraphicsItem
*
const
item
,
itemList
)
{
QString
itemTitle
=
titleForItem
(
item
);
QAction
*
elementAction
=
contextMenu
.
addAction
(
itemTitle
,
this
,
SLOT
(
contextMenuElementSelected
()));
...
...
@@ -237,7 +235,7 @@ void LiveSelectionTool::hoverMoveEvent(QMouseEvent * event)
// QList<QGraphicsItem*> itemList = view()->items(event->pos());
// if (!itemList.isEmpty() && !m_rubberbandSelectionMode) {
//
// foreach(QGraphicsItem *item, itemList) {
// foreach
(QGraphicsItem *item, itemList) {
// if (item->type() == Constants::ResizeHandleItemType) {
// ResizeHandleItem* resizeHandle = ResizeHandleItem::fromGraphicsItem(item);
// if (resizeHandle)
...
...
@@ -305,7 +303,6 @@ void LiveSelectionTool::mouseReleaseEvent(QMouseEvent *event)
void
LiveSelectionTool
::
mouseDoubleClickEvent
(
QMouseEvent
*
/*event*/
)
{
}
void
LiveSelectionTool
::
keyPressEvent
(
QKeyEvent
*
event
)
...
...
@@ -373,7 +370,6 @@ void LiveSelectionTool::setSelectOnlyContentItems(bool selectOnlyContentItems)
void
LiveSelectionTool
::
itemsAboutToRemoved
(
const
QList
<
QGraphicsItem
*>
&
/*itemList*/
)
{
}
void
LiveSelectionTool
::
clear
()
...
...
@@ -387,7 +383,7 @@ void LiveSelectionTool::clear()
void
LiveSelectionTool
::
selectedItemsChanged
(
const
QList
<
QGraphicsItem
*>
&
itemList
)
{
foreach
(
QWeakPointer
<
QGraphicsObject
>
obj
,
m_selectedItemList
)
{
foreach
(
QWeakPointer
<
QGraphicsObject
>
obj
,
m_selectedItemList
)
{
if
(
!
obj
.
isNull
())
{
disconnect
(
obj
.
data
(),
SIGNAL
(
xChanged
()),
this
,
SLOT
(
repaintBoundingRects
()));
disconnect
(
obj
.
data
(),
SIGNAL
(
yChanged
()),
this
,
SLOT
(
repaintBoundingRects
()));
...
...
@@ -400,7 +396,7 @@ void LiveSelectionTool::selectedItemsChanged(const QList<QGraphicsItem*> &itemLi
QList
<
QGraphicsObject
*>
objects
=
toGraphicsObjectList
(
itemList
);
m_selectedItemList
.
clear
();
foreach
(
QGraphicsObject
*
obj
,
objects
)
{
foreach
(
QGraphicsObject
*
obj
,
objects
)
{
m_selectedItemList
.
append
(
obj
);
connect
(
obj
,
SIGNAL
(
xChanged
()),
this
,
SLOT
(
repaintBoundingRects
()));
connect
(
obj
,
SIGNAL
(
yChanged
()),
this
,
SLOT
(
repaintBoundingRects
()));
...
...
share/qtcreator/qml/qmljsdebugger/editor/livesingleselectionmanipulator.cpp
View file @
a5d3fcbc
...
...
@@ -76,7 +76,7 @@ void LiveSingleSelectionManipulator::select(SelectionType selectionType,
{
QGraphicsItem
*
selectedItem
=
0
;
foreach
(
QGraphicsItem
*
item
,
items
)
foreach
(
QGraphicsItem
*
item
,
items
)
{
//FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
if
(
item
...
...
share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.cpp
View file @
a5d3fcbc
...
...
@@ -43,7 +43,7 @@
namespace
QmlJSDebugger
{
QmlTool
b
ar
::
QmlTool
b
ar
(
QWidget
*
parent
)
QmlTool
B
ar
::
QmlTool
B
ar
(
QWidget
*
parent
)
:
QToolBar
(
parent
)
,
m_emitSignals
(
true
)
,
m_isRunning
(
false
)
...
...
@@ -150,40 +150,40 @@ QmlToolbar::QmlToolbar(QWidget *parent)
connect
(
ui
->
fromQml
,
SIGNAL
(
triggered
()),
SLOT
(
activateFromQml
()));
}
QmlTool
b
ar
::~
QmlTool
b
ar
()
QmlTool
B
ar
::~
QmlTool
B
ar
()
{
delete
ui
;
}
void
QmlTool
b
ar
::
activateColorPicker
()
void
QmlTool
B
ar
::
activateColorPicker
()
{
m_emitSignals
=
false
;
activateColorPickerOnClick
();
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
activateSelectTool
()
void
QmlTool
B
ar
::
activateSelectTool
()
{
m_emitSignals
=
false
;
activateSelectToolOnClick
();
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
activateMarqueeSelectTool
()
void
QmlTool
B
ar
::
activateMarqueeSelectTool
()
{
m_emitSignals
=
false
;
activateMarqueeSelectToolOnClick
();
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
activateZoom
()
void
QmlTool
B
ar
::
activateZoom
()
{
m_emitSignals
=
false
;
activateZoomOnClick
();
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
setAnimationSpeed
(
qreal
slowdownFactor
)
void
QmlTool
B
ar
::
setAnimationSpeed
(
qreal
slowdownFactor
)
{
m_emitSignals
=
false
;
if
(
slowdownFactor
!=
0
)
{
...
...
@@ -209,38 +209,38 @@ void QmlToolbar::setAnimationSpeed(qreal slowdownFactor)
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
changeToDefaultAnimSpeed
()
void
QmlTool
B
ar
::
changeToDefaultAnimSpeed
()
{
m_animationSpeed
=
1.0
f
;
updatePlayAction
();
}
void
QmlTool
b
ar
::
changeToHalfAnimSpeed
()
void
QmlTool
B
ar
::
changeToHalfAnimSpeed
()
{
m_animationSpeed
=
2.0
f
;
updatePlayAction
();
}
void
QmlTool
b
ar
::
changeToFourthAnimSpeed
()
void
QmlTool
B
ar
::
changeToFourthAnimSpeed
()
{
m_animationSpeed
=
4.0
f
;
updatePlayAction
();
}
void
QmlTool
b
ar
::
changeToEighthAnimSpeed
()
void
QmlTool
B
ar
::
changeToEighthAnimSpeed
()
{
m_animationSpeed
=
8.0
f
;
updatePlayAction
();
}
void
QmlTool
b
ar
::
changeToTenthAnimSpeed
()
void
QmlTool
B
ar
::
changeToTenthAnimSpeed
()
{
m_animationSpeed
=
10.0
f
;
updatePlayAction
();
}
void
QmlTool
b
ar
::
setDesignModeBehavior
(
bool
inDesignMode
)
void
QmlTool
B
ar
::
setDesignModeBehavior
(
bool
inDesignMode
)
{
m_emitSignals
=
false
;
ui
->
designmode
->
setChecked
(
inDesignMode
);
...
...
@@ -248,7 +248,7 @@ void QmlToolbar::setDesignModeBehavior(bool inDesignMode)
m_emitSignals
=
true
;
}
void
QmlTool
b
ar
::
setDesignModeBehaviorOnClick
(
bool
checked
)
void
QmlTool
B
ar
::
setDesignModeBehaviorOnClick
(
bool
checked
)
{
ui
->
play
->
setEnabled
(
checked
);
ui
->
select
->
setEnabled
(
checked
);
...
...
@@ -262,12 +262,12 @@ void QmlToolbar::setDesignModeBehaviorOnClick(bool checked)
emit
designModeBehaviorChanged
(
checked
);
}
void
QmlTool
b
ar
::
setColorBoxColor
(
const
QColor
&
color
)
void
QmlTool
B
ar
::
setColorBoxColor
(
const
QColor
&
color
)
{
ui
->
colorBox
->
setColor
(
color
);
}
void
QmlTool
b
ar
::
activatePlayOnClick
()
void
QmlTool
B
ar
::
activatePlayOnClick
()
{
if
(
m_isRunning
)
{
updatePauseAction
();
...
...
@@ -276,7 +276,7 @@ void QmlToolbar::activatePlayOnClick()
}
}
void
QmlTool
b
ar
::
updatePlayAction
()
void
QmlTool
B
ar
::
updatePlayAction
()
{
m_isRunning
=
true
;
ui
->
play
->
setIcon
(
ui
->
pauseIcon
);
...
...
@@ -287,7 +287,7 @@ void QmlToolbar::updatePlayAction()
emit
animationSpeedChanged
(
m_animationSpeed
);
}
void
QmlTool
b
ar
::
updatePauseAction
()
void
QmlTool
B
ar
::
updatePauseAction
()
{
m_isRunning
=
false
;
ui
->
play
->
setIcon
(
ui
->
playIcon
);
...
...
@@ -295,7 +295,7 @@ void QmlToolbar::updatePauseAction()
emit
animationSpeedChanged
(
0.0
f
);
}
void
QmlTool
b
ar
::
activateColorPickerOnClick
()
void
QmlTool
B
ar
::
activateColorPickerOnClick
()
{
ui
->
zoom
->
setChecked
(
false
);
ui
->
select
->
setChecked
(
false
);
...
...
@@ -309,7 +309,7 @@ void QmlToolbar::activateColorPickerOnClick()
}
}
void
QmlTool
b
ar
::
activateSelectToolOnClick
()
void
QmlTool
B
ar
::
activateSelectToolOnClick
()
{
ui
->
zoom
->
setChecked
(
false
);
ui
->
selectMarquee
->
setChecked
(
false
);
...
...
@@ -323,7 +323,7 @@ void QmlToolbar::activateSelectToolOnClick()
}
}
void
QmlTool
b
ar
::
activateMarqueeSelectToolOnClick
()
void
QmlTool
B
ar
::
activateMarqueeSelectToolOnClick
()
{
ui
->
zoom
->
setChecked
(
false
);
ui
->
select
->
setChecked
(
false
);
...
...
@@ -337,7 +337,7 @@ void QmlToolbar::activateMarqueeSelectToolOnClick()
}
}
void
QmlTool
b
ar
::
activateZoomOnClick
()
void
QmlTool
B
ar
::
activateZoomOnClick
()
{
ui
->
select
->
setChecked
(
false
);
ui
->
selectMarquee
->
setChecked
(
false
);
...
...
@@ -351,13 +351,13 @@ void QmlToolbar::activateZoomOnClick()
}
}
void
QmlTool
b
ar
::
activateFromQml
()
void
QmlTool
B
ar
::
activateFromQml
()
{
if
(
m_emitSignals
)
emit
applyChangesFromQmlFileSelected
();
}
void
QmlTool
b
ar
::
activateToQml
()
void
QmlTool
B
ar
::
activateToQml
()
{
if
(
m_emitSignals
)
emit
applyChangesToQmlFileSelected
();
...
...
share/qtcreator/qml/qmljsdebugger/editor/qmltoolbar.h
View file @
a5d3fcbc
...
...
@@ -43,13 +43,13 @@ namespace QmlJSDebugger {
class
ToolBarColorBox
;
class
QmlTool
b
ar
:
public
QToolBar
class
QmlTool
B
ar
:
public
QToolBar
{
Q_OBJECT
public:
explicit
QmlTool
b
ar
(
QWidget
*
parent
=
0
);
~
QmlTool
b
ar
();
explicit
QmlTool
B
ar
(
QWidget
*
parent
=
0
);
~
QmlTool
B
ar
();
public
slots
:
void
setDesignModeBehavior
(
bool
inDesignMode
);
...
...
share/qtcreator/qml/qmljsdebugger/editor/subcomponenteditortool.cpp
View file @
a5d3fcbc
...
...
@@ -182,7 +182,7 @@ void SubcomponentEditorTool::setCurrentItem(QGraphicsItem* contextItem)
//if (parentClassName.contains(QRegExp("_QMLTYPE_\\d+")))
bool
containsSelectableItems
=
false
;
foreach
(
QGraphicsItem
*
item
,
gfxObject
->
childItems
())
{
foreach
(
QGraphicsItem
*
item
,
gfxObject
->
childItems
())
{
if
(
item
->
type
()
==
Constants
::
EditorItemType
||
item
->
type
()
==
Constants
::
ResizeHandleItemType
)
{
...
...
share/qtcreator/qml/qmljsdebugger/editor/zoomtool.cpp
View file @
a5d3fcbc
...
...
@@ -310,12 +310,12 @@ qreal ZoomTool::nextZoomScale(ZoomDirection direction) const
<<
48.0
f
;
if
(
direction
==
ZoomIn
)
{
for
(
int
i
=
0
;
i
<
zoomScales
.
length
();
++
i
)
{
for
(
int
i
=
0
;
i
<
zoomScales
.
length
();
++
i
)
{
if
(
zoomScales
[
i
]
>
m_currentScale
||
i
==
zoomScales
.
length
()
-
1
)
return
zoomScales
[
i
];
}
}
else
{
for
(
int
i
=
zoomScales
.
length
()
-
1
;
i
>=
0
;
--
i
)
{
for
(
int
i
=
zoomScales
.
length
()
-
1
;
i
>=
0
;
--
i
)
{
if
(
zoomScales
[
i
]
<
m_currentScale
||
i
==
0
)
return
zoomScales
[
i
];
}
...
...
share/qtcreator/qml/qmljsdebugger/include/qdeclarativeviewobserver.h
View file @
a5d3fcbc
...
...
@@ -62,7 +62,7 @@ public:
QDeclarativeView
*
declarativeView
();
QToolBar
*
tool
b
ar
()
const
;
QToolBar
*
tool
B
ar
()
const
;
static
QString
idStringForObject
(
QObject
*
obj
);
QRectF
adjustToScreenBoundaries
(
const
QRectF
&
boundingRectInSceneSpace
);
...
...
share/qtcreator/qml/qmljsdebugger/qdeclarativeobserverservice.cpp
View file @
a5d3fcbc
...
...
@@ -77,7 +77,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
ds
>>
itemCount
;
QList
<
QObject
*>
selectedObjects
;
for
(
int
i
=
0
;
i
<
itemCount
;
++
i
)
{
for
(
int
i
=
0
;
i
<
itemCount
;
++
i
)
{
int
debugId
=
-
1
;
ds
>>
debugId
;
QObject
*
obj
=
objectForId
(
debugId
);
...
...
@@ -134,7 +134,7 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
int
itemCount
;
ds
>>
itemCount
;
m_stringIdForObjectId
.
clear
();
for
(
int
i
=
0
;
i
<
itemCount
;
++
i
)
{
for
(
int
i
=
0
;
i
<
itemCount
;
++
i
)
{
int
itemDebugId
;
QString
itemIdString
;
ds
>>
itemDebugId
...
...
@@ -170,7 +170,7 @@ void QDeclarativeObserverService::setCurrentObjects(QList<QObject*> objects)
ds
<<
QByteArray
(
"CURRENT_OBJECTS_CHANGED"
)
<<
objects
.
length
();
foreach
(
QObject
*
object
,
objects
)
{
foreach
(
QObject
*
object
,
objects
)
{
int
id
=
idForObject
(
object
);
ds
<<
id
;
}
...
...
share/qtcreator/qml/qmljsdebugger/qdeclarativeviewobserver.cpp
View file @
a5d3fcbc
...
...
@@ -65,7 +65,7 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie
showAppOnTop
(
false
),
executionPaused
(
false
),
slowdownFactor
(
1.0
f
),
tool
b
ar
(
0
)
tool
B
ar
(
0
)
{
}
...
...
@@ -145,9 +145,8 @@ void QDeclarativeViewObserver::setObserverContext(int contextIndex)
{
if
(
data
->
subcomponentEditorTool
->
contextIndex
()
!=
contextIndex
)
{
QGraphicsObject
*
object
=
data
->
subcomponentEditorTool
->
setContext
(
contextIndex
);
if
(
object
)
{
if
(
object
)
setSelectedItems
(
QList
<
QGraphicsItem
*>
()
<<
object
);
}
}
}
...
...
@@ -163,9 +162,9 @@ void QDeclarativeViewObserverPrivate::setViewport(QWidget *widget)
if
(
viewport
.
data
()
==
widget
)
return
;
if
(
viewport
)
{
if
(
viewport
)
viewport
.
data
()
->
removeEventFilter
(
q
);
}
viewport
=
widget
;
if
(
viewport
)
{
// make sure we get mouse move events
...
...
@@ -192,7 +191,7 @@ bool QDeclarativeViewObserver::eventFilter(QObject *obj, QEvent *event)
return
QObject
::
eventFilter
(
obj
,
event
);
}
//Event from viewport
//
Event from viewport
switch
(
event
->
type
())
{
case
QEvent
::
Leave
:
{
if
(
leaveEvent
(
event
))
...
...
@@ -297,18 +296,17 @@ bool QDeclarativeViewObserver::mouseReleaseEvent(QMouseEvent *event)
bool
QDeclarativeViewObserver
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
!
data
->
designModeBehavior
)
{
if
(
!
data
->
designModeBehavior
)
return
false
;
}
data
->
currentTool
->
keyPressEvent
(
event
);
return
true
;
}
bool
QDeclarativeViewObserver
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
if
(
!
data
->
designModeBehavior
)
{
if
(
!
data
->
designModeBehavior
)
return
false
;
}
switch
(
event
->
key
())
{
case
Qt
::
Key_V
:
...
...
@@ -352,7 +350,7 @@ void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QOb
return
;
QString
imports
;
foreach
(
const
QString
&
s
,
importList
)
{
foreach
(
const
QString
&
s
,
importList
)
{
imports
+=
s
+
"
\n
"
;
}
...
...
@@ -366,9 +364,8 @@ void QDeclarativeViewObserverPrivate::_q_createQmlObject(const QString &qml, QOb
newObject
->
setParent
(
parent
);
QDeclarativeItem
*
parentItem
=
qobject_cast
<
QDeclarativeItem
*>
(
parent
);
QDeclarativeItem
*
newItem
=
qobject_cast
<
QDeclarativeItem
*>
(
newObject
);
if
(
parentItem
&&
newItem
)
{
if
(
parentItem
&&
newItem
)
newItem
->
setParentItem
(
parentItem
);
}
}
}
...
...
@@ -380,9 +377,8 @@ void QDeclarativeViewObserverPrivate::_q_reparentQmlObject(QObject *object, QObj
object
->
setParent
(
newParent
);
QDeclarativeItem
*
newParentItem
=
qobject_cast
<
QDeclarativeItem
*>
(
newParent
);
QDeclarativeItem
*
item
=
qobject_cast
<
QDeclarativeItem
*>
(
object
);
if
(
newParentItem
&&
item
)
{
if
(
newParentItem
&&
item
)
item
->
setParentItem
(
newParentItem
);
}
}
void
QDeclarativeViewObserverPrivate
::
_q_clearComponentCache
()
...
...
@@ -393,9 +389,8 @@ void QDeclarativeViewObserverPrivate::_q_clearComponentCache()
void
QDeclarativeViewObserverPrivate
::
_q_removeFromSelection
(
QObject
*
obj
)
{
QList
<
QGraphicsItem
*>
items
=
selectedItems
();
if
(
QGraphicsItem
*
item
=
dynamic_cast
<
QGraphicsItem
*>
(
obj
))
{
if
(
QGraphicsItem
*
item
=
dynamic_cast
<
QGraphicsItem
*>
(
obj
))
items
.
removeOne
(
item
);
}
setSelectedItems
(
items
);
}
...
...
@@ -430,10 +425,8 @@ bool QDeclarativeViewObserver::mouseDoubleClickEvent(QMouseEvent *event)
data
->
subcomponentEditorTool
->
mouseDoubleClickEvent
(
event
);
if
((
event
->
buttons
()
&
Qt
::
LeftButton
)
&&
itemToEnter
)
{
QGraphicsObject
*
objectToEnter
=
itemToEnter
->
toGraphicsObject
();
if
(
objectToEnter
)
{
if
(
QGraphicsObject
*
objectToEnter
=
itemToEnter
->
toGraphicsObject
())
setSelectedItems
(
QList
<
QGraphicsItem
*>
()
<<
objectToEnter
);
}
}
return
true
;
...
...
@@ -461,7 +454,7 @@ void QDeclarativeViewObserver::setDesignModeBehavior(bool value)
{
emit
designModeBehaviorChanged
(
value
);
data
->
tool
b
ar
->
setDesignModeBehavior
(
value
);
data
->
tool
B
ar
->
setDesignModeBehavior
(
value
);
data
->
debugService
->
setDesignModeBehavior
(
value
);
data
->
designModeBehavior
=
value
;
...
...
@@ -495,11 +488,11 @@ void QDeclarativeViewObserver::setShowAppOnTop(bool appOnTop)
while
(
rootWidget
->
parentWidget
())
rootWidget
=
rootWidget
->
parentWidget
();
Qt
::
WindowFlags
flags
=
rootWidget
->
windowFlags
();
if
(
appOnTop
)
{
if
(
appOnTop
)
flags
|=
Qt
::
WindowStaysOnTopHint
;
}
else
{
else
flags
&=
~
Qt
::
WindowStaysOnTopHint
;
}
rootWidget
->
setWindowFlags
(
flags
);
rootWidget
->
show
();
}
...
...
@@ -538,8 +531,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItemsForTools(QList<QGraphicsIt
foreach
(
QGraphicsItem
*
item
,
items
)
{
if
(
item
)
{
QGraphicsObject
*
obj
=
item
->
toGraphicsObject
();
if
(
obj
)
{
if
(
QGraphicsObject
*
obj
=
item
->
toGraphicsObject
())
{
QObject
::
connect
(
obj
,
SIGNAL
(
destroyed
(
QObject
*
)),
this
,
SLOT
(
_q_removeFromSelection
(
QObject
*
)));
currentSelection
.
append
(
obj
);
...
...
@@ -568,7 +560,7 @@ void QDeclarativeViewObserverPrivate::setSelectedItems(QList<QGraphicsItem *> it
QList
<
QGraphicsItem
*>
QDeclarativeViewObserverPrivate
::
selectedItems
()
{
QList
<
QGraphicsItem
*>
selection
;
foreach
(
const
QWeakPointer
<
QGraphicsObject
>
&
selectedObject
,
currentSelection
)
{
foreach
(
const
QWeakPointer
<
QGraphicsObject
>
&
selectedObject
,
currentSelection
)
{
if
(
selectedObject
.
data
())
selection
<<
selectedObject
.
data
();
}
...
...
@@ -607,7 +599,7 @@ void QDeclarativeViewObserverPrivate::highlight(QList<QGraphicsObject *> items,
return
;
QList
<
QGraphicsObject
*>
objectList
;
foreach
(
QGraphicsItem
*
item
,
items
)
{
foreach
(
QGraphicsItem
*
item
,
items
)
{
QGraphicsItem
*
child
=
item
;
if
(
flags
&
ContextSensitive
)
child
=
subcomponentEditorTool
->
firstChildOfContext
(
item
);
...
...
@@ -714,11 +706,10 @@ void QDeclarativeViewObserver::changeAnimationSpeed(qreal slowdownFactor)
{
data
->
slowdownFactor
=
slowdownFactor
;
if
(
data
->
slowdownFactor
!=
0
)
{
if
(
data
->
slowdownFactor
!=
0
)
continueExecution
(
data
->
slowdownFactor
);
}
else
{
else
pauseExecution
();
}
}
void
QDeclarativeViewObserver
::
continueExecution
(
qreal
slowdownFactor
)
...
...
@@ -751,14 +742,13 @@ void QDeclarativeViewObserver::pauseExecution()
void
QDeclarativeViewObserverPrivate
::
_q_applyChangesFromClient
()
{