dolphin/Source/Core/DolphinQt/QtUtils/NonAutodismissibleMenu.h
cristian64 2eeb2fd2b9
DolphinQt: Use non-autodismissable menus in menu bar.
A new class that derives from `QMenu` has been introduced. Menus of this
`NonAutodismissibleMenu` type will stay visible when a _checkable_
action is triggered.

This is convenient in menus that feature a series of check boxes that
toggle visibility of third components (e.g. the **List Columns** menu),
allowing the user to toggle several actions at once.

For now, the new type is used in the top menu bar.
2025-05-03 20:29:21 +02:00

23 lines
438 B
C++

// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QMenu>
namespace QtUtils
{
// A menu widget based on QMenu that will not be automatically dismissed when one of its checkable
// actions are triggered.
class NonAutodismissibleMenu : public QMenu
{
public:
using QMenu::QMenu;
protected:
void mouseReleaseEvent(QMouseEvent* event) override;
};
} // namespace QtUtils