diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cb2fd5b2..c4981841a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,7 +324,7 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg configure_file(${OpenMW_SOURCE_DIR}/files/opencs.cfg "${OpenMW_BINARY_DIR}/opencs.cfg") - + configure_file(${OpenMW_SOURCE_DIR}/files/opencs/defaultfilters "${OpenMW_BINARY_DIR}/resources/defaultfilters" COPYONLY) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index e2dffdbde..2c53e2fdd 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -24,7 +24,7 @@ opencs_units (model/world opencs_units_noqt (model/world universalid record commands columnbase scriptcontext cell refidcollection - refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection + refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata ) opencs_hdrs_noqt (model/world diff --git a/apps/opencs/model/world/tablemimedata.cpp b/apps/opencs/model/world/tablemimedata.cpp index 457f5af1b..5f04d316a 100644 --- a/apps/opencs/model/world/tablemimedata.cpp +++ b/apps/opencs/model/world/tablemimedata.cpp @@ -1,10 +1,10 @@ #include "tablemimedata.hpp" #include "universalid.hpp" -CSMWorld::TableMimeData::TableMimeData (CSMWorld::UniversalId& UniversalId) : -mUniversalId(UniversalId) +CSMWorld::TableMimeData::TableMimeData (UniversalId id) : +mUniversalId(id) { - mSupportedFormats << UniversalId.toString().c_str(); + mSupportedFormats << QString::fromStdString("application/Type_" + id.getTypeName()); } QStringList CSMWorld::TableMimeData::formats() const @@ -19,4 +19,4 @@ CSMWorld::TableMimeData::~TableMimeData() CSMWorld::UniversalId& CSMWorld::TableMimeData::getId() { return mUniversalId; -} +} \ No newline at end of file diff --git a/apps/opencs/model/world/tablemimedata.hpp b/apps/opencs/model/world/tablemimedata.hpp index d142c66c1..5883966cd 100644 --- a/apps/opencs/model/world/tablemimedata.hpp +++ b/apps/opencs/model/world/tablemimedata.hpp @@ -5,7 +5,11 @@ #define TABLEMIMEDATA_H #include -#include +#include + +#include "universalid.hpp" + +class QStringList; namespace CSMWorld { @@ -13,14 +17,14 @@ namespace CSMWorld class TableMimeData : public QMimeData { public: - TableMimeData(UniversalId& UniversalId); + TableMimeData(UniversalId id); ~TableMimeData(); virtual QStringList formats() const; UniversalId& getId(); private: QStringList mSupportedFormats; - UniversalId& mUniversalId; + UniversalId mUniversalId; }; } #endif // TABLEMIMEDATA_H diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 7d0255529..450af191e 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -412,3 +412,24 @@ void CSVWorld::Table::recordFilterChanged (boost::shared_ptr fi { mProxyModel->setFilter (filter); } + +void CSVWorld::Table::mouseMoveEvent (QMouseEvent* event) +{ + if (event->buttons() & Qt::LeftButton) + { + QModelIndexList selectedRows = selectionModel()->selectedRows(); + + if (selectedRows.size() == 0) + { + return; + } + + if (selectedRows.size() == 1) //tmp solution + { + CSMWorld::TableMimeData *mime = new CSMWorld::TableMimeData(getUniversalId(selectedRows.begin()->row())); + QDrag *drag = new QDrag(this); + drag->setMimeData(mime); + drag->start(); + } + } +} \ No newline at end of file diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 889e2847a..ec08e4e2b 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -5,6 +5,7 @@ #include #include +#include #include "../../model/filter/node.hpp" @@ -49,6 +50,8 @@ namespace CSVWorld std::vector listDeletableSelectedIds() const; + void mouseMoveEvent(QMouseEvent *event); + public: Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete, bool sorting);