forked from teamnwah/openmw-tes3coop
checking for the source of the drop, reject those from other files for now
This commit is contained in:
parent
cbe1fe2f95
commit
17af865a9f
3 changed files with 19 additions and 9 deletions
|
@ -5,8 +5,9 @@
|
|||
#include "../../model/world/universalid.hpp"
|
||||
#include "../../model/world/tablemimedata.hpp"
|
||||
|
||||
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent) :
|
||||
QTextEdit (parent)
|
||||
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent, const CSMDoc::Document& document) :
|
||||
QTextEdit (parent),
|
||||
mDocument (document)
|
||||
{
|
||||
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
||||
<<CSMWorld::UniversalId::Type_Global
|
||||
|
@ -55,13 +56,16 @@ void CSVWorld::ScriptEdit::dropEvent (QDropEvent* event)
|
|||
|
||||
setTextCursor (cursorForPosition (event->pos()));
|
||||
|
||||
std::vector<CSMWorld::UniversalId> records (mime->getData());
|
||||
|
||||
for (std::vector<CSMWorld::UniversalId>::iterator it = records.begin(); it != records.end(); ++it)
|
||||
if (mime->fromDocument (mDocument))
|
||||
{
|
||||
if (mAllowedTypes.contains (it->getType()))
|
||||
std::vector<CSMWorld::UniversalId> records (mime->getData());
|
||||
|
||||
for (std::vector<CSMWorld::UniversalId>::iterator it = records.begin(); it != records.end(); ++it)
|
||||
{
|
||||
QString::fromStdString ('"' + it->getId() + '"');
|
||||
if (mAllowedTypes.contains (it->getType()))
|
||||
{
|
||||
QString::fromStdString ('"' + it->getId() + '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,16 +8,22 @@
|
|||
|
||||
class QWidget;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class ScriptEdit : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScriptEdit (QWidget* parent);
|
||||
ScriptEdit (QWidget* parent, const CSMDoc::Document& document);
|
||||
|
||||
private:
|
||||
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
||||
const CSMDoc::Document& mDocument;
|
||||
|
||||
void dragEnterEvent (QDragEnterEvent* event);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ CSVWorld::ScriptSubView::ChangeLock::~ChangeLock()
|
|||
CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||
: SubView (id), mDocument (document), mColumn (-1), mChangeLocked (0)
|
||||
{
|
||||
setWidget (mEditor = new ScriptEdit (this));
|
||||
setWidget (mEditor = new ScriptEdit (this, mDocument));
|
||||
|
||||
mEditor->setAcceptRichText (false);
|
||||
mEditor->setLineWrapMode (QTextEdit::NoWrap);
|
||||
|
|
Loading…
Reference in a new issue