]> git.sur5r.net Git - minitube/blobdiff - src/channelview.cpp
Better context menu code, also working on Windows
[minitube] / src / channelview.cpp
index eef1a7200fbd7ac7e7122826551c1cdc4fa6e9a8..318f66694e8549531339e106a76fc1c2bf70dc97 100644 (file)
@@ -72,10 +72,6 @@ ChannelView::ChannelView(QWidget *parent) : QListView(parent),
 
     setMouseTracking(true);
 
-    setContextMenuPolicy(Qt::CustomContextMenu);
-    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
-            SLOT(showContextMenu(const QPoint &)));
-
     connect(this, SIGNAL(clicked(const QModelIndex &)),
             SLOT(itemActivated(const QModelIndex &)));
     connect(this, SIGNAL(entered(const QModelIndex &)),
@@ -186,6 +182,13 @@ void ChannelView::disappear() {
         MainWindow::instance()->showActionInStatusBar(action, false);
 }
 
+void ChannelView::mousePressEvent(QMouseEvent *event) {
+    if (event->button() == Qt::RightButton)
+        showContextMenu(event->pos());
+    else
+        QListView::mousePressEvent(event);
+}
+
 void ChannelView::mouseMoveEvent(QMouseEvent *event) {
     QListView::mouseMoveEvent(event);
     const QModelIndex index = indexAt(event->pos());