Skip to content

Feature/clear button for calendar drawers#4572

Open
xkello wants to merge 3 commits into
masterfrom
feature/clear-button-for-calendar-drawers
Open

Feature/clear button for calendar drawers#4572
xkello wants to merge 3 commits into
masterfrom
feature/clear-button-for-calendar-drawers

Conversation

@xkello

@xkello xkello commented Jun 30, 2026

Copy link
Copy Markdown

Problem

  1. There was no way to remove value/set it as null for date field in calendar drawers. Users had to reopen the drawer by creating exactly the same point on the map for example.

  2. Clearing the date field is causing runtime error.


Solution

  1. Added a clear button in the drawer in header space.

  2. Added guards which check for undefined and null _fieldValue before assigning dateTime in calendar drawer.


Behavior

  • When user opens calendar drawer, there is a Clear button in the top left corner, which both closes the calendar drawer and resets the value of date field when used.
  • When calendar date value is empty, the clear button is not vissible.

Images for part 1

  • Tall and wide screen behavior with filled date field:
image
  • Screen behavior when date field is empty:
image

Video for part 1

Screencast.From.2026-06-30.17-43-27.webm

@xkello xkello requested a review from tomasMizera June 30, 2026 15:45
@github-actions

Copy link
Copy Markdown

Coverage Report for CI Build 28456099437

Coverage decreased (-0.1%) to 59.03%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 22 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

22 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
mm/core/merginapi.cpp 13 75.07%
mm/core/merginuserauth.cpp 9 67.86%

Coverage Stats

Coverage Status
Relevant Lines: 15636
Covered Lines: 9230
Line Coverage: 59.03%
Coverage Strength: 97.59 hits per line

💛 - Coveralls

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 70021 dmg Expires: 28/09/2026 #7002
linux Build 📬 Mergin Maps 70281 x86_64 Expires: 28/09/2026 #7028
win64 Build 📬 Mergin Maps 62001 win64 Expires: 28/09/2026 #6200
Android Build 📬 Mergin Maps 831251 APK [arm64-v8a] Expires: 28/09/2026 #8312
📬 Mergin Maps 831251 APK [arm64-v8a] Google Play Store #8312
Android Build 📬 Mergin Maps 831211 APK [armeabi-v7a] Expires: 28/09/2026 #8312
📬 Mergin Maps 831211 APK [armeabi-v7a] Google Play Store #8312
iOS Build 📬 Build number: 26.06.925411 #9254

@Withalion Withalion linked an issue Jul 1, 2026 that may be closed by this pull request

@Withalion Withalion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Welcome to the jungle!

property alias hasDatePicker: dateTimePicker.hasDatePicker
property alias hasTimePicker: dateTimePicker.hasTimePicker
property bool showSeconds: false
property bool fieldValueIsNull: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

no need to have another property just set the value to null

Comment on lines 27 to +28
signal primaryButtonClicked
signal clearButtonClicked

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe at this point we can have just one signal which says user finished picking the value

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I see that now this was mentioned in the ticket to create it


drawerHeader.title: root.title

drawerHeader.topLeftItem.visible: !root.fieldValueIsNull

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

visibility based on dateTime value

fontColor: __style.darkGreyColor
fontColorHover: __style.nightColor

onClicked: {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would change the the value to null here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Or empty Date()

Comment on lines +133 to +134
|| root._fieldValue === undefined
|| root._fieldValue === null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For the future this can be replaced with ?? (nullish coalescence operator), it probably won't simplify it here

}

onClearButtonClicked: {
root.editorValueChanged( root._fieldValue, true )

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

currently the actual value doesn't change we just flag it as null no?

@Withalion

Copy link
Copy Markdown
Collaborator

Also the the clear text is not horizontally aligned with the rest of header and the text color is wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add clear button for date and date-time form editor drawer

2 participants