forked from teamnwah/openmw-tes3coop
Yes, you can drag. But not drop.
This commit is contained in:
parent
dc80bfff55
commit
423b2906be
6 changed files with 37 additions and 9 deletions
|
@ -24,7 +24,7 @@ opencs_units (model/world
|
||||||
|
|
||||||
opencs_units_noqt (model/world
|
opencs_units_noqt (model/world
|
||||||
universalid record commands columnbase scriptcontext cell refidcollection
|
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
|
opencs_hdrs_noqt (model/world
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include "tablemimedata.hpp"
|
#include "tablemimedata.hpp"
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
|
|
||||||
CSMWorld::TableMimeData::TableMimeData (CSMWorld::UniversalId& UniversalId) :
|
CSMWorld::TableMimeData::TableMimeData (UniversalId id) :
|
||||||
mUniversalId(UniversalId)
|
mUniversalId(id)
|
||||||
{
|
{
|
||||||
mSupportedFormats << UniversalId.toString().c_str();
|
mSupportedFormats << QString::fromStdString("application/Type_" + id.getTypeName());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CSMWorld::TableMimeData::formats() const
|
QStringList CSMWorld::TableMimeData::formats() const
|
||||||
|
|
|
@ -5,7 +5,11 @@
|
||||||
#define TABLEMIMEDATA_H
|
#define TABLEMIMEDATA_H
|
||||||
|
|
||||||
#include <qt4/QtCore/QMimeData>
|
#include <qt4/QtCore/QMimeData>
|
||||||
#include <QVariant>
|
#include <QStringList>
|
||||||
|
|
||||||
|
#include "universalid.hpp"
|
||||||
|
|
||||||
|
class QStringList;
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
|
@ -13,14 +17,14 @@ namespace CSMWorld
|
||||||
class TableMimeData : public QMimeData
|
class TableMimeData : public QMimeData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TableMimeData(UniversalId& UniversalId);
|
TableMimeData(UniversalId id);
|
||||||
~TableMimeData();
|
~TableMimeData();
|
||||||
virtual QStringList formats() const;
|
virtual QStringList formats() const;
|
||||||
UniversalId& getId();
|
UniversalId& getId();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList mSupportedFormats;
|
QStringList mSupportedFormats;
|
||||||
UniversalId& mUniversalId;
|
UniversalId mUniversalId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // TABLEMIMEDATA_H
|
#endif // TABLEMIMEDATA_H
|
||||||
|
|
|
@ -412,3 +412,24 @@ void CSVWorld::Table::recordFilterChanged (boost::shared_ptr<CSMFilter::Node> fi
|
||||||
{
|
{
|
||||||
mProxyModel->setFilter (filter);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
#include <qt4/QtGui/qevent.h>
|
||||||
|
|
||||||
#include "../../model/filter/node.hpp"
|
#include "../../model/filter/node.hpp"
|
||||||
|
|
||||||
|
@ -49,6 +50,8 @@ namespace CSVWorld
|
||||||
|
|
||||||
std::vector<std::string> listDeletableSelectedIds() const;
|
std::vector<std::string> listDeletableSelectedIds() const;
|
||||||
|
|
||||||
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete, bool sorting);
|
Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack, bool createAndDelete, bool sorting);
|
||||||
|
|
Loading…
Reference in a new issue