diff --git a/apps/opencs/model/world/tablemimedata.cpp b/apps/opencs/model/world/tablemimedata.cpp index 07c9999b9..87bd67ce9 100644 --- a/apps/opencs/model/world/tablemimedata.cpp +++ b/apps/opencs/model/world/tablemimedata.cpp @@ -3,7 +3,6 @@ #include "universalid.hpp" #include "columnbase.hpp" -#include CSMWorld::TableMimeData::TableMimeData (UniversalId id) { @@ -79,7 +78,6 @@ bool CSMWorld::TableMimeData::holdsType (CSMWorld::UniversalId::Type type) const bool CSMWorld::TableMimeData::holdsType (CSMWorld::ColumnBase::Display type) const { - std::cout<::const_iterator it = mUniversalId.begin(); it != mUniversalId.end(); ++it) { if (it->getType() == convertEnums (type)) diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index cd7a5fa18..31c216e2c 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -133,9 +133,9 @@ void CSVWorld::GenericCreator::create() std::string id = getId(); std::auto_ptr command (new CSMWorld::CloneCommand ( dynamic_cast (*mData.getTableModel(mListId)), mClonedId, id, mClonedType)); - + mUndoStack.push(command.release()); - + emit done(); emit requestFocus(id); } else { diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index bfd58fb86..48b533992 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "../../model/world/data.hpp" #include "../../model/world/commands.hpp" @@ -477,27 +478,28 @@ void CSVWorld::Table::mouseMoveEvent (QMouseEvent* event) void CSVWorld::Table::dragEnterEvent(QDragEnterEvent *event) { -// QModelIndex index = indexAt (event->pos()); - -// if (dynamic_cast (event->mimeData())->holdsType (mModel->getColumnDisplay (index.column()))) -// { event->acceptProposedAction(); -// } } void CSVWorld::Table::dropEvent(QDropEvent *event) { QModelIndex index = indexAt (event->pos()); - CSMWorld::ColumnBase::Display display = static_cast(mModel->headerData(index.column(), Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt()); + CSMWorld::ColumnBase::Display display = static_cast + (mModel->headerData(index.column(), Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt()); + if (dynamic_cast(event->mimeData())->holdsType(display)) { - event->acceptProposedAction(); - std::cout<<"Dropped/n"; - } else {std::cout<<"Not Dropped\n";} + const CSMWorld::TableMimeData* mime = dynamic_cast(event->mimeData()); + CSMWorld::UniversalId record(mime->returnMatching(display)); + mUndoStack.push (new CSMWorld::ModifyCommand ( *mModel, + index, + QVariant(record.getId().c_str()) + )); + } } void CSVWorld::Table::dragMoveEvent(QDragMoveEvent *event) { - event->accept(); + event->accept(); } diff --git a/files/opencs/multitype.png b/files/opencs/multitype.png new file mode 100644 index 000000000..05676e2de Binary files /dev/null and b/files/opencs/multitype.png differ diff --git a/files/opencs/resources.qrc b/files/opencs/resources.qrc index eadcf9697..2b1e65ff0 100644 --- a/files/opencs/resources.qrc +++ b/files/opencs/resources.qrc @@ -56,6 +56,7 @@ spell.png static.png weapon.png + multitype.png raster/startup/big/create-addon.png raster/startup/big/new-game.png raster/startup/big/edit-content.png