forked from openkylin/ukui-panel
fix: 简化Container实现代码
This commit is contained in:
parent
caeee413dd
commit
eed215da67
|
@ -1,5 +1,4 @@
|
|||
import QtQuick 2.15
|
||||
import QtQml.Models 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.ukui.quick.widgets 1.0
|
||||
|
@ -16,16 +15,6 @@ WidgetContainerItem {
|
|||
anchors.fill = parent
|
||||
}
|
||||
|
||||
onWidgetItemAdded: (widgetItem) => {
|
||||
widgetModel.append({
|
||||
"widgetItem": widgetItem
|
||||
});
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: widgetModel
|
||||
}
|
||||
|
||||
StyleBackground {
|
||||
anchors.fill: parent
|
||||
borderColor: Theme.ButtonText
|
||||
|
@ -44,14 +33,14 @@ WidgetContainerItem {
|
|||
bottomMargin: containerItem.WidgetContainer.padding.bottom
|
||||
}
|
||||
|
||||
rows: containerItem.isHorizontal ? 1 : widgetModel.count
|
||||
columns: containerItem.isHorizontal ? widgetModel.count : 1
|
||||
rows: containerItem.isHorizontal ? 1 : repeater.count
|
||||
columns: containerItem.isHorizontal ? repeater.count : 1
|
||||
rowSpacing: 4
|
||||
columnSpacing: 4
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: widgetModel
|
||||
model: containerItem.widgetItemModel
|
||||
delegate: widgetLoaderComponent
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue