Tracing: Fix category label appearance after manual reordering

The drag item remained visible although the item height was supposedly
set to 0. This fix uses the visibility property in order to show/hide
the drag item.

Fixes: QTCREATORBUG-28930
Change-Id: I2233eed585f94eab5d71e0aa2743b791390c249c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Alessandro Portale
2023-03-21 12:35:38 +01:00
parent 9ddd1e1d36
commit 20af0711d5

View File

@@ -174,9 +174,10 @@ Item {
id: dragger id: dragger
property int visualIndex: labelContainer.visualIndex property int visualIndex: labelContainer.visualIndex
width: labelContainer.width width: labelContainer.width
height: 0 height: labelContainer.height
color: Theme.color(Theme.PanelStatusBarBackgroundColor) color: Theme.color(Theme.PanelStatusBarBackgroundColor)
opacity: 0.5 opacity: 0.5
visible: Drag.active
anchors.left: parent.left anchors.left: parent.left
// anchor to top so that it reliably snaps back after dragging // anchor to top so that it reliably snaps back after dragging
@@ -184,17 +185,14 @@ Item {
Drag.active: dragArea.drag.active Drag.active: dragArea.drag.active
Drag.onActiveChanged: { Drag.onActiveChanged: {
// We don't want height or text to be changed when reordering occurs, so we don't make // We don't want text to be changed when reordering occurs, so we don't make
// them properties. // it a property
draggerText.text = txt.text; draggerText.text = txt.text;
if (Drag.active) { if (Drag.active)
height = labelContainer.height;
labelContainer.dragStarted(); labelContainer.dragStarted();
} else { else
height = 0;
labelContainer.dragStopped(); labelContainer.dragStopped();
} }
}
states: [ states: [
State { State {