Merge pull request #493 from monich/sessions
Made sure that context menu stays inside the screen area
This commit is contained in:
commit
2c53848d04
1 changed files with 11 additions and 7 deletions
|
@ -25,6 +25,7 @@ import "../../js/functions.js" as Functions
|
||||||
|
|
||||||
AccordionItem {
|
AccordionItem {
|
||||||
text: qsTr("Sessions")
|
text: qsTr("Sessions")
|
||||||
|
property SilicaFlickable flickable: parent.flickable
|
||||||
Component {
|
Component {
|
||||||
Column {
|
Column {
|
||||||
id: activeSessionsItem
|
id: activeSessionsItem
|
||||||
|
@ -63,11 +64,7 @@ AccordionItem {
|
||||||
SilicaListView {
|
SilicaListView {
|
||||||
id: activeSessionsListView
|
id: activeSessionsListView
|
||||||
width: parent.width
|
width: parent.width
|
||||||
// one activeSessionListItem is about 1.52 times itemSizeLarge
|
height: contentHeight
|
||||||
// show max 5 items at a time
|
|
||||||
height: Theme.itemSizeLarge * 1.5 * Math.min(5 , activeSessionsItem.activeSessions.length )
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
model: activeSessionsItem.activeSessions
|
model: activeSessionsItem.activeSessions
|
||||||
headerPositioning: ListView.OverlayHeader
|
headerPositioning: ListView.OverlayHeader
|
||||||
header: Separator {
|
header: Separator {
|
||||||
|
@ -82,6 +79,15 @@ AccordionItem {
|
||||||
|
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
hasContent: !modelData.is_current
|
hasContent: !modelData.is_current
|
||||||
|
onHeightChanged: {
|
||||||
|
if (parent && flickable) {
|
||||||
|
// Make sure we are inside the screen area
|
||||||
|
var bottom = parent.mapToItem(flickable, x, y).y + height
|
||||||
|
if (bottom > flickable.height) {
|
||||||
|
flickable.contentY += bottom - flickable.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var sessionId = modelData.id;
|
var sessionId = modelData.id;
|
||||||
|
@ -172,8 +178,6 @@ AccordionItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalScrollDecorator {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue