MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / canInsertFromMimeData

Method canInsertFromMimeData

src/Gui/PythonConsole.cpp:1113–1132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113bool PythonConsole::canInsertFromMimeData(const QMimeData* source) const
1114{
1115 if (source->hasText()) {
1116 return true;
1117 }
1118 if (source->hasUrls()) {
1119 QList<QUrl> uri = source->urls();
1120 for (const auto& it : uri) {
1121 QFileInfo info(it.toLocalFile());
1122 if (info.exists() && info.isFile()) {
1123 QString ext = info.suffix().toLower();
1124 if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro")) {
1125 return true;
1126 }
1127 }
1128 }
1129 }
1130
1131 return false;
1132}
1133
1134/**
1135 * Allow one to paste plain text or urls of text files.

Callers

nothing calls this directly

Calls 2

isFileMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected