mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #325, name variant pair allows test for existing values
* equal value updates can be skipped * equalsQVariant in CValueObject * resizing parameter for views
This commit is contained in:
@@ -28,17 +28,23 @@ namespace BlackGui
|
||||
this->m_model->setIconMode(withIcon);
|
||||
}
|
||||
|
||||
void CNameVariantPairView::addOrUpdateByName(const QString &name, const QString &value, const CIcon &icon)
|
||||
bool CNameVariantPairView::addOrUpdateByName(const QString &name, const QVariant &value, const CIcon &icon, bool resize, bool skipEqualValues)
|
||||
{
|
||||
Q_ASSERT(this->m_model);
|
||||
this->m_model->addOrUpdateByName(name, value, icon);
|
||||
this->resizeToContents();
|
||||
bool changed = this->m_model->addOrUpdateByName(name, value, icon, skipEqualValues);
|
||||
if (resize && changed) { this->resizeToContents(); }
|
||||
return changed;
|
||||
}
|
||||
|
||||
void CNameVariantPairView::removeByName(const QString &name)
|
||||
void CNameVariantPairView::removeByName(const QString &name, bool resize)
|
||||
{
|
||||
this->m_model->removeByName(name);
|
||||
this->resizeToContents();
|
||||
if (resize) { this->resizeToContents(); }
|
||||
}
|
||||
|
||||
bool CNameVariantPairView::containsName(const QString &name)
|
||||
{
|
||||
return this->m_model->containsName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,15 @@ namespace BlackGui
|
||||
//! 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());
|
||||
//! Update or add value, QVariant version
|
||||
bool addOrUpdateByName(const QString &name, const QVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool resize = true, bool skipEqualValues = true);
|
||||
|
||||
//! Remove by name
|
||||
void removeByName(const QString &name);
|
||||
void removeByName(const QString &name, bool resize = true);
|
||||
|
||||
//! Contains name
|
||||
bool containsName(const QString &name);
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user