fix top panel sliding in vertical mode

encapsulate in an Item to force the proper implicitHeight, so
the top panel slide works on vertical screen also before it has been
rpotated to horizontal and back
This commit is contained in:
Marco Martin 2020-11-11 16:24:05 +01:00
parent 2fab1b0dd1
commit e7f82ab394
2 changed files with 56 additions and 52 deletions

View file

@ -213,8 +213,10 @@ NanoShell.FullScreenOverlay {
PlasmaComponents.Control { PlasmaComponents.Control {
id: contentArea id: contentArea
z: 1 z: 1
y: 0
x: drawerX x: drawerX
width: drawerWidth width: drawerWidth
height: contentItem.height
} }
} }
} }

View file

@ -293,67 +293,69 @@ Item {
onClosed: quickSettings.closed() onClosed: quickSettings.closed()
contentItem: GridLayout { contentItem: Item {
id: panelContents
anchors.fill: parent
implicitWidth: quickSettingsParent.implicitWidth implicitWidth: quickSettingsParent.implicitWidth
implicitHeight: Math.min(slidingPanel.height, quickSettingsParent.implicitHeight) implicitHeight: Math.min(slidingPanel.height, quickSettingsParent.implicitHeight)
GridLayout {
id: panelContents
anchors.fill: parent
implicitWidth: quickSettingsParent.implicitWidth
implicitHeight: Math.min(slidingPanel.height, quickSettingsParent.implicitHeight)
columns: slidingPanel.wideScreen ? 2 : 1 columns: slidingPanel.wideScreen ? 2 : 1
rows: slidingPanel.wideScreen ? 1 : 2 rows: slidingPanel.wideScreen ? 1 : 2
DrawerBackground { DrawerBackground {
id: quickSettingsParent id: quickSettingsParent
//anchors.fill: parent //anchors.fill: parent
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
Layout.preferredWidth: slidingPanel.wideScreen ? Math.min(slidingPanel.width/2, units.gridUnit * 25) : panelContents.width Layout.preferredWidth: slidingPanel.wideScreen ? Math.min(slidingPanel.width/2, units.gridUnit * 25) : panelContents.width
z: 4 z: 4
contentItem: QuickSettings { contentItem: QuickSettings {
id: quickSettings id: quickSettings
onCloseRequested: { onCloseRequested: {
slidingPanel.hide() slidingPanel.hide()
}
} }
} }
}
ListView { ListView {
id: fullRepresentationView id: fullRepresentationView
z: 1 z: 1
interactive: width < contentWidth interactive: width < contentWidth
//parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents //parent: slidingPanel.wideScreen ? slidingPanel.flickable.contentItem : panelContents
Layout.preferredWidth: slidingPanel.wideScreen ? Math.min(slidingPanel.width/2, quickSettingsParent.width*fullRepresentationModel.count) : panelContents.width Layout.preferredWidth: slidingPanel.wideScreen ? Math.min(slidingPanel.width/2, quickSettingsParent.width*fullRepresentationModel.count) : panelContents.width
//Layout.fillWidth: true //Layout.fillWidth: true
clip: slidingPanel.wideScreen clip: slidingPanel.wideScreen
y: slidingPanel.wideScreen ? 0 : quickSettingsParent.height - height * (1-opacity) y: slidingPanel.wideScreen ? 0 : quickSettingsParent.height - height * (1-opacity)
opacity: slidingPanel.wideScreen ? 1 : fullRepresentationModel.count > 0 && slidingPanel.offset/panelContents.height opacity: slidingPanel.wideScreen ? 1 : fullRepresentationModel.count > 0 && slidingPanel.offset/panelContents.height
height: Math.min(plasmoid.screenGeometry.height - slidingPanel.headerHeight - quickSettingsParent.height - bottomBar.height, implicitHeight) height: Math.min(plasmoid.screenGeometry.height - slidingPanel.headerHeight - quickSettingsParent.height - bottomBar.height, implicitHeight)
//leftMargin: slidingPanel.drawerX //leftMargin: slidingPanel.drawerX
preferredHighlightBegin: slidingPanel.drawerX preferredHighlightBegin: slidingPanel.drawerX
implicitHeight: units.gridUnit * 20
cacheBuffer: width * 100
highlightFollowsCurrentItem: true
highlightRangeMode: ListView.StrictlyEnforceRange
highlightMoveDuration: units.longDuration
snapMode: slidingPanel.wideScreen ? ListView.NoSnap : ListView.SnapOneItem
model: ObjectModel {
id: fullRepresentationModel
}
orientation: ListView.Horizontal
MouseArea {
parent: fullRepresentationView.contentItem
anchors.fill: parent
z: -1
onClicked: slidingPanel.close() implicitHeight: units.gridUnit * 20
cacheBuffer: width * 100
highlightFollowsCurrentItem: true
highlightRangeMode: ListView.StrictlyEnforceRange
highlightMoveDuration: units.longDuration
snapMode: slidingPanel.wideScreen ? ListView.NoSnap : ListView.SnapOneItem
model: ObjectModel {
id: fullRepresentationModel
}
orientation: ListView.Horizontal
MouseArea {
parent: fullRepresentationView.contentItem
anchors.fill: parent
z: -1
onClicked: slidingPanel.close()
}
//implicitHeight: fullRepresentationLayout.implicitHeight
//clip: true
} }
//implicitHeight: fullRepresentationLayout.implicitHeight
//clip: true
} }
} }
DrawerBackground { DrawerBackground {
id: bottomBar id: bottomBar