chore: 格式化ElaWidgetTools代码

This commit is contained in:
sleepwithoutbz
2025-09-20 01:39:00 +08:00
parent d2fded145d
commit 4ab391f8a1
394 changed files with 10913 additions and 15860 deletions

View File

@@ -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;
}