Skip to content

Commit

Permalink
Fix map canvas (and other) menu height when separator hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jul 30, 2023
1 parent d282621 commit 3d7be24
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
14 changes: 5 additions & 9 deletions src/qml/NavigationBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Rectangle {
MenuSeparator { width: parent.width }

MenuItem {
text: Qt.platform.os === "ios" ? qsTr( "Print Atlas Feature(s) to Image" ) : qsTr( 'Print Atlas Feature(s) to PDF' )
text: qsTr( 'Print Atlas Feature(s) to PDF' )
icon.source: Theme.getThemeIcon( "ic_print_white_24dp" )
enabled: toolBar.model && toolBar.model.selectedCount > 0 && LayerUtils.isAtlasCoverageLayer( toolBar.model.selectedLayer )

Expand All @@ -533,19 +533,19 @@ Rectangle {
}

MenuSeparator {
visible: mergeSelectedFeaturesBtn.visible || moveSelectedFeaturesBtn.visible || duplicateSelectedFeaturesBtn.visible || deleteSelectedFeaturesBtn.visible
enabled: mergeSelectedFeaturesBtn.visible || moveSelectedFeaturesBtn.visible || duplicateSelectedFeaturesBtn.visible || deleteSelectedFeaturesBtn.visible
visible: enabled
width: parent.width
height: enabled ? undefined : 0
}

MenuItem {
id: mergeSelectedFeaturesBtn
text: qsTr( 'Merge Selected Features' )
icon.source: Theme.getThemeIcon( "ic_merge_features_white_24dp" )
enabled: toolBar.model && toolBar.model.canMergeSelection && toolBar.model.selectedCount > 1 && projectInfo.editRights
visible: enabled

font: Theme.defaultFont
height: visible ? 48 : 0
leftPadding: 10

onTriggered: multiMergeClicked();
Expand All @@ -556,10 +556,8 @@ Rectangle {
text: qsTr( 'Move Selected Feature(s)' )
icon.source: Theme.getThemeVectorIcon( "ic_move_white_24dp" )
enabled: toolBar.model && toolBar.model.canMoveSelection && projectInfo.editRights
visible: enabled

font: Theme.defaultFont
height: visible ? 48 : 0
leftPadding: 10

onTriggered: multiMoveClicked();
Expand All @@ -570,10 +568,8 @@ Rectangle {
text: qsTr( 'Duplicate Selected Feature(s)' )
icon.source: Theme.getThemeVectorIcon( "ic_duplicate_black_24dp" )
enabled: toolBar.model && toolBar.model.canDuplicateSelection && projectInfo.insertRights
visible: enabled

font: Theme.defaultFont
height: visible ? 48 : 0
leftPadding: 10

onTriggered: multiDuplicateClicked();
Expand All @@ -585,9 +581,9 @@ Rectangle {
icon.source: Theme.getThemeIcon( "ic_delete_forever_white_24dp" )
enabled: toolBar.model && toolBar.model.canDeleteSelection && projectInfo.editRights
visible: enabled
height: enabled ? undefined : 0

font: Theme.defaultFont
height: visible ? 48 : 0
leftPadding: 10

onTriggered: multiDeleteClicked();
Expand Down
50 changes: 33 additions & 17 deletions src/qml/QFieldLocalDataPickerScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,13 @@ Page {

MenuItem {
id: sendDatasetTo
visible: platformUtilities.capabilities & PlatformUtilities.CustomSend
enabled: platformUtilities.capabilities & PlatformUtilities.CustomSend
&& itemMenu.itemMetaType == LocalFilesModel.Dataset
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Send to..." )
Expand All @@ -383,12 +384,13 @@ Page {

MenuItem {
id: exportDatasetTo
visible: platformUtilities.capabilities & PlatformUtilities.CustomExport
enabled: platformUtilities.capabilities & PlatformUtilities.CustomExport
&& itemMenu.itemMetaType == LocalFilesModel.Dataset
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Export to folder..." )
Expand All @@ -397,13 +399,14 @@ Page {

MenuItem {
id: removeDataset
visible: itemMenu.itemMetaType == LocalFilesModel.Dataset
enabled: itemMenu.itemMetaType == LocalFilesModel.Dataset
&& !qfieldLocalDataPickerScreen.projectFolderView
&& table.model.isDeletedAllowedInCurrentPath
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled? undefined : 0
leftPadding: 10

text: qsTr( "Remove dataset" )
Expand All @@ -412,12 +415,13 @@ Page {

MenuItem {
id: exportFolderTo
visible: platformUtilities.capabilities & PlatformUtilities.CustomExport &&
enabled: platformUtilities.capabilities & PlatformUtilities.CustomExport &&
itemMenu.itemMetaType == LocalFilesModel.Folder
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Export to folder..." )
Expand All @@ -426,12 +430,13 @@ Page {

MenuItem {
id: sendCompressedFolderTo
visible: platformUtilities.capabilities & PlatformUtilities.CustomSend
enabled: platformUtilities.capabilities & PlatformUtilities.CustomSend
&& itemMenu.itemMetaType == LocalFilesModel.Folder
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Send compressed folder to..." )
Expand All @@ -440,13 +445,14 @@ Page {

MenuItem {
id: removeProjectFolder
visible: itemMenu.itemMetaType == LocalFilesModel.Folder
enabled: itemMenu.itemMetaType == LocalFilesModel.Folder
&& !qfieldLocalDataPickerScreen.projectFolderView
&& table.model.isDeletedAllowedInCurrentPath
visible: enabled

font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Remove project folder" )
Expand Down Expand Up @@ -477,9 +483,10 @@ Page {
id: importProjectFromFolder

enabled: platformUtilities.capabilities & PlatformUtilities.CustomImport
visible: enabled
font: Theme.defaultFont
width: parent.width
height: enabled ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Import project from folder" )
Expand All @@ -490,9 +497,10 @@ Page {
id: importProjectFromZIP

enabled: platformUtilities.capabilities & PlatformUtilities.CustomImport
visible: enabled
font: Theme.defaultFont
width: parent.width
height: enabled ? 48 : 0
height: enabled ? undefined : 0
leftPadding: 10

text: qsTr( "Import project from ZIP" )
Expand All @@ -503,17 +511,23 @@ Page {
id: importDataset

enabled: platformUtilities.capabilities & PlatformUtilities.CustomImport
visible: enabled
font: Theme.defaultFont
width: parent.width
height: enabled ? 48 : 0
height: enabled ? undefined : 0

leftPadding: 10

text: qsTr( "Import dataset(s)" )
onTriggered: { platformUtilities.importDatasets(); }
}

MenuSeparator { visible: platformUtilities.capabilities & PlatformUtilities.CustomImport; width: parent.width }
MenuSeparator {
enabled: platformUtilities.capabilities & PlatformUtilities.CustomImport
visible: enabled
width: parent.width
height: enabled ? undefined : 0
}

MenuItem {
id: importUrl
Expand All @@ -529,7 +543,9 @@ Page {
}
}

MenuSeparator { width: parent.width }
MenuSeparator {
width: parent.width
}

MenuItem {
id: storageHelp
Expand Down
5 changes: 3 additions & 2 deletions src/qml/qgismobileapp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2435,8 +2435,10 @@ ApplicationWindow {
}

MenuSeparator {
enabled: canvasMenuFeatureListInstantiator.count > 0
width: parent.width
visible: canvasMenuFeatureListInstantiator.count > 0
visible: enabled
height: enabled ? undefined : 0
}

Instantiator {
Expand All @@ -2457,7 +2459,6 @@ ApplicationWindow {

title: layerName + ': ' + featureName
font: Theme.defaultFont
leftPadding: 10

width: {
var result = 0;
Expand Down

1 comment on commit 3d7be24

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.