refs #303 Simulator table view

* Simulator component
* Name / variant pair object / view / model
This commit is contained in:
Klaus Basan
2014-08-02 22:15:15 +02:00
parent 42f89ebeca
commit 9afc9024ca
9 changed files with 159 additions and 12 deletions

View File

@@ -9,6 +9,7 @@
#include "simulatorcomponent.h"
#include "ui_simulatorcomponent.h"
#include "blackmisc/iconlist.h"
namespace BlackGui
{
@@ -18,11 +19,33 @@ namespace BlackGui
QTabWidget(parent), ui(new Ui::CSimulatorComponent)
{
ui->setupUi(this);
this->ui->tvp_LiveData->setIconMode(true);
this->addOrUpdateByName("info", "no data yet", CIcons::StandardIconWarning16);
}
CSimulatorComponent::~CSimulatorComponent()
{
delete ui;
}
void CSimulatorComponent::addOrUpdateByName(const QString &name, const QString &value, const CIcon &icon)
{
this->ui->tvp_LiveData->addOrUpdateByName(name, value, icon);
}
void CSimulatorComponent::addOrUpdateByName(const QString &name, const QString &value, CIcons::IconIndexes iconIndex)
{
this->addOrUpdateByName(name, value, CIconList::iconForIndex(iconIndex));
}
int CSimulatorComponent::rowCount() const
{
return this->ui->tvp_LiveData->rowCount();
}
void CSimulatorComponent::clear()
{
this->ui->tvp_LiveData->clear();
}
}
}

View File

@@ -13,6 +13,7 @@
#define BLACKGUI_SIMULATORCOMPONENT_H
#include "runtimebasedcomponent.h"
#include "blackmisc/icon.h"
#include <QTabWidget>
namespace Ui { class CSimulatorComponent; }
@@ -34,6 +35,18 @@ namespace BlackGui
//! Destructor
~CSimulatorComponent();
//! Simple add or update name / value pair
void addOrUpdateByName(const QString &name, const QString &value, const BlackMisc::CIcon &icon);
//! Simple add or update name / value pair
void addOrUpdateByName(const QString &name, const QString &value, BlackMisc::CIcons::IconIndexes iconIndex);
//! Number of entries
int rowCount() const;
//! Clear
void clear();
private:
Ui::CSimulatorComponent *ui;
};

View File

@@ -37,7 +37,11 @@
<number>0</number>
</property>
<item>
<widget class="BlackGui::Views::CNameVariantPairView" name="tvp_LiveData"/>
<widget class="BlackGui::Views::CNameVariantPairView" name="tvp_LiveData">
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</widget>