Show measurement database.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-01 16:56:37 +03:00
parent 58f013cd1e
commit 78329af822
5 changed files with 36 additions and 4 deletions

View File

@ -52,9 +52,9 @@ DialogMDataBase::DialogMDataBase(QWidget *parent)
list()
{
ui->setupUi(this);
InitDataBase();
connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &DialogMDataBase::UpdateChecks);
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
}
@ -635,9 +635,9 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
{
m->setCheckState(0, Qt::Unchecked);
}
}
UpdateChecks(m, 0);
UpdateChecks(m, 0);
}
const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
m->setText(0, text);

View File

@ -36,13 +36,15 @@
#include <QLocalSocket>
#include <QResource>
#include <QTranslator>
#include <QPointer>
//---------------------------------------------------------------------------------------------------------------------
MApplication::MApplication(int &argc, char **argv)
:VAbstractApplication(argc, argv),
mainWindows(),
localServer(nullptr),
trVars(nullptr)
trVars(nullptr),
dataBase(QPointer<DialogMDataBase>())
{
setApplicationDisplayName(VER_PRODUCTNAME_STR);
setApplicationName(VER_INTERNALNAME_STR);
@ -292,6 +294,22 @@ QString MApplication::diagramsPath() const
#endif
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ShowDataBase()
{
if (dataBase.isNull())
{
dataBase = new DialogMDataBase();
dataBase->setAttribute(Qt::WA_DeleteOnClose, true);
dataBase->setModal(false);
dataBase->show();
}
else
{
dataBase->activateWindow();
}
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_WS_MAC)
bool MApplication::event(QEvent* event)

View File

@ -33,6 +33,7 @@
#include "../vmisc/def.h"
#include "../vmisc/vtapesettings.h"
#include "../vmisc/vabstractapplication.h"
#include "dialogs/dialogmdatabase.h"
class MApplication;// use in define
class TMainWindow;
@ -70,6 +71,8 @@ public:
QString translationsPath() const;
QString diagramsPath() const;
void ShowDataBase();
public slots:
TMainWindow *NewMainWindow();
@ -82,6 +85,7 @@ private:
QList<QPointer<TMainWindow> > mainWindows;
QLocalServer *localServer;
VTranslateVars *trVars;
QPointer<DialogMDataBase> dataBase;
void Clean();
};

View File

@ -1135,6 +1135,7 @@ void TMainWindow::SetupMenu()
// Measurements
connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom);
connect(ui->actionAddKnown, &QAction::triggered, this, &TMainWindow::AddKnown);
connect(ui->actionDatabase, &QAction::triggered, qApp, &MApplication::ShowDataBase);
// Window
connect(ui->menuWindow, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowWindowMenu);

View File

@ -615,6 +615,7 @@
</property>
<addaction name="actionAddKnown"/>
<addaction name="actionAddCustom"/>
<addaction name="actionDatabase"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuMeasurements"/>
@ -784,6 +785,14 @@
<string>Open template</string>
</property>
</action>
<action name="actionDatabase">
<property name="text">
<string>Database</string>
</property>
<property name="toolTip">
<string>Show information about all known measurement</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>