openmw-tes3coop/apps/opencs/view/world/scriptedit.cpp

38 lines
921 B
C++
Raw Normal View History

2014-02-15 16:55:18 +00:00
#include "scriptedit.hpp"
#include <vector>
#include <QDragEnterEvent>
#include "../../model/world/universalid.hpp"
#include "../../model/world/tablemimedata.hpp"
CSVWorld::ScriptEdit::ScriptEdit (QWidget* parent) :
QTextEdit(parent)
{
}
2014-02-15 16:55:18 +00:00
void CSVWorld::ScriptEdit::dragEnterEvent (QDragEnterEvent* event)
{
event->acceptProposedAction();
}
void CSVWorld::ScriptEdit::dragMoveEvent (QDragMoveEvent* event)
{
event->accept();
}
void CSVWorld::ScriptEdit::dropEvent (QDropEvent* event)
{
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
std::vector<CSMWorld::UniversalId> records (mime->getData());
2014-02-15 16:55:18 +00:00
for (std::vector<CSMWorld::UniversalId>::iterator it = records.begin(); it != records.end(); ++it)
{
insertPlainText (QString::fromStdString (it->getId()));
}
2014-02-15 16:55:18 +00:00
}
// kate: indent-mode cstyle; indent-width 4; replace-tabs on;