allow mode buttons to setup the context menu

coverity_scan
Marc Zinnschlag 9 years ago
parent eee972a1a4
commit ecbcd6b171

@ -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…
Cancel
Save