MCPcopy Create free account
hub / github.com/c3d/tao3D / loadFileIntoSourceFileView

Method loadFileIntoSourceFileView

tao/window.cpp:300–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299
300bool Window::loadFileIntoSourceFileView(const QString &fileName, bool box)
301// ----------------------------------------------------------------------------
302// Update the source file view with the plain contents of a specific file
303// ----------------------------------------------------------------------------
304{
305 QFile file(fileName);
306 if (!file.open(QFile::ReadOnly | QFile::Text))
307 {
308 if (box)
309 QMessageBox::warning(this, tr("Cannot read file"),
310 tr("Cannot read file %1:\n%2.")
311 .arg(fileName)
312 .arg(file.errorString()));
313 srcEdit->clear();
314 return false;
315 }
316
317 QTextStream in(&file);
318 in.setCodec("UTF-8");
319#ifndef CONFIG_MACOSX
320 QApplication::setOverrideCursor(Qt::BusyCursor);
321#endif
322 loadInProgress = true;
323 srcEdit->setPlainText(in.readAll());
324 loadInProgress = false;
325 QApplication::restoreOverrideCursor();
326 markChanged(false);
327 return true;
328}
329
330#endif
331

Callers 1

runtimeErrorMethod · 0.80

Calls 2

openMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected