PowerMaster/source/customMenu.cpp

46 lines
1.0 KiB
C++

#include "customMenu.h"
CustomMenu::CustomMenu(QWidget* parent)
:QMenu(parent)
{
m_bMouseInside = false;
setStyleSheet("QMenu{\n"
" background-color:rgb(36,43,50);\n"
" border:0px solid rgb(6, 6, 6);\n"
"}\n"
"QMenu:item{\n"
" padding-left:20px;\n"
" padding-right:20px;\n"
" font:9pt \"微软雅黑\";\n"
" color:rgb(220,220,220);\n"
" height:26px;\n"
"}\n"
"QMenu:item:selected{\n"
" background-color: rgba(67,160,249, 80);\n"
"}\n");
}
CustomMenu::~CustomMenu()
{
}
void CustomMenu::enterEvent(QEnterEvent* e)
{
Q_UNUSED(e);
m_bMouseInside = true;
}
void CustomMenu::leaveEvent(QEvent* e)
{
Q_UNUSED(e);
m_bMouseInside = false;
}
// void CustomMenu::focusInEvent(QFocusEvent* e)
// {
// Q_UNUSED(e);
// qDebug() << "get focus";
// }