Fixed behaviour on Windows. Valentina asks about synchronization measurements

twice.
(grafted from e60ffe31f4ba96857a59275dc069bbb67a9bbbdf)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-07-24 20:02:55 +03:00
parent f69dabe007
commit 2400555d05
2 changed files with 5 additions and 1 deletions

View File

@ -37,6 +37,7 @@
- Fix grainline position on layout. - Fix grainline position on layout.
- [#719] Valentina crashes when unite pieces. - [#719] Valentina crashes when unite pieces.
- Fixed Valentina crash. Used way to avoid Qt's bug QTBUG-61213. - Fixed Valentina crash. Used way to avoid Qt's bug QTBUG-61213.
- Fixed behaviour on Windows. Valentina asks about synchronization measurements twice.
# Version 0.5.0 May 9, 2017 # Version 0.5.0 May 9, 2017
- [#581] User can now filter input lists by keyword in function wizard. - [#581] User can now filter input lists by keyword in function wizard.

View File

@ -184,10 +184,12 @@ MainWindow::MainWindow(QWidget *parent)
connect(watcher, &QFileSystemWatcher::fileChanged, this, &MainWindow::MeasurementsChanged); connect(watcher, &QFileSystemWatcher::fileChanged, this, &MainWindow::MeasurementsChanged);
connect(qApp, &QApplication::focusChanged, this, [this](QWidget *old, QWidget *now) connect(qApp, &QApplication::focusChanged, this, [this](QWidget *old, QWidget *now)
{ {
static bool asking = false;
if (old == nullptr && isAncestorOf(now) == true) if (old == nullptr && isAncestorOf(now) == true)
{// focus IN {// focus IN
if (mChanges && not mChangesAsked) if (not asking && mChanges && not mChangesAsked)
{ {
asking = true;
mChangesAsked = true; mChangesAsked = true;
const auto answer = QMessageBox::question(this, tr("Measurements"), const auto answer = QMessageBox::question(this, tr("Measurements"),
tr("Measurements were changed. Do you want to sync measurements now?"), tr("Measurements were changed. Do you want to sync measurements now?"),
@ -196,6 +198,7 @@ MainWindow::MainWindow(QWidget *parent)
{ {
SyncMeasurements(); SyncMeasurements();
} }
asking = false;
} }
} }