Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions src/library/basetracktablemodel.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#include "library/basetracktablemodel.h"

#include <QScreen>
// for hack to get primary screen instead of view widget's screen
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
#include <QGuiApplication>
#endif
#include <QScreen>

#include "library/bpmdelegate.h"
#include "library/colordelegate.h"
Expand Down Expand Up @@ -515,22 +512,15 @@ bool BaseTrackTableModel::setData(
QVariant BaseTrackTableModel::composeCoverArtToolTipHtml(
const QModelIndex& index) const {
// Determine height of the cover art image depending on the screen size
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
auto* pTableView = qobject_cast<WTrackTableView*>(parent());
VERIFY_OR_DEBUG_ASSERT(pTableView) {
return QVariant();
}
QScreen* pViewScreen = pTableView->screen();
#else
// Ugly hack assuming that the view is on whatever Qt considers the primary screen.
// Assuming that the view is on whatever Qt considers the primary screen.
QGuiApplication* app = static_cast<QGuiApplication*>(QCoreApplication::instance());
VERIFY_OR_DEBUG_ASSERT(app) {
qWarning() << "Unable to get application's QGuiApplication instance, "
"cannot determine primary screen";
return QVariant();
}
QScreen* pViewScreen = app->primaryScreen();
#endif

unsigned int absoluteHeightOfCoverartToolTip = static_cast<int>(
pViewScreen->availableGeometry().height() *
kRelativeHeightOfCoverartToolTip);
Expand Down