From 12c9e79bf234081527a6d463794c00b70f1d1ed7 Mon Sep 17 00:00:00 2001 From: RedLine AI Agent Date: Fri, 5 Sep 2025 20:54:30 +0000 Subject: [PATCH] Update: app/xtreewidgetitem.cpp --- app/xtreewidgetitem.cpp | 112 ++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/app/xtreewidgetitem.cpp b/app/xtreewidgetitem.cpp index bed2d07..affe42e 100644 --- a/app/xtreewidgetitem.cpp +++ b/app/xtreewidgetitem.cpp @@ -1,56 +1,56 @@ -#include "xtreewidgetitem.h" - -XTreeWidgetItem::XTreeWidgetItem(QTreeWidget *parent, bool group) - : QTreeWidgetItem(parent) - , isGroup(group) - , mCategory(CATEGORY_NONE) { - -} - -XTreeWidgetItem::XTreeWidgetItem(QTreeWidgetItem *parent, bool group) - : QTreeWidgetItem(parent) - , isGroup(group) - , mCategory(CATEGORY_NONE) { - -} - -void XTreeWidgetItem::SetCategory(TREE_CATEGORY category) -{ - mCategory = category; -} - -TREE_CATEGORY XTreeWidgetItem::GetCategory() -{ - return mCategory; -} - -bool XTreeWidgetItem::operator<(const QTreeWidgetItem &other) const { - // Attempt to cast the other item to our custom type. - const XTreeWidgetItem* otherItem = dynamic_cast(&other); - if (otherItem) { - bool thisIsGroup = this->childCount() > 0; - bool otherIsGroup = otherItem->childCount() > 0; - - if (thisIsGroup != otherIsGroup) { - return otherIsGroup; // Groups should come before non-groups - } - } - // Fallback to the default string comparison on the current sort column. - return QTreeWidgetItem::operator<(other); -} - - -XTreeWidgetItem& XTreeWidgetItem::operator=(const XTreeWidgetItem &other) -{ - if (this != &other) { - // Copy text and icon for each column. - const int colCount = other.columnCount(); - for (int i = 0; i < colCount; ++i) { - setText(i, other.text(i)); - setIcon(i, other.icon(i)); - } - // Copy custom members. - this->isGroup = other.isGroup; - } - return *this; -} +#include "xtreewidgetitem.h" + +XTreeWidgetItem::XTreeWidgetItem(QTreeWidget *parent, bool group) + : QTreeWidgetItem(parent) + , isGroup(group) + , mCategory(CATEGORY_NONE) { + +} + +XTreeWidgetItem::XTreeWidgetItem(QTreeWidgetItem *parent, bool group) + : QTreeWidgetItem(parent) + , isGroup(group) + , mCategory(CATEGORY_NONE) { + +} + +void XTreeWidgetItem::SetCategory(TREE_CATEGORY category) +{ + mCategory = category; +} + +TREE_CATEGORY XTreeWidgetItem::GetCategory() +{ + return mCategory; +} + +bool XTreeWidgetItem::operator<(const QTreeWidgetItem &other) const { + // Attempt to cast the other item to our custom type. + const XTreeWidgetItem* otherItem = dynamic_cast(&other); + if (otherItem) { + bool thisIsGroup = this->childCount() > 0; + bool otherIsGroup = otherItem->childCount() > 0; + + if (thisIsGroup != otherIsGroup) { + return otherIsGroup; // Groups should come before non-groups + } + } + // Fallback to the default string comparison on the current sort column. + return QTreeWidgetItem::operator<(other); +} + + +XTreeWidgetItem& XTreeWidgetItem::operator=(const XTreeWidgetItem &other) +{ + if (this != &other) { + // Copy text and icon for each column. + const int colCount = other.columnCount(); + for (int i = 0; i < colCount; ++i) { + setText(i, other.text(i)); + setIcon(i, other.icon(i)); + } + // Copy custom members. + this->isGroup = other.isGroup; + } + return *this; +}