forked from qt-creator/qt-creator
Tracing: Untangle dependencies between CategoryLabel and TimelineLabels
CategoryLabel only needs a parent for the dragger and a way to position itself. It doesn't need all the other properties of TimelineLabels. Change-Id: I33b94ec6ae7bf2a54e233e9e6c1b3e30ff9c19d2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -41,7 +41,10 @@ Item {
|
||||
property int visualIndex
|
||||
property int dragOffset
|
||||
property Item draggerParent
|
||||
property int contentBottom: draggerParent.contentY + draggerParent.height - dragOffset
|
||||
property real contentY: 0
|
||||
property real contentHeight: draggerParent.height
|
||||
property real visibleHeight: contentHeight
|
||||
property int contentBottom: contentY + visibleHeight - dragOffset
|
||||
|
||||
signal dragStarted;
|
||||
signal dragStopped;
|
||||
@@ -59,7 +62,7 @@ Item {
|
||||
drag.target: dragger
|
||||
cursorShape: dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor
|
||||
drag.minimumY: dragging ? 0 : -dragOffset // Account for parent change below
|
||||
drag.maximumY: draggerParent.height - (dragging ? 0 : dragOffset)
|
||||
drag.maximumY: visibleHeight - (dragging ? 0 : dragOffset)
|
||||
drag.axis: Drag.YAxis
|
||||
hoverEnabled: true
|
||||
ToolTip {
|
||||
@@ -112,8 +115,7 @@ Item {
|
||||
|
||||
// Initially y == 0 for all the items. Don't enable them until they have been moved
|
||||
// into place.
|
||||
property int offset: (index === 0 || y > 0) ? (y + txt.height)
|
||||
: draggerParent.contentHeight
|
||||
property int offset: (index === 0 || y > 0) ? (y + txt.height) : contentHeight
|
||||
active: contentBottom > offset
|
||||
width: labelContainer.width
|
||||
height: labelsArea.parentModel ? labelsArea.parentModel.rowHeight(index + 1) : 0
|
||||
|
@@ -102,6 +102,9 @@ Flickable {
|
||||
onDragStarted: categories.dragging = true
|
||||
onDragStopped: categories.dragging = false
|
||||
draggerParent: categories
|
||||
contentY: categories.contentY
|
||||
contentHeight: categories.contentHeight
|
||||
visibleHeight: categories.height
|
||||
width: 150
|
||||
height: parent.height
|
||||
dragOffset: loader.y
|
||||
|
Reference in New Issue
Block a user