-
-
Notifications
You must be signed in to change notification settings - Fork 381
Fix note list row alignment on Windows display scaling #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
6835237
287928b
2c62c53
f90b26f
6919e46
654dacc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,25 @@ NoteListDelegate::NoteListDelegate(NoteListView *view, TagPool *tagPool, QObject | |
| }); | ||
| } | ||
|
|
||
| int NoteListDelegate::minimumContentHeight() const | ||
| { | ||
| const int titleHeight = qMax(QFontMetrics(m_titleFont).height(), QFontMetrics(m_titleSelectedFont).height()); | ||
| const int dateHeight = QFontMetrics(m_dateFont).height(); | ||
| const int contentHeight = titleHeight; | ||
|
|
||
| return note_list_constants::TOP_OFFSET_Y + titleHeight + dateHeight + contentHeight + note_list_constants::DATE_DESC_SPACE; | ||
| } | ||
|
|
||
| int NoteListDelegate::minimumRowHeight() const | ||
| { | ||
| int result = minimumContentHeight() + note_list_constants::LAST_EL_SEP_SPACE; | ||
| if (m_isInAllNotes) { | ||
| const int folderLineHeight = qMax(QFontMetrics(m_titleFont).height(), 16) + note_list_constants::DESC_FOLDER_SPACE; | ||
| result += folderLineHeight; | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| void NoteListDelegate::setState(NoteListState NewState, QModelIndexList indexes) | ||
| { | ||
| if (animationState() != QTimeLine::NotRunning) { | ||
|
|
@@ -224,11 +243,13 @@ QSize NoteListDelegate::sizeHint(const QStyleOptionViewItem &option, const QMode | |
| } | ||
|
|
||
| int yOffsets = secondYOffset + thirdYOffset + fourthYOffset + fifthYOffset; | ||
| const int minimumHeight = minimumRowHeight() + yOffsets; | ||
| if (m_isInAllNotes) { | ||
| result.setHeight(result.height() - 2 + note_list_constants::LAST_EL_SEP_SPACE + yOffsets); | ||
| } else { | ||
| result.setHeight(result.height() - 10 + note_list_constants::LAST_EL_SEP_SPACE + yOffsets); | ||
| } | ||
| result.setHeight(qMax(result.height(), minimumHeight)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This clamp also runs for animated rows. In the animated branch above, Suggested fix: only apply the minimum-height floor when the row is not in How to test: create, delete, pin, or unpin a note and watch the affected row. It should smoothly grow/collapse. You can also log |
||
| return result; | ||
| } | ||
|
|
||
|
|
@@ -278,11 +299,13 @@ QSize NoteListDelegate::bufferSizeHint(const QStyleOptionViewItem &option, const | |
| } | ||
|
|
||
| int yOffsets = secondYOffset + thirdYOffset + fourthYOffset; | ||
| const int minimumHeight = minimumRowHeight() + yOffsets; | ||
| if (m_isInAllNotes) { | ||
| result.setHeight(result.height() - 2 + note_list_constants::LAST_EL_SEP_SPACE + yOffsets); | ||
| } else { | ||
| result.setHeight(result.height() - 10 + note_list_constants::LAST_EL_SEP_SPACE + yOffsets); | ||
| } | ||
| result.setHeight(qMax(result.height(), minimumHeight)); | ||
| return result; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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 inNoteListDelegateEditor::recalculateSize()becausetagListTop()includes the 25px header butminimumRowHeight() + tag heightdoes 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 Notesso the folder line is visible. Inspect those first rows for clipped text, clipped tag chips, or overlap.