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

@@ -19,7 +19,7 @@ namespace BlackGui
{
CNameVariantPairView::CNameVariantPairView(QWidget *parent) : CViewBase(parent)
{
this->m_model = new CNameVariantPairModel(this);
this->m_model = new CNameVariantPairModel(true, this);
this->setModel(this->m_model); // via QTableView
this->m_model->setSortColumnByPropertyIndex(BlackMisc::CNameVariantPair::IndexName);
if (this->m_model->hasValidSortColumn())
@@ -28,5 +28,26 @@ namespace BlackGui
this->m_model->getSortOrder());
this->horizontalHeader()->setStretchLastSection(true);
}
void CNameVariantPairView::setIconMode(bool withIcon)
{
Q_ASSERT(this->m_model);
this->m_model->setIconMode(withIcon);
}
void CNameVariantPairView::addOrUpdateByName(const QString &name, const QString &value, const CIcon &icon)
{
Q_ASSERT(this->m_model);
this->m_model->addOrUpdateByName(name, value, icon);
this->resizeColumnsToContents();
this->resizeRowsToContents();
}
void CNameVariantPairView::removeByName(const QString &name)
{
this->m_model->removeByName(name);
this->resizeColumnsToContents();
this->resizeRowsToContents();
}
}
}