mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 13:15:32 +00:00
allow mode buttons to setup the context menu
This commit is contained in:
parent
eee972a1a4
commit
ecbcd6b171
4 changed files with 20 additions and 1 deletions
|
@ -7,3 +7,8 @@ CSVWidget::ModeButton::ModeButton (const QIcon& icon, const QString& tooltip, QW
|
|||
void CSVWidget::ModeButton::activate (SceneToolbar *toolbar) {}
|
||||
|
||||
void CSVWidget::ModeButton::deactivate (SceneToolbar *toolbar) {}
|
||||
|
||||
bool CSVWidget::ModeButton::createContextMenu (QMenu *menu)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "pushbutton.hpp"
|
||||
|
||||
class QMenu;
|
||||
|
||||
namespace CSVWidget
|
||||
{
|
||||
class SceneToolbar;
|
||||
|
@ -22,6 +24,14 @@ namespace CSVWidget
|
|||
|
||||
/// Default-Implementation: do nothing
|
||||
virtual void deactivate (SceneToolbar *toolbar);
|
||||
|
||||
/// Add context menu items to \a menu. Default-implementation: return false
|
||||
///
|
||||
/// \attention menu can be a 0-pointer
|
||||
///
|
||||
/// \return Have there been any menu items to be added (if menu is 0 and there
|
||||
/// items to be added, the function must return true anyway.
|
||||
virtual bool createContextMenu (QMenu *menu);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ void CSVWidget::SceneToolMode::contextMenuEvent (QContextMenuEvent *event)
|
|||
|
||||
bool CSVWidget::SceneToolMode::createContextMenu (QMenu *menu)
|
||||
{
|
||||
if (mCurrent)
|
||||
return mCurrent->createContextMenu (menu);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace CSVWidget
|
|||
|
||||
virtual void contextMenuEvent (QContextMenuEvent *event);
|
||||
|
||||
/// Add context menu items to \a menu. Default-implementation: return false
|
||||
/// Add context menu items to \a menu. Default-implementation: Pass on request to
|
||||
/// current mode button or return false, if there is no current mode button.
|
||||
///
|
||||
/// \attention menu can be a 0-pointer
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue