Skip to content

Commit

Permalink
Library: resize the Played checkbox and BPM lock with the library font
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jul 2, 2021
1 parent d3052f4 commit 51ceef4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions res/skins/default.qss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
image: url(:/images/library/ic_library_preview_play.svg);
}

/* These library table indicators are scaled with the library font:
checkbox next to the 'Played' counter */
/* 'Played' checkbox */
WTrackTableView::indicator,
/* BPM lock icon */
#LibraryBPMButton::indicator {
width: 0.5em;
height: 0.5em;
/* The indicator size is set dynamically according to the library font */
}
/* Style the library BPM Button with a default image */
QPushButton#LibraryBPMButton {
Expand Down
11 changes: 11 additions & 0 deletions src/widget/wlibrarytableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ void WLibraryTableView::setTrackTableFont(const QFont& font) {
setFont(font);
QFontMetrics metrics(font);
verticalHeader()->setMinimumSectionSize(metrics.height());
// Resize the 'Played' checkbox and the BPM lock icon.
// Note: this works well for library font sizes up to 200% of the original
// system font's size. Above that, the indicators start to overlap the
// item text because the painter rectangle is not resized (also depending on
// the system font size).
setStyleSheet(QStringLiteral(
"WTrackTableView::indicator,"
"#LibraryBPMButton::indicator {"
"height: %1px;"
"width: %1px;}")
.arg(metrics.height() * 0.5));
}

void WLibraryTableView::setTrackTableRowHeight(int rowHeight) {
Expand Down

0 comments on commit 51ceef4

Please sign in to comment.