diff options
author | ronso0 <ronso0@mixxx.org> | 2020-12-14 14:28:19 +0100 |
---|---|---|
committer | ronso0 <ronso0@mixxx.org> | 2020-12-17 02:00:38 +0100 |
commit | fb9db14be6afc23a3b40ec63683a4db5cb16711a (patch) | |
tree | b03712efc270304a8ae0064a2c016478af02d3f2 /src/library/library.cpp | |
parent | e80ce44df0f440e108ca1f0cecb1e16b26517c3e (diff) |
Library: overhaul setting font and row height
Previously, there was an artificial lower limit for the row height (31px
for me) that would ignore lower values of the row height spinbox.
Now, the new font height is used as lower limit for the row height.
When changing the font (size) the row height is automatically adjusted
by using the previous font height/row height ratio.
Diffstat (limited to 'src/library/library.cpp')
-rw-r--r-- | src/library/library.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/library/library.cpp b/src/library/library.cpp index dec5cc5b3a..59c528c37c 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -522,8 +522,17 @@ QStringList Library::getDirs() { } void Library::setFont(const QFont& font) { + QFontMetrics currMetrics(m_trackTableFont); + QFontMetrics newMetrics(font); + double currFontHeight = currMetrics.height(); + double newFontHeight = newMetrics.height(); + m_trackTableFont = font; emit setTrackTableFont(font); + // adapt the previous font heigh/row height ratio + int scaledRowHeight = static_cast<int>(std::round( + (newFontHeight / currFontHeight) * m_iTrackTableRowHeight)); + setRowHeight(scaledRowHeight); } void Library::setRowHeight(int rowHeight) { |