Skip to content

Commit

Permalink
Make the class name relative if possible
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - #141
  • Loading branch information
adeas31 authored and OpenModelica-Hudson committed Apr 11, 2019
1 parent 2e3b0ae commit e5a0c3a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion OMEdit/OMEdit/OMEditGUI/Editors/BaseEditor.cpp
Expand Up @@ -1822,7 +1822,8 @@ bool PlainTextEdit::canInsertFromMimeData(const QMimeData *source) const
{
// check mimeData to see if we can insert from it
if (source->hasFormat(Helper::modelicaComponentFormat)) {
return mpBaseEditor->getModelWidget() && !mpBaseEditor->getModelWidget()->getLibraryTreeItem()->isSystemLibrary();
return mpBaseEditor->getModelWidget() && !mpBaseEditor->getModelWidget()->getLibraryTreeItem()->isSystemLibrary()
&& mpBaseEditor->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::Modelica;
} else {
return QPlainTextEdit::canInsertFromMimeData(source);
}
Expand All @@ -1840,6 +1841,9 @@ void PlainTextEdit::insertFromMimeData(const QMimeData *source)
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
QString className;
dataStream >> className;
if (mpBaseEditor->getModelWidget()) {
className = StringHandler::makeClassNameRelative(className, mpBaseEditor->getModelWidget()->getLibraryTreeItem()->getNameStructure());
}
textCursor().insertFragment(QTextDocumentFragment::fromPlainText(className));
ensureCursorVisible();
setFocus(Qt::ActiveWindowFocusReason);
Expand Down

0 comments on commit e5a0c3a

Please sign in to comment.