mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-22 13:15:39 +08:00
refs #303 Simulator table view
* Simulator component * Name / variant pair object / view / model
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ namespace BlackGui
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CNameVariantPairView(QWidget *parent = nullptr);
|
||||
|
||||
//! Icon mode
|
||||
void setIconMode(bool withIcon);
|
||||
|
||||
//! Update or add value, simple string version
|
||||
void addOrUpdateByName(const QString &name, const QString &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon());
|
||||
|
||||
//! Remove by name
|
||||
void removeByName(const QString &name);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user