Skip to content

Commit

Permalink
WTrackProperty: show DlgTrackInfo on double-click
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Aug 4, 2020
1 parent 3454734 commit e5c74d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/widget/wtrackproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ void WTrackProperty::mouseMoveEvent(QMouseEvent *event) {
}
}

void WTrackProperty::mousePressEvent(QMouseEvent* event) {
if ((event->buttons() & Qt::LeftButton) && m_pCurrentTrack) {
if (!m_clickTimer.isActive()) {
m_clickTimer.setSingleShot(true);
m_clickTimer.start(400);
} else {
m_pTrackMenu->loadTrack(m_pCurrentTrack);
m_pTrackMenu->slotShowTrackInfo();
}
}
}

void WTrackProperty::dragEnterEvent(QDragEnterEvent *event) {
DragAndDropHelper::handleTrackDragEnterEvent(event, m_group, m_pConfig);
}
Expand Down
3 changes: 3 additions & 0 deletions src/widget/wtrackproperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QMouseEvent>
#include <QTimer>

#include "preferences/usersettings.h"
#include "skin/skincontext.h"
Expand Down Expand Up @@ -42,13 +43,15 @@ class WTrackProperty : public WLabel, public TrackDropTarget {
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent* event) override;

void updateLabel();

const QString m_group;
const UserSettingsPointer m_pConfig;
TrackPointer m_pCurrentTrack;
QString m_property;
QTimer m_clickTimer;

const parented_ptr<WTrackMenu> m_pTrackMenu;
};

0 comments on commit e5c74d6

Please sign in to comment.