diff --git a/src/libtomahawk/playlist/queueview.cpp b/src/libtomahawk/playlist/queueview.cpp
index 92ca8349a..07ca0f908 100644
--- a/src/libtomahawk/playlist/queueview.cpp
+++ b/src/libtomahawk/playlist/queueview.cpp
@@ -33,6 +33,7 @@ using namespace Tomahawk;
QueueView::QueueView( AnimatedSplitter* parent )
: AnimatedWidget( parent )
, ui( new Ui::QueueView )
+ , m_dragTimer( 0 )
{
ui->setupUi( this );
TomahawkUtils::unmarginLayout( layout() );
@@ -47,6 +48,8 @@ QueueView::QueueView( AnimatedSplitter* parent )
ui->queue->overlay()->setEnabled( false );
connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
+
+ ui->toggleButton->installEventFilter( this );
}
@@ -62,6 +65,33 @@ QueueView::queue() const
return ui->queue;
}
+bool
+QueueView::eventFilter( QObject* obj, QEvent* ev )
+{
+ if ( obj == ui->toggleButton )
+ {
+ if ( ev->type() == QEvent::DragEnter )
+ {
+ ev->accept();
+
+ if ( m_dragTimer == 0 )
+ {
+ m_dragTimer = new QTimer( this );
+ m_dragTimer->setInterval( 1000 );
+ m_dragTimer->setSingleShot( true );
+ connect( m_dragTimer, SIGNAL( timeout() ), this, SLOT( show() ) );
+ m_dragTimer->start();
+ }
+ }
+ else if ( ev->type() == QEvent::DragLeave || ev->type() == QEvent::Drop )
+ {
+ delete m_dragTimer;
+ m_dragTimer = 0;
+ }
+ }
+
+ return QObject::eventFilter( obj, ev );
+}
void
QueueView::hide()
diff --git a/src/libtomahawk/playlist/queueview.h b/src/libtomahawk/playlist/queueview.h
index df80c7c26..33e9d95d9 100644
--- a/src/libtomahawk/playlist/queueview.h
+++ b/src/libtomahawk/playlist/queueview.h
@@ -25,6 +25,7 @@
#include "dllmacro.h"
+class QTimer;
class PlaylistView;
namespace Ui
@@ -44,6 +45,8 @@ public:
QSize sizeHint() const { return QSize( 0, 200 ); }
+ virtual bool eventFilter( QObject* , QEvent* );
+
public slots:
virtual void onShown( QWidget*, bool animated );
virtual void onHidden( QWidget*, bool animated );
@@ -53,6 +56,7 @@ public slots:
private:
Ui::QueueView* ui;
+ QTimer* m_dragTimer;
};
#endif // QUEUEVIEW_H
diff --git a/src/libtomahawk/playlist/queueview.ui b/src/libtomahawk/playlist/queueview.ui
index a55036fce..389406e7a 100644
--- a/src/libtomahawk/playlist/queueview.ui
+++ b/src/libtomahawk/playlist/queueview.ui
@@ -34,6 +34,9 @@
0
+
+ true
+
Open Queue