-
Notifications
You must be signed in to change notification settings - Fork 0
/
menus.cpp
45 lines (38 loc) · 1.16 KB
/
menus.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef MENUS_H
#define MENUS_H
#include "mainwindow.h"
#include <QObject>
#include <QtWidgets>
void MainWindow::createMenus()
{
_fileMenu = menuBar()->addMenu(tr("&File"));
_fileMenu->addAction(_exitAct);
_helpMenu = menuBar()->addMenu(tr("&Help"));
_helpMenu->addAction(_aboutAct);
_helpMenu->addAction(_aboutQtAct);
_helpMenu->addAction(_aboutAuthorsAct);
#ifndef __ANDROID__
_fileMenu->addAction(_openAct);
_fileMenu->addSeparator();
_fileMenu->addAction(_addMediaAct);
_fileMenu->addSeparator();
_playMenu = menuBar()->addMenu(tr("&Play"));
_playMenu->addSeparator();
_playMenu->addAction(_playAct);
_playMenu->addAction(_nextSongAct);
_playMenu->addAction(_previousSongAct);
_playlistMenu = menuBar()->addMenu(tr("&Playlist"));
_playlistMenu->addAction(_savePlaylistAct);
_playlistMenu->addAction(_loadPlaylistAct);
#endif
}
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
{
QMenu menu(this);
menu.addAction(_playAct);
menu.addAction(_nextSongAct);
menu.addAction(_previousSongAct);
menu.addAction(_addMediaAct);
menu.exec(event->globalPos());
}
#endif // MENUS_H