Skip to content
GitLab
Menu
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
8e5bcfce
Commit
8e5bcfce
authored
Jan 19, 2010
by
Marco Bubke
Browse files
Highlight selectable item under the mouse in the formeditor
parent
5a1f1d5e
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
View file @
8e5bcfce
...
...
@@ -160,6 +160,14 @@ void FormEditorItem::setAttentionHighlight(double value)
update
();
}
void
FormEditorItem
::
setHighlightBoundingRect
(
bool
highlight
)
{
if
(
m_highlightBoundingRect
!=
highlight
)
{
m_highlightBoundingRect
=
highlight
;
update
();
}
}
FormEditorItem
::~
FormEditorItem
()
{
scene
()
->
removeItemFromHash
(
this
);
...
...
@@ -202,7 +210,10 @@ void FormEditorItem::paintBoundingRect(QPainter *painter) const
}
break
;
case
FormEditorScene
::
NormalMode
:
{
pen
.
setColor
(
Qt
::
gray
);
if
(
m_highlightBoundingRect
)
pen
.
setColor
(
"#AAAAAA"
);
else
pen
.
setColor
(
"#888888"
);
}
break
;
}
...
...
@@ -232,7 +243,7 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
painter
->
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
if
(
scene
()
->
showBoundingRects
())
if
(
scene
()
->
showBoundingRects
()
||
m_highlightBoundingRect
)
paintBoundingRect
(
painter
);
painter
->
restore
();
...
...
src/plugins/qmldesigner/components/formeditor/formeditoritem.h
View file @
8e5bcfce
...
...
@@ -96,6 +96,8 @@ public:
FormEditorView
*
formEditorView
()
const
;
void
setHighlightBoundingRect
(
bool
highlight
);
protected:
AbstractFormEditorTool
*
tool
()
const
;
void
paintBoundingRect
(
QPainter
*
painter
)
const
;
...
...
@@ -118,6 +120,7 @@ private: // variables
QRectF
m_boundingRect
;
double
m_borderWidth
;
double
m_opacity
;
bool
m_highlightBoundingRect
;
};
...
...
src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
View file @
8e5bcfce
...
...
@@ -360,6 +360,16 @@ void FormEditorScene::clearFormEditorItems()
}
}
void
FormEditorScene
::
highlightBoundingRect
(
FormEditorItem
*
highlighItem
)
{
foreach
(
FormEditorItem
*
item
,
allFormEditorItems
())
{
if
(
item
==
highlighItem
)
item
->
setHighlightBoundingRect
(
true
);
else
item
->
setHighlightBoundingRect
(
false
);
}
}
void
FormEditorScene
::
setShowBoundingRects
(
bool
show
)
{
m_showBoundingRects
=
show
;
...
...
src/plugins/qmldesigner/components/formeditor/formeditorscene.h
View file @
8e5bcfce
...
...
@@ -93,6 +93,8 @@ public:
void
clearFormEditorItems
();
void
highlightBoundingRect
(
FormEditorItem
*
formEditorItem
);
public
slots
:
void
setShowBoundingRects
(
bool
show
);
bool
showBoundingRects
()
const
;
...
...
src/plugins/qmldesigner/components/formeditor/selectiontool.cpp
View file @
8e5bcfce
...
...
@@ -134,6 +134,24 @@ void SelectionTool::hoverMoveEvent(const QList<QGraphicsItem*> &itemList,
if
(
topSelectedItemIsMovable
(
itemList
))
view
()
->
changeToMoveTool
();
FormEditorItem
*
topSelectableItem
=
0
;
foreach
(
QGraphicsItem
*
item
,
itemList
)
{
FormEditorItem
*
formEditorItem
=
FormEditorItem
::
fromQGraphicsItem
(
item
);
if
(
formEditorItem
&&
!
formEditorItem
->
qmlItemNode
().
isRootNode
()
&&
(
formEditorItem
->
qmlItemNode
().
hasShowContent
()
||
!
m_selectOnlyContentItems
))
{
topSelectableItem
=
formEditorItem
;
break
;
}
}
scene
()
->
highlightBoundingRect
(
topSelectableItem
);
}
void
SelectionTool
::
mouseReleaseEvent
(
const
QList
<
QGraphicsItem
*>
&
/*itemList*/
,
...
...
Write
Preview
Supports
Markdown
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