1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-11 13:18:13 +03:00
latte-dock/app/settings/generic/persistentmenu.cpp
2021-05-27 15:01:00 +00:00

58 lines
929 B
C++

/*
SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "persistentmenu.h"
namespace Latte {
namespace Settings {
namespace Layout {
namespace Delegate {
PersistentMenu::PersistentMenu(QWidget *parent)
: QMenu (parent),
m_blockHide(false)
{
}
void PersistentMenu::setVisible (bool visible)
{
if (m_blockHide) {
m_blockHide = false;
return;
}
QMenu::setVisible(visible);
}
int PersistentMenu::masterIndex() const
{
return m_masterIndex;
}
void PersistentMenu::setMasterIndex(const int &index)
{
if (m_masterIndex == index) {
return;
}
m_masterIndex = index;
emit masterIndexChanged(index);
}
void PersistentMenu::mouseReleaseEvent (QMouseEvent *e)
{
const QAction *action = actionAt(e->pos());
if (action) {
m_blockHide = true;
}
QMenu::mouseReleaseEvent (e);
}
}
}
}
}