Show popup message "Measurements was updated". Fixed path to measurements when

sync.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-09-16 11:03:15 +03:00
parent b3f2869975
commit f2a111f0d2
3 changed files with 29 additions and 4 deletions

View File

@ -46,6 +46,7 @@
#include "../vformat/vmeasurements.h" #include "../vformat/vmeasurements.h"
#include "../ifc/xml/vvstconverter.h" #include "../ifc/xml/vvstconverter.h"
#include "../ifc/xml/vvitconverter.h" #include "../ifc/xml/vvitconverter.h"
#include "../vwidgets/vwidgetpopup.h"
#include <QInputDialog> #include <QInputDialog>
#include <QDebug> #include <QDebug>
@ -1159,13 +1160,16 @@ void MainWindow::SyncMeasurements()
{ {
if (mChanges) 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); doc->LiteParseTree(Document::LiteParse);
mChanges = false; mChanges = false;
} }

View File

@ -31,6 +31,9 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QTimer> #include <QTimer>
#include <QLabel>
#include "../vmisc/def.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VWidgetPopup::VWidgetPopup(QWidget *parent) 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) void VWidgetPopup::Show(QPoint coord)
{ {

View File

@ -67,6 +67,8 @@ public:
int GetLifeTime() const; int GetLifeTime() const;
void SetLifeTime(int value); void SetLifeTime(int value);
static void PopupMessage(QWidget *w, const QString &msg);
public slots: public slots:
/** Pops up the widget at global coordinates \a coord. */ /** Pops up the widget at global coordinates \a coord. */
void Show(QPoint coord); void Show(QPoint coord);