From 268b7f291a93ae5b7c21b9e3fefaebe783e75d5f Mon Sep 17 00:00:00 2001 From: Jan Sundermeyer Date: Mon, 25 Dec 2023 15:33:32 +0100 Subject: [PATCH] fix getfilename --- src/texstudio.cpp | 4 +++- src/textanalysis.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/texstudio.cpp b/src/texstudio.cpp index 4fe4a52889..7b10a1839d 100644 --- a/src/texstudio.cpp +++ b/src/texstudio.cpp @@ -4063,7 +4063,9 @@ void Texstudio::editGotoDefinition(QDocumentCursor c) target = defs.keys().constFirst(); edView = getEditorViewFromHandle(target); if(edView->isHidden()){ - openExternalFile(target->document()->getFileName()); + LatexDocument *ltxdoc = qobject_cast(target->document()); + if(ltxdoc) + openExternalFile(ltxdoc->getFileName()); } } if (!edView) return; diff --git a/src/textanalysis.cpp b/src/textanalysis.cpp index cc8650631a..d2700f6479 100644 --- a/src/textanalysis.cpp +++ b/src/textanalysis.cpp @@ -447,7 +447,8 @@ QByteArray escapeAsCSV(const QString &s) void TextAnalysisDialog::slotExportButton() { - QString fn = FileDialog::getSaveFileName(this, tr("CSV Export"), editor ? editor->document()->getFileName().replace(".tex", ".csv") : QString(), tr("CSV file") + " (*.csv)" ";;" + tr("All files") + " (*)"); + LatexDocument *doc=editor ? qobject_cast(editor->document()): nullptr; + QString fn = FileDialog::getSaveFileName(this, tr("CSV Export"), doc ? doc->getFileName().replace(".tex", ".csv") : QString(), tr("CSV file") + " (*.csv)" ";;" + tr("All files") + " (*)"); if (fn.isEmpty()) return; QFile f(fn); if (!f.open(QFile::WriteOnly))