18 fileAction =
new QAction(
this);
19 fileAction->setVisible(
false);
20 connect(fileAction, SIGNAL(triggered()), parent, slot);
40 QStringList files = settings.value(
_settingsName).toStringList();
41 files.removeAll(filename);
42 files.prepend(filename);
48 settings.setValue(
"recentFileList", files);
55 QStringList files = settings.value(
_settingsName).toStringList();
57 int numFiles = qMin(files.size(),
static_cast<int>(
_maxFiles));
59 for (
int i = 0; i < numFiles; ++i)
61 QString text = tr(
"&%1 %2").arg(i + 1).arg(
strippedName(files[i]));
67 for (
int i = numFiles; i <
_maxFiles; ++i)
75 return QFileInfo(fullFileName).fileName();
QAction * _fileActions[_maxFiles]
QString strippedName(const QString &fullFileName)
Returns the filename from a full file path.
void setCurrentFile(const QString &filename)
Should be called from the application when a file was used.
void updateRecentFileActions()
Updates the recent files list and writes it to the settings.
QMenu * menu()
Returns the created menu. Add this menu to your QMainWindow menu.
RecentFiles(QObject *parent, const char *slot, QString settingsName)