Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-07-19 02:28:45 +02:00
commit cb6b967a40
3 changed files with 14 additions and 19 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();

View File

@ -3636,13 +3636,12 @@ void MainWindow::CreateActions()
{
recentFileActs[i] = new QAction(this);
recentFileActs[i]->setVisible(false);
connect(recentFileActs[i], &QAction::triggered, [this]()
connect(recentFileActs[i], &QAction::triggered, this, [this]()
{
QAction *action = qobject_cast<QAction *>(sender());
if (action)
if (QAction *action = qobject_cast<QAction *>(sender()))
{
const QString filePath = action->data().toString();
if (not filePath.isEmpty())
if (not filePath.isEmpty())
{
LoadPattern(filePath);
}