1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 10:23:52 +00:00

do not cast and check multiple times

This commit is contained in:
sirherrbatka 2014-03-16 17:06:11 +01:00
parent 4a623ace71
commit 4a0d1ba272

View file

@ -117,19 +117,22 @@ QWidget* CSVWorld::DialogueDelegateDispatcherProxy::getEditor() const
void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::vector<CSMWorld::UniversalId>& data, const CSMDoc::Document* document) void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::vector<CSMWorld::UniversalId>& data, const CSMDoc::Document* document)
{ {
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(mEditor);
{
if (!lineEdit or !mIndexWrapper.get())
{
return;
}
}
for (unsigned i = 0; i < data.size(); ++i) for (unsigned i = 0; i < data.size(); ++i)
{ {
if (mDisplay == CSMWorld::TableMimeData::convertEnums(data[i].getType())) if (mDisplay == CSMWorld::TableMimeData::convertEnums(data[i].getType()))
{
QLineEdit* lineEdit = qobject_cast<QLineEdit*>(mEditor);
if (lineEdit && mIndexWrapper.get())
{ {
emit tableMimeDataDropped(mEditor, mIndexWrapper->mIndex, data[i], document); emit tableMimeDataDropped(mEditor, mIndexWrapper->mIndex, data[i], document);
emit editorDataCommited(mEditor, mIndexWrapper->mIndex, mDisplay); emit editorDataCommited(mEditor, mIndexWrapper->mIndex, mDisplay);
break; break;
} }
} }
}
} }
/* /*
==============================DialogueDelegateDispatcher========================================== ==============================DialogueDelegateDispatcher==========================================