diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-26 01:32:07 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-26 01:32:07 +0000 |
| commit | ff8c440c3a2aeb0e1abc6f93e9dd7775533382ff (patch) | |
| tree | 302ac68425cecc61d429c64cf8676ad37d1d4f12 /pokemodr/models/AbilityModel.cpp | |
| parent | 7e3bf1853184f96eb5be47dd78ebe21fdc170a01 (diff) | |
| download | sigen-ff8c440c3a2aeb0e1abc6f93e9dd7775533382ff.tar.gz sigen-ff8c440c3a2aeb0e1abc6f93e9dd7775533382ff.tar.xz sigen-ff8c440c3a2aeb0e1abc6f93e9dd7775533382ff.zip | |
[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
Diffstat (limited to 'pokemodr/models/AbilityModel.cpp')
| -rw-r--r-- | pokemodr/models/AbilityModel.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pokemodr/models/AbilityModel.cpp b/pokemodr/models/AbilityModel.cpp index a76a6c87..687fdd2d 100644 --- a/pokemodr/models/AbilityModel.cpp +++ b/pokemodr/models/AbilityModel.cpp @@ -18,6 +18,9 @@ // Header include #include "AbilityModel.h" +// Model includes +#include "GroupModel.h" + // PokeModr includes #include "../AbilityUI.h" @@ -27,6 +30,9 @@ // Qt includes #include <QFile> +// KDE includes +#include <KMenu> + AbilityModel::AbilityModel(BaseModel* parent, Ability* ability) : ObjectModel(parent, ability) { @@ -51,6 +57,12 @@ QVariant AbilityModel::data(int role) const QWidget* widget = new AbilityUI(static_cast<Ability*>(m_object), NULL); return QVariant::fromValue(widget); } + else if (role == BaseModel::ContextMenuRole) + { + KMenu* menu = new KMenu; + menu->addAction("Delete Ability", this, SLOT(deleteSelf())); + return QVariant::fromValue(static_cast<void*>(menu)); + } return ObjectModel::data(role); } @@ -75,3 +87,8 @@ bool AbilityModel::setData(const QVariant& value, int role) } return false; } + +void AbilityModel::deleteSelf() +{ +// static_cast<GroupModel*>(m_parent)->deleteObject(this); +} |
