Skip to content

Commit

Permalink
Improve and harmonize menu item's left padding throughout QField
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 12, 2024
1 parent ac3c10e commit 6393c4b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/qml/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Item {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding
icon.source: Theme.getThemeVectorIcon( 'ic_speaker_white_24dp' )

onTriggered: {
Expand Down
2 changes: 1 addition & 1 deletion src/qml/LayerTreeItemProperties.qml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Popup {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
if ( parseInt(layerTree.data(index, FlatLayerTreeModel.FeatureCount)) === 0 ) {
Expand Down
31 changes: 16 additions & 15 deletions src/qml/NavigationBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 15
leftPadding: Theme.menuItemCheckLeftPadding

onTriggered: {
toggleMultiSelection();
Expand All @@ -528,7 +528,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
featureListMenu.close();
Expand All @@ -550,7 +550,7 @@ Rectangle {
enabled: toolBar.model && toolBar.model.canMergeSelection && toolBar.model.selectedCount > 1 && projectInfo.editRights

font: Theme.defaultFont
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: multiMergeClicked();
}
Expand All @@ -562,7 +562,7 @@ Rectangle {
enabled: toolBar.model && toolBar.model.canMoveSelection && projectInfo.editRights

font: Theme.defaultFont
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: multiMoveClicked();
}
Expand All @@ -574,7 +574,7 @@ Rectangle {
enabled: toolBar.model && toolBar.model.canDuplicateSelection && projectInfo.insertRights

font: Theme.defaultFont
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: multiDuplicateClicked();
}
Expand All @@ -588,7 +588,7 @@ Rectangle {
height: enabled ? undefined : 0

font: Theme.defaultFont
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: multiDeleteClicked();
}
Expand Down Expand Up @@ -619,7 +619,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
featureListMenu.close();
Expand All @@ -635,7 +635,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: extentController.zoomToSelected();
}
Expand All @@ -645,7 +645,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 15
leftPadding: Theme.menuItemCheckLeftPadding

checkable: true
checked: extentController.autoZoom
Expand All @@ -659,7 +659,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: destinationClicked();
}
Expand All @@ -681,7 +681,7 @@ Rectangle {

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

onTriggered: moveClicked();
}
Expand All @@ -698,7 +698,7 @@ Rectangle {

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

onTriggered: duplicateClicked();
}
Expand All @@ -715,7 +715,7 @@ Rectangle {

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

onTriggered: deleteClicked();
}
Expand Down Expand Up @@ -750,7 +750,7 @@ Rectangle {

font: Theme.defaultFont
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

enabled: false
}
Expand All @@ -767,7 +767,8 @@ Rectangle {
text: Title

font: Theme.defaultFont
leftPadding: 10
height: 48
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
displayToast( qsTr( 'Printing...') )
Expand Down
8 changes: 4 additions & 4 deletions src/qml/QFieldCloudScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Download Project" )
onTriggered: {
Expand All @@ -530,7 +530,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Open Project" )
onTriggered: {
Expand All @@ -547,7 +547,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Remove Stored Project" )
onTriggered: {
Expand All @@ -563,7 +563,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48 : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Cancel Project Download" )
onTriggered: {
Expand Down
25 changes: 12 additions & 13 deletions src/qml/QFieldLocalDataPickerScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Send to..." )
onTriggered: { platformUtilities.sendDatasetTo(itemMenu.itemPath); }
Expand All @@ -401,7 +401,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Export to folder..." )
onTriggered: { platformUtilities.exportDatasetTo(itemMenu.itemPath); }
Expand All @@ -417,7 +417,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Remove dataset" )
onTriggered: { platformUtilities.removeDataset(itemMenu.itemPath); }
Expand All @@ -432,7 +432,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Export to folder..." )
onTriggered: { platformUtilities.exportFolderTo(itemMenu.itemPath); }
Expand All @@ -447,7 +447,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Send compressed folder to..." )
onTriggered: { platformUtilities.sendCompressedFolderTo(itemMenu.itemPath); }
Expand All @@ -463,7 +463,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Remove project folder" )
onTriggered: { platformUtilities.removeFolder(itemMenu.itemPath); }
Expand Down Expand Up @@ -497,7 +497,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Import project from folder" )
onTriggered: { platformUtilities.importProjectFolder(); }
Expand All @@ -511,7 +511,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Import project from ZIP" )
onTriggered: { platformUtilities.importProjectArchive(); }
Expand All @@ -525,8 +525,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0

leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Import dataset(s)" )
onTriggered: { platformUtilities.importDatasets(); }
Expand All @@ -544,7 +543,7 @@ Page {

font: Theme.defaultFont
width: parent.width
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Import URL" )
onTriggered: {
Expand All @@ -562,7 +561,7 @@ Page {

font: Theme.defaultFont
width: parent.width
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Storage management help" )
onTriggered: { Qt.openUrlExternally("https://docs.qfield.org/get-started/storage/") }
Expand Down Expand Up @@ -596,7 +595,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: enabled ? undefined : 0
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

text: qsTr( "Update project from ZIP" )
onTriggered: { platformUtilities.updateProjectFromArchive(projectInfo.filePath); }
Expand Down
4 changes: 3 additions & 1 deletion src/qml/WelcomeScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48: 0
leftPadding: Theme.menuItemCheckLeftPadding
checkable: true
checked: recentProjectActions.recentProjectPath === registry.defaultProject

Expand All @@ -673,6 +674,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48: 0
leftPadding: Theme.menuItemCheckLeftPadding
checkable: true
checked: recentProjectActions.recentProjectPath === registry.baseMapProject

Expand All @@ -694,7 +696,7 @@ Page {
font: Theme.defaultFont
width: parent.width
height: visible ? 48: 0
leftPadding: 50
leftPadding: Theme.menuItemIconlessLeftPadding

text: qsTr( "Remove from Recent Projects" )
onTriggered: {
Expand Down
6 changes: 3 additions & 3 deletions src/qml/editorwidgets/TextEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ EditorWidgetBase {
font: Theme.defaultFont
icon.source: Theme.getThemeVectorIcon( "ic_copy_black_24dp" )
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
platformUtilities.copyTextToClipboard(value)
Expand All @@ -167,7 +167,7 @@ EditorWidgetBase {
font: Theme.defaultFont
icon.source: Theme.getThemeVectorIcon( "ic_paste_black_24dp" )
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
var text = platformUtilities.getTextFromClipboard();
Expand All @@ -185,7 +185,7 @@ EditorWidgetBase {
font: Theme.defaultFont
icon.source: withNfc ? Theme.getThemeVectorIcon("ic_qr_nfc_code_black_24dp") : Theme.getThemeVectorIcon("ic_qr_code_black_24dp")
height: 48
leftPadding: 10
leftPadding: Theme.menuItemLeftPadding

onTriggered: {
requestBarcode(topItem)
Expand Down
4 changes: 4 additions & 0 deletions src/qml/imports/Theme/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ QtObject {

readonly property int popupScreenEdgeMargin: 40

readonly property int menuItemIconlessLeftPadding: 54
readonly property int menuItemLeftPadding: 14
readonly property int menuItemCheckLeftPadding: 20

function getThemeIcon(name) {
var ppiName
if ( ppi >= 360 )
Expand Down
Loading

1 comment on commit 6393c4b

@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.