diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 5610c83cb..696064c43 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -46,6 +46,7 @@ #include "../vformat/vmeasurements.h" #include "../ifc/xml/vvstconverter.h" #include "../ifc/xml/vvitconverter.h" +#include "../vwidgets/vwidgetpopup.h" #include #include @@ -1159,13 +1160,16 @@ void MainWindow::SyncMeasurements() { if (mChanges) { - if(LoadMeasurements(doc->MPath())) + const QString path = AbsoluteMPath(curFile, doc->MPath()); + if(LoadMeasurements(path)) { - if (not watcher->files().contains(doc->MPath())) + if (not watcher->files().contains(path)) { - watcher->addPath(doc->MPath()); + watcher->addPath(path); } - helpLabel->setText(tr("Measurements updated")); + const QString msg = tr("Measurements was updated"); + helpLabel->setText(msg); + VWidgetPopup::PopupMessage(this, msg); doc->LiteParseTree(Document::LiteParse); mChanges = false; } diff --git a/src/libs/vwidgets/vwidgetpopup.cpp b/src/libs/vwidgets/vwidgetpopup.cpp index 5329dafca..44f102a0b 100644 --- a/src/libs/vwidgets/vwidgetpopup.cpp +++ b/src/libs/vwidgets/vwidgetpopup.cpp @@ -31,6 +31,9 @@ #include #include #include +#include + +#include "../vmisc/def.h" //--------------------------------------------------------------------------------------------------------------------- VWidgetPopup::VWidgetPopup(QWidget *parent) @@ -77,6 +80,22 @@ void VWidgetPopup::SetWidget(QWidget *widget, bool own) } } +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetPopup::PopupMessage(QWidget *w, const QString &msg) +{ + SCASSERT(w != nullptr); + + VWidgetPopup *popup = new VWidgetPopup(); + QLabel *label = new QLabel(msg); + QFont f = label->font(); + f.setBold(true); + f.setPixelSize(16); + label->setFont(f); + popup->SetWidget(label); + popup->SetLifeTime(2000); + popup->Show(w->frameGeometry().center()); +} + //--------------------------------------------------------------------------------------------------------------------- void VWidgetPopup::Show(QPoint coord) { diff --git a/src/libs/vwidgets/vwidgetpopup.h b/src/libs/vwidgets/vwidgetpopup.h index eb6529435..aadb6cc19 100644 --- a/src/libs/vwidgets/vwidgetpopup.h +++ b/src/libs/vwidgets/vwidgetpopup.h @@ -67,6 +67,8 @@ public: int GetLifeTime() const; void SetLifeTime(int value); + static void PopupMessage(QWidget *w, const QString &msg); + public slots: /** Pops up the widget at global coordinates \a coord. */ void Show(QPoint coord);