Skip to content

Commit

Permalink
Revert "WLibrarySidebar: Remove #ifdef'd code for pre-Qt6 versions"
Browse files Browse the repository at this point in the history
This reverts commit ea2d725.

As per the review comments in mixxxdj#13816 and the current policy in
https://github.com/mixxxdj/mixxx/wiki/Minimum-requirements-policy,
compatibility hacks should be kept unless removing them is necessary.
  • Loading branch information
cr7pt0gr4ph7 committed Nov 2, 2024
1 parent ac7ec57 commit 54b7aa0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/widget/wlibrarysidebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ void WLibrarySidebar::dragEnterEvent(QDragEnterEvent * event) {
void WLibrarySidebar::dragMoveEvent(QDragMoveEvent * event) {
//qDebug() << "dragMoveEvent" << event->mimeData()->formats();
// Start a timer to auto-expand sections the user hovers on.
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPoint pos = event->position().toPoint();
#else
QPoint pos = event->pos();
#endif
QModelIndex index = indexAt(pos);
if (m_hoverIndex != index) {
m_expandTimer.stop();
Expand All @@ -89,7 +93,11 @@ void WLibrarySidebar::dragMoveEvent(QDragMoveEvent * event) {
if (sidebarModel) {
accepted = false;
for (const QUrl& url : urls) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPoint pos = event->position().toPoint();
#else
QPoint pos = event->pos();
#endif
QModelIndex destIndex = indexAt(pos);
if (sidebarModel->dragMoveAccept(destIndex, url)) {
// We only need one URL to be valid for us
Expand Down Expand Up @@ -146,9 +154,13 @@ void WLibrarySidebar::dropEvent(QDropEvent * event) {
//eg. dragging a track from Windows Explorer onto the sidebar
SidebarModel* sidebarModel = qobject_cast<SidebarModel*>(model());
if (sidebarModel) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPoint pos = event->position().toPoint();
QModelIndex destIndex = indexAt(pos);
#else
QPoint pos = event->pos();
#endif

QModelIndex destIndex = indexAt(pos);
// event->source() will return NULL if something is dropped from
// a different application
const QList<QUrl> urls = event->mimeData()->urls();
Expand Down

0 comments on commit 54b7aa0

Please sign in to comment.