aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Ui/qsui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Ui/qsui/mainwindow.cpp')
-rw-r--r--src/plugins/Ui/qsui/mainwindow.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/Ui/qsui/mainwindow.cpp b/src/plugins/Ui/qsui/mainwindow.cpp
index fc8a1ebe2..2ab26c1c3 100644
--- a/src/plugins/Ui/qsui/mainwindow.cpp
+++ b/src/plugins/Ui/qsui/mainwindow.cpp
@@ -26,6 +26,7 @@
#include <QSettings>
#include <QInputDialog>
#include <QGridLayout>
+#include <QtDebug>
#include <qmmp/soundcore.h>
#include <qmmp/decoder.h>
#include <qmmp/metadatamanager.h>
@@ -329,6 +330,30 @@ void MainWindow::showSettings()
m_seekBar->readSettings();
}
+void MainWindow::showAppMenu()
+{
+ QAction *action = qobject_cast<QAction *>(sender());
+ if(!action)
+ return;
+
+ QPoint menuPos = pos();
+
+ for(QWidget *w : action->associatedWidgets())
+ {
+ QToolButton *toolButton = qobject_cast<QToolButton *>(w);
+ if(toolButton && toolButton->parentWidget())
+ {
+ menuPos = toolButton->parentWidget()->mapToGlobal(toolButton->geometry().bottomLeft());
+ break;
+ }
+ }
+
+ QMenu *appMenu = new QMenu(this);
+ appMenu->setAttribute(Qt::WA_DeleteOnClose, true);
+ appMenu->addActions(menuBar()->actions());
+ appMenu->popup(menuPos);
+}
+
void MainWindow::updateVolumeIcon()
{
int maxVol = m_core->volume();
@@ -656,6 +681,8 @@ void MainWindow::createActions()
QAction* backward = new QAction(this);
backward->setShortcut(QKeySequence(Qt::Key_Left));
connect(backward,SIGNAL(triggered(bool)),this,SLOT(backward()));
+ //application menu
+ SET_ACTION(ActionManager::APPLICATION_MENU, this, SLOT(showAppMenu()));
addActions(QList<QAction*>() << forward << backward);
addActions(ActionManager::instance()->actions());