mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
/* Copyright (C) 2013
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "namevariantpairview.h"
|
|
#include <QHeaderView>
|
|
|
|
using namespace BlackMisc;
|
|
using namespace BlackGui::Models;
|
|
|
|
namespace BlackGui
|
|
{
|
|
namespace Views
|
|
{
|
|
CNameVariantPairView::CNameVariantPairView(QWidget *parent) : CViewBase(parent)
|
|
{
|
|
m_forceStretchLastColumnWhenResized = true;
|
|
this->standardInit(new CNameVariantPairModel(true, this));
|
|
}
|
|
|
|
void CNameVariantPairView::setIconMode(bool withIcon)
|
|
{
|
|
Q_ASSERT(this->m_model);
|
|
this->m_model->setIconMode(withIcon);
|
|
}
|
|
|
|
bool CNameVariantPairView::addOrUpdateByName(const QString &name, const BlackMisc::CVariant &value, const CIcon &icon, bool resize, bool skipEqualValues)
|
|
{
|
|
Q_ASSERT(this->m_model);
|
|
bool changed = this->m_model->addOrUpdateByName(name, value, icon, skipEqualValues);
|
|
if (resize && changed) { this->resizeToContents(); }
|
|
return changed;
|
|
}
|
|
|
|
void CNameVariantPairView::removeByName(const QString &name, bool resize)
|
|
{
|
|
this->m_model->removeByName(name);
|
|
if (resize) { this->resizeToContents(); }
|
|
}
|
|
|
|
bool CNameVariantPairView::containsName(const QString &name)
|
|
{
|
|
return this->m_model->containsName(name);
|
|
}
|
|
}
|
|
} // namespace
|