mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
refs #247 Using CVariant in blackgui.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace BlackGui
|
||||
this->m_model->setIconMode(withIcon);
|
||||
}
|
||||
|
||||
bool CNameVariantPairView::addOrUpdateByName(const QString &name, const QVariant &value, const CIcon &icon, bool resize, bool skipEqualValues)
|
||||
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);
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackGui
|
||||
void setIconMode(bool withIcon);
|
||||
|
||||
//! Update or add value, QVariant version
|
||||
bool addOrUpdateByName(const QString &name, const QVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool performResizing = true, bool skipEqualValues = true);
|
||||
bool addOrUpdateByName(const QString &name, const BlackMisc::CVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool performResizing = true, bool skipEqualValues = true);
|
||||
|
||||
//! Remove by name
|
||||
void removeByName(const QString &name, bool performResizing = true);
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace BlackGui
|
||||
{
|
||||
ContainerType sortedContainer = model->sortContainerByColumn(container, sortColumn, sortOrder);
|
||||
QMetaObject::invokeMethod(this, "updateContainer",
|
||||
Q_ARG(QVariant, sortedContainer.toQVariant()), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
Q_ARG(BlackMisc::CVariant, sortedContainer.toCVariant()), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
});
|
||||
worker->then(this, &CViewBase::asyncUpdateFinished);
|
||||
return worker;
|
||||
@@ -250,10 +250,10 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType> int CViewBase<ModelClass, ContainerType>::performUpdateContainer(const QVariant &variant, bool sort, bool resize)
|
||||
template <class ModelClass, class ContainerType> int CViewBase<ModelClass, ContainerType>::performUpdateContainer(const BlackMisc::CVariant &variant, bool sort, bool resize)
|
||||
{
|
||||
ContainerType c;
|
||||
c.convertFromQVariant(variant);
|
||||
c.convertFromCVariant(variant);
|
||||
return this->updateContainer(c, sort, resize);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include "blackmisc/variant.h"
|
||||
#include <QTableView>
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
@@ -101,7 +102,7 @@ namespace BlackGui
|
||||
//! \param variant contains the container
|
||||
//! \param sort
|
||||
//! \param performResizing
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool performResizing) = 0;
|
||||
virtual int performUpdateContainer(const BlackMisc::CVariant &variant, bool sort, bool performResizing) = 0;
|
||||
|
||||
//! Skip resizing because of size?
|
||||
virtual bool reachedResizeThreshold() const = 0;
|
||||
@@ -122,7 +123,7 @@ namespace BlackGui
|
||||
|
||||
protected slots:
|
||||
//! Helper method with template free signature serving as callback from threaded worker
|
||||
int updateContainer(const QVariant &variant, bool sort, bool resize)
|
||||
int updateContainer(const BlackMisc::CVariant &variant, bool sort, bool resize)
|
||||
{
|
||||
return this->performUpdateContainer(variant, sort, resize);
|
||||
}
|
||||
@@ -214,7 +215,7 @@ namespace BlackGui
|
||||
virtual void performResizeToContents() override;
|
||||
|
||||
//! \copydoc CViewBaseNonTemplate::performUpdateContainer
|
||||
virtual int performUpdateContainer(const QVariant &variant, bool sort, bool performResizing) override;
|
||||
virtual int performUpdateContainer(const BlackMisc::CVariant &variant, bool sort, bool performResizing) override;
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user