Init
This commit is contained in:
38
menubarmod.cpp
Normal file
38
menubarmod.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "menubarmod.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
MenuBarMod::MenuBarMod(QWidget *parent) :
|
||||
QMenuBar(parent)
|
||||
{
|
||||
setNativeMenuBar(false);
|
||||
setStyleSheet("QMenuBar::item:selected { background: #a8a8a8;}");
|
||||
|
||||
}
|
||||
|
||||
void MenuBarMod::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
|
||||
QList<QAction*> al = this->actions();
|
||||
bool fl=true;
|
||||
|
||||
if (!al.isEmpty())
|
||||
{
|
||||
|
||||
|
||||
if ((e->key()==Qt::Key_Right)&&(al.last()==activeAction())) {
|
||||
setActiveAction(0);
|
||||
emit rightPressed(uid);
|
||||
fl=false;
|
||||
}
|
||||
|
||||
if ((e->key()==Qt::Key_Left)&&(al.at(0)==activeAction())) {
|
||||
setActiveAction(0);
|
||||
emit leftPressed(uid);
|
||||
fl=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (fl) QMenuBar::keyPressEvent(e);
|
||||
}
|
||||
Reference in New Issue
Block a user