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

@@ -2,161 +2,114 @@
#include <QUuid>
ElaNavigationNode::ElaNavigationNode(QString nodeTitle, ElaNavigationNode* parent)
: QObject(parent)
{
_pDepth = 0;
_pKeyPoints = 0;
_nodeKey = QUuid::createUuid().toString().remove("{").remove("}").remove("-");
_nodeTitle = nodeTitle;
_pIsRootNode = false;
_pIsFooterNode = false;
ElaNavigationNode::ElaNavigationNode(QString nodeTitle, ElaNavigationNode *parent) : QObject(parent) {
_pDepth = 0;
_pKeyPoints = 0;
_nodeKey = QUuid::createUuid().toString().remove("{").remove("}").remove("-");
_nodeTitle = nodeTitle;
_pIsRootNode = false;
_pIsFooterNode = false;
_pIsHasFooterPage = false;
_pParentNode = parent;
_pIsExpanderNode = false;
_pIsVisible = false;
_pParentNode = parent;
_pIsExpanderNode = false;
_pIsVisible = false;
}
ElaNavigationNode::~ElaNavigationNode()
{
qDeleteAll(_pChildrenNodes);
}
ElaNavigationNode::~ElaNavigationNode() { qDeleteAll(_pChildrenNodes); }
QString ElaNavigationNode::getNodeKey() const
{
return _nodeKey;
}
QString ElaNavigationNode::getNodeKey() const { return _nodeKey; }
QString ElaNavigationNode::getNodeTitle() const
{
return _nodeTitle;
}
QString ElaNavigationNode::getNodeTitle() const { return _nodeTitle; }
void ElaNavigationNode::setIsExpanded(bool isExpanded)
{
void ElaNavigationNode::setIsExpanded(bool isExpanded) {
_isExpanded = isExpanded;
setChildVisible(isExpanded);
}
bool ElaNavigationNode::getIsExpanded() const
{
return _isExpanded;
}
bool ElaNavigationNode::getIsExpanded() const { return _isExpanded; }
void ElaNavigationNode::setChildVisible(bool isVisible)
{
if (isVisible)
{
for (auto node: _pChildrenNodes)
{
void ElaNavigationNode::setChildVisible(bool isVisible) {
if (isVisible) {
for (auto node : _pChildrenNodes) {
node->setIsVisible(isVisible);
if (node->getIsExpanderNode() && !node->getIsExpanded())
{
if (node->getIsExpanderNode() && !node->getIsExpanded()) {
continue;
}
node->setChildVisible(isVisible);
}
}
else
{
for (auto node: _pChildrenNodes)
{
} else {
for (auto node : _pChildrenNodes) {
node->setChildVisible(isVisible);
node->setIsVisible(isVisible);
}
}
}
bool ElaNavigationNode::getIsHasChild() const
{
if (_pChildrenNodes.count() > 0)
{
bool ElaNavigationNode::getIsHasChild() const {
if (_pChildrenNodes.count() > 0) {
return true;
}
return false;
}
bool ElaNavigationNode::getIsHasPageChild() const
{
if (_pChildrenNodes.count() == 0)
{
bool ElaNavigationNode::getIsHasPageChild() const {
if (_pChildrenNodes.count() == 0) {
return false;
}
for (auto childNode: _pChildrenNodes)
{
if (!childNode->getIsExpanderNode())
{
for (auto childNode : _pChildrenNodes) {
if (!childNode->getIsExpanderNode()) {
return true;
}
if (childNode->getIsHasPageChild())
{
if (childNode->getIsHasPageChild()) {
return true;
}
}
return false;
}
void ElaNavigationNode::appendChildNode(ElaNavigationNode* childNode)
{
if (_pIsExpanderNode)
{
void ElaNavigationNode::appendChildNode(ElaNavigationNode *childNode) {
if (_pIsExpanderNode) {
_pChildrenNodes.append(childNode);
}
}
void ElaNavigationNode::removeChildNode(ElaNavigationNode* childNode)
{
if (_pIsExpanderNode)
{
void ElaNavigationNode::removeChildNode(ElaNavigationNode *childNode) {
if (_pIsExpanderNode) {
_pChildrenNodes.removeOne(childNode);
}
}
bool ElaNavigationNode::getIsChildHasKeyPoints() const
{
for (auto childNnode: _pChildrenNodes)
{
if (childNnode->getKeyPoints())
{
bool ElaNavigationNode::getIsChildHasKeyPoints() const {
for (auto childNnode : _pChildrenNodes) {
if (childNnode->getKeyPoints()) {
return true;
}
if (childNnode->getIsChildHasKeyPoints())
{
if (childNnode->getIsChildHasKeyPoints()) {
return true;
}
}
return false;
}
ElaNavigationNode* ElaNavigationNode::getOriginalNode()
{
if (this->getParentNode()->getIsRootNode())
{
ElaNavigationNode *ElaNavigationNode::getOriginalNode() {
if (this->getParentNode()->getIsRootNode()) {
return this;
}
else
{
ElaNavigationNode* originalNode = this->getParentNode();
while (!originalNode->getIsRootNode() && !originalNode->getParentNode()->getIsRootNode())
{
} else {
ElaNavigationNode *originalNode = this->getParentNode();
while (!originalNode->getIsRootNode() && !originalNode->getParentNode()->getIsRootNode()) {
originalNode = originalNode->getParentNode();
}
return originalNode;
}
}
bool ElaNavigationNode::getIsChildNode(ElaNavigationNode* node)
{
if (_pChildrenNodes.count() > 0)
{
if (_pChildrenNodes.contains(node))
{
bool ElaNavigationNode::getIsChildNode(ElaNavigationNode *node) {
if (_pChildrenNodes.count() > 0) {
if (_pChildrenNodes.contains(node)) {
return true;
}
for (auto childNnode: _pChildrenNodes)
{
if (childNnode->getIsChildNode(node))
{
for (auto childNnode : _pChildrenNodes) {
if (childNnode->getIsChildNode(node)) {
return true;
}
}
@@ -164,11 +117,9 @@ bool ElaNavigationNode::getIsChildNode(ElaNavigationNode* node)
return false;
}
int ElaNavigationNode::getRow() const
{
if (_pParentNode)
{
return _pParentNode->getChildrenNodes().indexOf(const_cast<ElaNavigationNode*>(this));
int ElaNavigationNode::getRow() const {
if (_pParentNode) {
return _pParentNode->getChildrenNodes().indexOf(const_cast<ElaNavigationNode *>(this));
}
return 0;
}