Slot OpenRecentFile in Tape replaced by lambda.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-18 22:58:14 +03:00
parent 7cabc7df18
commit 8b438daa6c
2 changed files with 11 additions and 15 deletions

View file

@ -1743,7 +1743,17 @@ void TMainWindow::SetupMenu()
for (int i = 0; i < MaxRecentFiles; ++i)
{
recentFileActs[i] = new QAction(this);
connect(recentFileActs[i], &QAction::triggered, this, &TMainWindow::OpenRecentFile);
connect(recentFileActs[i], &QAction::triggered, this, [this]()
{
if (auto action = qobject_cast<QAction *>(sender()))
{
const QString filePath = action->data().toString();
if (not filePath.isEmpty())
{
LoadFile(filePath);
}
}
});
ui->menuFile->insertAction(ui->actionPreferences, recentFileActs[i]);
recentFileActs[i]->setVisible(false);
}
@ -2778,19 +2788,6 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::OpenRecentFile()
{
if (auto action=qobject_cast<QAction *>(sender()))
{
const QString filePath = action->data().toString();
if (not filePath.isEmpty())
{
LoadFile(filePath);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
bool TMainWindow::IgnoreLocking(int error, const QString &path)
{

View file

@ -75,7 +75,6 @@ private slots:
void OpenStandard();
void OpenTemplate();
void CreateFromExisting();
void OpenRecentFile();
void FileSave();
void FileSaveAs();