Hi

I have a problem with the name of the file when saving it. when I open a new file , its name is untitled.txt and when I modify it the * appears but if I save the file normally there should be only the file name ( without * ) which is not the case and I don't understand where is the problem
here is the function and at the end the title of my window.


thanks


Qt Code:
  1. void MainWindow::setCurrentFile(const QString &fileName)
  2. {
  3. curFile = fileName;
  4. setWindowFilePath(curFile);
  5.  
  6. QSettings settings;
  7. QStringList files = settings.value("recentFileList").toStringList();
  8. files.removeAll(fileName);
  9. files.prepend(fileName);
  10. while (files.size() > MaxRecentFiles)
  11. files.removeLast();
  12. settings.setValue("recentFileList", files);
  13.  
  14. foreach (QWidget *widget, QApplication::topLevelWidgets()) {
  15. MainWindow *mainWin = qobject_cast<MainWindow *>(widget);
  16. if (mainWin)
  17. mainWin->updateRecentFileActions();
  18. }
  19. QString shownName;
  20. if (curFile.isEmpty())
  21. shownName = "untitled.txt";
  22. else
  23. shownName = strippedName(curFile);
  24.  
  25. setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("my application name")));
  26. }
To copy to clipboard, switch view to plain text mode