mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 20:06:43 +00:00
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/universalid.hpp"
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
|
|
||||||
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent) :
|
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent, const CSMDoc::Document& document) :
|
||||||
QTextEdit (parent)
|
QTextEdit (parent),
|
||||||
|
mDocument (document)
|
||||||
{
|
{
|
||||||
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
mAllowedTypes <<CSMWorld::UniversalId::Type_Journal
|
||||||
<<CSMWorld::UniversalId::Type_Global
|
<<CSMWorld::UniversalId::Type_Global
|
||||||
|
@ -55,6 +56,8 @@ void CSVWorld::ScriptEdit::dropEvent (QDropEvent* event)
|
||||||
|
|
||||||
setTextCursor (cursorForPosition (event->pos()));
|
setTextCursor (cursorForPosition (event->pos()));
|
||||||
|
|
||||||
|
if (mime->fromDocument (mDocument))
|
||||||
|
{
|
||||||
std::vector<CSMWorld::UniversalId> records (mime->getData());
|
std::vector<CSMWorld::UniversalId> records (mime->getData());
|
||||||
|
|
||||||
for (std::vector<CSMWorld::UniversalId>::iterator it = records.begin(); it != records.end(); ++it)
|
for (std::vector<CSMWorld::UniversalId>::iterator it = records.begin(); it != records.end(); ++it)
|
||||||
|
@ -65,3 +68,4 @@ void CSVWorld::ScriptEdit::dropEvent (QDropEvent* event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -8,16 +8,22 @@
|
||||||
|
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Document;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
{
|
{
|
||||||
class ScriptEdit : public QTextEdit
|
class ScriptEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ScriptEdit (QWidget* parent);
|
ScriptEdit (QWidget* parent, const CSMDoc::Document& document);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
QVector<CSMWorld::UniversalId::Type> mAllowedTypes;
|
||||||
|
const CSMDoc::Document& mDocument;
|
||||||
|
|
||||||
void dragEnterEvent (QDragEnterEvent* event);
|
void dragEnterEvent (QDragEnterEvent* event);
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ CSVWorld::ScriptSubView::ChangeLock::~ChangeLock()
|
||||||
CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||||
: SubView (id), mDocument (document), mColumn (-1), mChangeLocked (0)
|
: SubView (id), mDocument (document), mColumn (-1), mChangeLocked (0)
|
||||||
{
|
{
|
||||||
setWidget (mEditor = new ScriptEdit (this));
|
setWidget (mEditor = new ScriptEdit (this, mDocument));
|
||||||
|
|
||||||
mEditor->setAcceptRichText (false);
|
mEditor->setAcceptRichText (false);
|
||||||
mEditor->setLineWrapMode (QTextEdit::NoWrap);
|
mEditor->setLineWrapMode (QTextEdit::NoWrap);
|
||||||
|
|
Loading…
Reference in a new issue