Add collapsed group child count display

Show "(N)" in the value area when a property group is collapsed,
indicating how many properties are inside. Also restore original
expand/unexpand icon logic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Jesse Qu 2026-05-20 12:14:20 +08:00
parent 3d88a3615a
commit 130225e9b8
2 changed files with 24 additions and 2 deletions

View File

@ -35,8 +35,8 @@ QPair<QQuickItem*, QQuickItem*> QQuickDetailsViewRowBuilder::makeNameValueSlot()
x: padding + (detailsDelegate.depth * detailsDelegate.indent)
anchors.verticalCenter: parent.verticalCenter
mipmap: true
source: detailsDelegate.expanded
? "qrc:/resources/Icon/expand.png"
source: detailsDelegate.expanded
? "qrc:/resources/Icon/expand.png"
: "qrc:/resources/Icon/unexpand.png"
width: 12

View File

@ -165,5 +165,27 @@ void QDetailsViewRow_Group::setupItem(QQuickItem* inParent)
}
)");
groupLabel->setProperty("lableText", mName);
int childCount = mChildren.size();
QQuickItem* countLabel = builder.setupItem(slotPair.second, R"qml(
import QtQuick;
import QtQuick.Controls;
import ColorPalette;
Item{
property int groupChildCount: 0
implicitHeight: 25
width: parent.width
anchors.verticalCenter: parent.verticalCenter
visible: !detailsDelegate.expanded
Text {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
text: "(" + groupChildCount + ")"
color: ColorPalette.theme.textPrimary
}
}
)qml");
countLabel->setProperty("groupChildCount", childCount);
builder.setHeightProxy(groupLabel);
}