Skip to content

Commit

Permalink
Make the graph splitter indicator stay onscreen if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
stofte committed Jan 3, 2019
1 parent 2f5cda9 commit 0d9133e
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions app/qml/components/HistoryView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,12 @@ Rectangle {

// graphViewSplitter and graphViewSplitterBottom set each others widths,
// but it seems ok with qt?

QQC14.SplitView {
orientation: Qt.Horizontal
x: 0
y: 0
height: !historyListView.highlightItem ? 0 :
historyListView.highlightItem.y + rowHeight - historyListView.contentY
width: parent.width

handleDelegate: Rectangle {
Component {
id: graphSplitterDraggerComponentRef
Rectangle {
color: "transparent"
opacity: 1
width: 8

LinearGradient {
anchors.top: parent.top
start: Qt.point(0, 0)
Expand All @@ -333,7 +325,28 @@ Rectangle {
}
}
}

}
function getGraphSplitterHeight(top) {
if (historyListView.highlightItem) {
var off;
if (top) {
off = historyListView.highlightItem.y + rowHeight - historyListView.contentY;
return (off + historyListView.highlightItem.height) < 0 ? historyListView.height : off;
} else {
off = historyListView.height - (historyListView.highlightItem.y + historyListView.highlightItem.height - historyListView.contentY);
return off > historyListView.height ? 0 : off;
}
} else {
return top ? historyListView.height : 0;
}
}
QQC14.SplitView {
orientation: Qt.Horizontal
x: 0
y: 0
height: getGraphSplitterHeight(true)
width: parent.width
handleDelegate: graphSplitterDraggerComponentRef
Rectangle {
id: graphViewSplitter
width: 150
Expand All @@ -342,26 +355,19 @@ Rectangle {
graphViewSplitterBottom.width = width
}
}

Rectangle {
color: "transparent"
}
Item { }
}

QQC14.SplitView {
orientation: Qt.Horizontal
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: !historyListView.highlightItem ? 0 :
historyListView.height - (historyListView.highlightItem.y + historyListView.highlightItem.height - historyListView.contentY)

height: getGraphSplitterHeight(false)
handleDelegate: Rectangle {
color: "transparent"
opacity: 1
width: 8
}

Rectangle {
id: graphViewSplitterBottom
width: graphViewSplitter.width
Expand All @@ -370,9 +376,6 @@ Rectangle {
graphViewSplitter.width = width
}
}

Rectangle {
color: "transparent"
}
Item { }
}
}

0 comments on commit 0d9133e

Please sign in to comment.