Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/inpututils.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class InputUtils: public QObject

/** InputApp platform */
static QString appPlatform();
static bool isMobilePlatform();
Q_INVOKABLE static bool isMobilePlatform();

static QString appDataDir();

Expand Down
2 changes: 1 addition & 1 deletion app/qml/components/MMListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Item {

property real verticalSpacing: root.secondaryText ? __style.margin8 : __style.margin20

implicitWidth: ListView?.view?.width ?? 0 // in case ListView is injected as attached property (usually it is)
implicitWidth: ListView?.view?.width - ListView?.view?.scrollBarWidth ?? 0 // in case ListView is injected as attached property (usually it is)
implicitHeight: contentLayout.implicitHeight
height: visible ? implicitHeight : 0.1 // hide invisible items, for some reason setting 0 does not work ¯\_(ツ)_/¯

Expand Down
18 changes: 18 additions & 0 deletions app/qml/components/MMListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,31 @@
***************************************************************************/

import QtQuick
import QtQuick.Controls
import QtQml

//
// Hot-fix for hotfix https://github.com/MerginMaps/mobile/issues/3417
// Seems like there is some issue with cache in ListView
//

ListView {
id: root

cacheBuffer: 0
readonly property int scrollBarWidth: __inputUtils.isMobilePlatform() ? 0 : __style.margin10
property alias scrollBarPolicy: verticalScrollBar.policy

ScrollBar.vertical: ScrollBar{
id: verticalScrollBar

// To make sure the scroll bar stays visible on desktop, even when not focused:
// - both 'policy' and 'visible' properties need to be set, with 'policy' set to AlwaysOn.
// - the use the 'AsNeeded' policy will make the scroll bar hide when not focused or in use,
// and only appear after the user starts scrolling.
policy: __inputUtils.isMobilePlatform() ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
visible: contentHeight > availableHeight ? true : false
opacity: active ? 0.7 : 0.4
width: scrollBarWidth
}
}
28 changes: 20 additions & 8 deletions app/qml/components/MMScrollView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import QtQuick.Controls

// Convenient class to use as a pageContent or drawerContent
// base element to make the content scroll
import QtQml

ScrollView {
id: root
id: root

readonly property int scrollBarWidth: __inputUtils.isMobilePlatform() ? 0 : __style.margin10
property bool scrollBarPolicy: verticalScrollBar.policy


contentWidth: availableWidth - scrollBarWidth

contentWidth: availableWidth // to only scroll vertically
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff

ScrollBar.vertical.policy: ScrollBar.AlwaysOff
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
// To make sure the scroll bar stays visible on desktop, even when not focused:
// - both 'policy' and 'visible' properties need to be set, with 'policy' set to AlwaysOn.
// - the use the 'AsNeeded' policy will make the scroll bar hide when not focused or in use,
// and only appear after the user starts scrolling.
ScrollBar.vertical {
id : verticalScrollBar
policy: __inputUtils.isMobilePlatform() ? ScrollBar.AlwaysOff : ScrollBar.AlwaysOn
visible: contentHeight > availableHeight ? true : false
opacity: active ? 0.7 : 0.4
width: scrollBarWidth
}
}
2 changes: 2 additions & 0 deletions app/qml/components/MMToolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
***************************************************************************/

import QtQuick
import QtQuick.Controls

import "./private"

Expand Down Expand Up @@ -43,6 +44,7 @@ Rectangle {

MMListView {
id: toolbar
scrollBarPolicy : ScrollBar.AlwaysOff

onWidthChanged: root.recalculate()
model: toolbarModel
Expand Down
2 changes: 1 addition & 1 deletion app/qml/form/MMFormPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Page {

Item {

width: ListView.view.width
width: ListView.view.width - ListView.view.scrollBarWidth
implicitHeight: childrenRect.height

// In future, better to filter such fields in the field proxy model instead
Expand Down
2 changes: 1 addition & 1 deletion app/qml/form/MMPreviewDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Item {
height: contentHeight

spacing: __style.margin8
interactive: false
scrollBarPolicy: ScrollBar.AsNeeded

model: root.controller.fieldModel

Expand Down
2 changes: 0 additions & 2 deletions app/qml/layers/MMLayerDetailPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ Page {
wrapMode: Text.WordWrap
text: __inputUtils.layerAttribution(layerDetailData.mapLayer)
}

ScrollBar.vertical: ScrollBar {}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/qml/project/MMProjectList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Item {
delegate: MMProjectComponents.MMProjectDelegate {
id: projectDelegate

width: ListView.view.width
width: ListView.view.width - ListView.view.scrollBarWidth
height: visible ? implicitHeight : 0

projectDisplayName: root.projectModelType === MM.ProjectsModel.WorkspaceProjectsModel ? model.ProjectName : model.ProjectFullName
Expand Down Expand Up @@ -202,7 +202,7 @@ Item {

topPadding: noLocalProjectsMessageContainer.visible ? noLocalProjectsMessageContainer.height + __style.margin40 : 0

width: ListView.view.width
width: ListView.view.width - ListView.view.scrollBarWidth

Item {
width: parent.width
Expand Down
2 changes: 1 addition & 1 deletion app/qml/project/MMProjectWizardPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ MMComponents.MMPage {
delegate: MMProjectComponents.MMProjectWizardDelegate {
id: fieldDelegate

width: ListView.view.width
width: ListView.view.width - ListView.view.scrollBarWidth

// find current index in the model
comboboxField.comboboxModel: typesmodel
Expand Down
1 change: 1 addition & 0 deletions app/qml/project/components/MMProjectDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Control {
signal showChangesRequested()

height: implicitHeight
width: ListView.view.width - ListView.view.scrollBarWidth

topPadding: __style.margin20
rightPadding: __style.margin20
Expand Down
10 changes: 9 additions & 1 deletion app/qml/settings/MMLogPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ MMPage {
width: parent.width
}

ScrollBar.vertical: ScrollBar { }
ScrollBar.vertical: ScrollBar {
opacity: active ? 0.7 : 0.4

contentItem: Rectangle {
implicitWidth: 5
radius: width / 2
color: __style.darkGreenColor
}
}
}

MMButton {
Expand Down
Loading