-
-
Notifications
You must be signed in to change notification settings - Fork 383
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 2 commits
6835237
287928b
2c62c53
f90b26f
6919e46
f5f7d00
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(bool isInAllNotes) const | ||
| { | ||
| int result = minimumContentHeight() + note_list_constants::LAST_EL_SEP_SPACE; | ||
| if (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(m_isInAllNotes) + 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(m_isInAllNotes) + 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; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.