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:
parent
3d88a3615a
commit
130225e9b8
|
|
@ -35,8 +35,8 @@ QPair<QQuickItem*, QQuickItem*> QQuickDetailsViewRowBuilder::makeNameValueSlot()
|
||||||
x: padding + (detailsDelegate.depth * detailsDelegate.indent)
|
x: padding + (detailsDelegate.depth * detailsDelegate.indent)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
mipmap: true
|
mipmap: true
|
||||||
source: detailsDelegate.expanded
|
source: detailsDelegate.expanded
|
||||||
? "qrc:/resources/Icon/expand.png"
|
? "qrc:/resources/Icon/expand.png"
|
||||||
: "qrc:/resources/Icon/unexpand.png"
|
: "qrc:/resources/Icon/unexpand.png"
|
||||||
|
|
||||||
width: 12
|
width: 12
|
||||||
|
|
|
||||||
|
|
@ -165,5 +165,27 @@ void QDetailsViewRow_Group::setupItem(QQuickItem* inParent)
|
||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
groupLabel->setProperty("lableText", mName);
|
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);
|
builder.setHeightProxy(groupLabel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue