Skip to content

Fix note list row alignment on Windows display scaling#773

Open
AJ0070 wants to merge 5 commits into
nuttyartist:masterfrom
AJ0070:fix/164
Open

Fix note list row alignment on Windows display scaling#773
AJ0070 wants to merge 5 commits into
nuttyartist:masterfrom
AJ0070:fix/164

Conversation

@AJ0070

@AJ0070 AJ0070 commented Jun 14, 2026

Copy link
Copy Markdown

Changes

  • Added font-metric-based minimum height helpers for note list rows
  • Applied those minimum heights in the note list delegate sizing paths
  • Updated tagged-note editor sizing to use the same metric-based floor
  • Replaced fixed tag-list vertical placement with metric-based placement

Why

The Windows issue appears to come from a mismatch between:

  • fixed pixel row heights in the custom note list layout
  • scaled font rendering on Windows, especially with Segoe UI and non-100% display scaling

When scaling increases text height, the old fixed values could leave the content taller than the row allocated for it, causing visible misalignment.

Tested for these settings

Built and tested locally on Windows.

Verified the note list manually at multiple display scaling levels:

  • 100%
  • 125%
  • 150%
  • 175%

Checked the following scenarios at each scaling level:

  • regular note rows
  • tagged note rows
  • All Notes view
  • pinned/unpinned note sections

Verified that:

  • note titles, dates, and preview text remain aligned
  • text does not overlap or get clipped
  • tagged rows expand enough to contain tag chips cleanly
  • pinned section headers and first rows below them remain properly spaced
  • All Notes rows still leave enough room for the folder line

Fixes #164

@AJ0070

AJ0070 commented Jun 14, 2026

Copy link
Copy Markdown
Author

@nuttyartist Can I get review on this?

@zjeffer

zjeffer commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Can you add before & after screenshots?

@AJ0070

AJ0070 commented Jun 14, 2026

Copy link
Copy Markdown
Author

100% Scale:

image

125% Scale:

image

150% Scale:

image

175% Scale:

image

Comment thread src/notelistdelegate.cpp Outdated
@AJ0070

AJ0070 commented Jun 14, 2026

Copy link
Copy Markdown
Author

The windows failure looks unrelated to my changes.

@zjeffer

zjeffer commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Indeed, I just ran the ci/cd on master and it failed with the same issues https://github.com/nuttyartist/notes/actions/runs/27494239891/job/81265236753

@zjeffer zjeffer requested a review from nuttyartist June 14, 2026 09:17
@AJ0070

AJ0070 commented Jun 18, 2026

Copy link
Copy Markdown
Author

@nuttyartist gentle ping!

@nuttyartist

Copy link
Copy Markdown
Owner

Hi there @AJ0070! Thanks for contributing. Going over your PR now!

@nuttyartist nuttyartist left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks again for the changes. There are some issues.

1. Animation rows no longer collapse/expand correctly

src/notelistdelegate.cpp

First, this PR breaks the some of the animations of notes list delegates:

Before:

Screen.Recording.2026-06-19.at.13.02.09.mov

After:

Screen.Recording.2026-06-19.at.13.00.46.mov

The reason
The new minimum-height clamp is applied even when sizeHint() is returning timeline-scaled heights for insert/remove/move animations. That means an animated row can be clamped back up to minimumRowHeight() instead of shrinking toward zero or growing smoothly.

How to test
Create, delete, pin, or unpin a note and watch the note-list row animation. The affected row should smoothly grow or collapse. With this change, the row can remain at least minimumRowHeight() during the animation.

2. Pinned/Notes section header height is missing from the minimum row height

src/notelistdelegate.cpp
src/notelistdelegateeditor.cpp

Before:
Image

After:
Image

The painted content is shifted down by 25px for the first pinned row or first unpinned row under the Pinned / Notes section headers, but the new minimum-height calculation does not include that 25px. At higher Windows scaling, those first rows can still clip or overlap because the row floor only accounts for text/folder/tag content, not the section header above it.

How to test

On Windows, use display scaling or text scaling high enough to reproduce the original issue, ideally 150% or 175%.

Create notes so there is:

  • a first pinned note
  • a first unpinned note
  • tagged rows
  • the All Notes view, so the folder line is visible

Then inspect the first pinned and first unpinned rows. These are the rows whose content is shifted down by the section header. If the 25px header is missing from the minimum height, they are the most likely places to see clipped text, clipped tag chips, or overlap.

@nuttyartist nuttyartist left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for tackling the Windows scaling issue. I left two spots where the sizing math still needs to account for existing behavior.

Comment thread src/notelistdelegate.cpp Outdated
} else {
result.setHeight(result.height() - 10 + note_list_constants::LAST_EL_SEP_SPACE + yOffsets);
}
result.setHeight(qMax(result.height(), minimumHeight));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This clamp also runs for animated rows. In the animated branch above, result.height() is intentionally scaled by the timeline so insert/remove/move rows can grow or collapse, but the final qMax(..., minimumHeight) raises it back to at least the full minimum height.

Suggested fix: only apply the minimum-height floor when the row is not in m_animatedIndexes, or clamp the target row height before applying the timeline rate.

How to test: create, delete, pin, or unpin a note and watch the affected row. It should smoothly grow/collapse. You can also log result.height() near currentFrame == 0: it is computed near zero, then raised again by this qMax.

Comment thread src/notelistdelegate.cpp Outdated
}

int yOffsets = secondYOffset + thirdYOffset + fourthYOffset + fifthYOffset;
const int minimumHeight = minimumRowHeight() + yOffsets;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This minimum height does not include the 25px section header for the first pinned row / first unpinned row, even though paintLabels() shifts those rows' content down by that header. Once font metrics exceed the old fixed budget, those first rows can still clip/overlap. The same issue applies to the editor floor in NoteListDelegateEditor::recalculateSize() because tagListTop() includes the 25px header but minimumRowHeight() + tag height does not.

Suggested fix: include the same header offset in the minimum-height calculation for first pinned/first unpinned rows, preferably via a shared helper so delegate paint, tag placement, and row sizing stay in sync.

How to test: on Windows at 150% or 175% scaling, create a first pinned note and a first unpinned note, with tags, and also check All Notes so the folder line is visible. Inspect those first rows for clipped text, clipped tag chips, or overlap.

Copilot AI review requested due to automatic review settings June 19, 2026 11:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@AJ0070

AJ0070 commented Jun 19, 2026

Copy link
Copy Markdown
Author

@nuttyartist Thank you for the comprehensive review! I've addressed both issues.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@nuttyartist

nuttyartist commented Jun 19, 2026

Copy link
Copy Markdown
Owner

I found one follow-up visual regression after the latest sizing fix: when the first pinned note is selected, the selected background now bleeds upward into the Pinned section header.

Before:
Screenshot 2026-06-19 at 14 30 54
After:
Screenshot 2026-06-19 at 14 31 53

The likely cause is that sizeHint() now correctly includes sectionHeaderHeight(...), but NoteListDelegate::paintBackground() still fills the entire bufferRect for selected/hover/default rows before drawing the pixmap back. The editor path already handles this correctly by moving bufferRect down before filling:

bufferRect.setY(bufferRect.y() + note_list_constants::SECTION_HEADER_HEIGHT + fifthYOffset);

Suggested fix: mirror that behavior in NoteListDelegate::paintBackground() for first pinned / first unpinned rows, while preserving the collapsed pinned-header-only case. In other words, the background fill rect should start below the Pinned / Notes header when the row includes both a section header and note content.

A shape like this should be close:

int headerOffset = sectionHeaderHeight(index, *model);
if (headerOffset > 0 && !(m_view->isPinnedNotesCollapsed() && model->isFirstPinnedNote(index))) {
    int fifthYOffset = 0;
    if (!m_view->isPinnedNotesCollapsed() && model->isFirstUnpinnedNote(index)) {
        fifthYOffset = note_list_constants::LAST_PINNED_TO_UNPINNED_HEADER;
    }
    bufferRect.setY(bufferRect.y() + headerOffset + fifthYOffset);
}

How to test:

  • Expand pinned notes and select the first pinned note. The blue selection background should begin below the Pinned label, not behind it.
  • Select the first unpinned note when the Notes header is visible. The Notes header should also keep its normal background.
  • Collapse pinned notes and make sure the pinned header-only row still paints normally.

@AJ0070

AJ0070 commented Jun 19, 2026

Copy link
Copy Markdown
Author

@nuttyartist I have fixed the follow-up visual regression.

@AJ0070

AJ0070 commented Jun 21, 2026

Copy link
Copy Markdown
Author

Let me know if any further changes are required.

@AJ0070 AJ0070 requested a review from nuttyartist June 24, 2026 05:48
@AJ0070

AJ0070 commented Jun 24, 2026

Copy link
Copy Markdown
Author

@nuttyartist I have addressed all of the reviews, please let me know if any further changes are required.

@nuttyartist

Copy link
Copy Markdown
Owner

@AJ0070 Sorry for the delay, I'll have available time to properly review your changes only at the weekend. I did find multiple issues with your changes already, so I want to make sure to test it again properly. Stay tuned.

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.

Bug - notes are not aligned well on some reported Windows machines [$80]

4 participants