chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -3,41 +3,27 @@
|
||||
#include <QUuid>
|
||||
|
||||
#include "ElaNavigationNode.h"
|
||||
ElaFooterModel::ElaFooterModel(QObject* parent)
|
||||
: QAbstractListModel{parent}
|
||||
{
|
||||
_pSelectedNode = nullptr;
|
||||
}
|
||||
ElaFooterModel::ElaFooterModel(QObject *parent) : QAbstractListModel{parent} { _pSelectedNode = nullptr; }
|
||||
|
||||
ElaFooterModel::~ElaFooterModel()
|
||||
{
|
||||
qDeleteAll(_footerNodeList);
|
||||
}
|
||||
ElaFooterModel::~ElaFooterModel() { qDeleteAll(_footerNodeList); }
|
||||
|
||||
int ElaFooterModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
return _footerNodeList.count();
|
||||
}
|
||||
int ElaFooterModel::rowCount(const QModelIndex &parent) const { return _footerNodeList.count(); }
|
||||
|
||||
QVariant ElaFooterModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (role == Qt::UserRole)
|
||||
{
|
||||
if (index.row() < _footerNodeList.count())
|
||||
{
|
||||
QVariant ElaFooterModel::data(const QModelIndex &index, int role) const {
|
||||
if (role == Qt::UserRole) {
|
||||
if (index.row() < _footerNodeList.count()) {
|
||||
return QVariant::fromValue(_footerNodeList[index.row()]);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
ElaNavigationType::NodeOperateReturnType ElaFooterModel::addFooterNode(QString footerTitle, QString& footerKey, bool isHasFooterPage, int keyPoints, ElaIconType::IconName awesome)
|
||||
{
|
||||
if (_footerNodeList.count() >= 3)
|
||||
{
|
||||
ElaNavigationType::NodeOperateReturnType ElaFooterModel::addFooterNode(QString footerTitle, QString &footerKey, bool isHasFooterPage, int keyPoints,
|
||||
ElaIconType::IconName awesome) {
|
||||
if (_footerNodeList.count() >= 3) {
|
||||
return ElaNavigationType::FooterUpperLimit;
|
||||
}
|
||||
ElaNavigationNode* node = new ElaNavigationNode(footerTitle);
|
||||
ElaNavigationNode *node = new ElaNavigationNode(footerTitle);
|
||||
node->setKeyPoints(keyPoints);
|
||||
node->setIsFooterNode(true);
|
||||
node->setIsHasFooterPage(isHasFooterPage);
|
||||
@@ -50,29 +36,20 @@ ElaNavigationType::NodeOperateReturnType ElaFooterModel::addFooterNode(QString f
|
||||
return ElaNavigationType::Success;
|
||||
}
|
||||
|
||||
int ElaFooterModel::getFooterNodeCount() const
|
||||
{
|
||||
return _footerNodeList.count();
|
||||
}
|
||||
int ElaFooterModel::getFooterNodeCount() const { return _footerNodeList.count(); }
|
||||
|
||||
ElaNavigationNode* ElaFooterModel::getNavigationNode(QString footerKey)
|
||||
{
|
||||
for (auto node: _footerNodeList)
|
||||
{
|
||||
if (node->getNodeKey() == footerKey)
|
||||
{
|
||||
ElaNavigationNode *ElaFooterModel::getNavigationNode(QString footerKey) {
|
||||
for (auto node : _footerNodeList) {
|
||||
if (node->getNodeKey() == footerKey) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ElaFooterModel::removeNavigationNode(QString footerKey)
|
||||
{
|
||||
for (auto node: _footerNodeList)
|
||||
{
|
||||
if (node->getNodeKey() == footerKey)
|
||||
{
|
||||
void ElaFooterModel::removeNavigationNode(QString footerKey) {
|
||||
for (auto node : _footerNodeList) {
|
||||
if (node->getNodeKey() == footerKey) {
|
||||
_footerNodeList.removeOne(node);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user