From ff8c440c3a2aeb0e1abc6f93e9dd7775533382ff Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 May 2008 01:32:07 +0000 Subject: [FIX] Context menus added [FIX] No more copy/cut/paste for objects; only available from context menus [FIX] Can now add objects during runtime git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@174 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemodr/models/MapWarpModel.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pokemodr/models/MapWarpModel.cpp') diff --git a/pokemodr/models/MapWarpModel.cpp b/pokemodr/models/MapWarpModel.cpp index ba3a55a0..2a3c7825 100644 --- a/pokemodr/models/MapWarpModel.cpp +++ b/pokemodr/models/MapWarpModel.cpp @@ -18,6 +18,9 @@ // Header include #include "MapWarpModel.h" +// Model includes +#include "GroupModel.h" + // PokeModr includes #include "../MapWarpUI.h" @@ -28,6 +31,9 @@ // Qt includes #include +// KDE includes +#include + MapWarpModel::MapWarpModel(BaseModel* parent, MapWarp* warp) : ObjectModel(parent, warp) { @@ -52,6 +58,12 @@ QVariant MapWarpModel::data(int role) const QWidget* widget = new MapWarpUI(static_cast(m_object), NULL); return QVariant::fromValue(widget); } + else if (role == BaseModel::ContextMenuRole) + { + KMenu* menu = new KMenu; + menu->addAction("Delete Warp", this, SLOT(deleteSelf())); + return QVariant::fromValue(static_cast(menu)); + } return ObjectModel::data(role); } @@ -76,3 +88,8 @@ bool MapWarpModel::setData(const QVariant& value, int role) } return false; } + +void MapWarpModel::deleteSelf() +{ +// static_cast(m_parent)->deleteObject(this); +} -- cgit