Fix QML performance and stability issues
- Fix TypeError by using explicit id instead of parent.parent chains - Remove onContentHeightChanged handler that caused layout thrashing - Add active guard on Loader to prevent null modelData access - Simplify blockSegments null checks
This commit is contained in:
parent
0ac03a9931
commit
b77667fbfb
21
gui/main.qml
21
gui/main.qml
|
|
@ -1265,13 +1265,6 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onContentHeightChanged: {
|
|
||||||
// Content height changed (e.g., after loading) - scroll if following
|
|
||||||
if (shouldAutoScroll && count > 0) {
|
|
||||||
positionViewAtEnd()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
// New block added - always scroll if we were following
|
// New block added - always scroll if we were following
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
|
@ -1393,10 +1386,11 @@ property bool blockExpanded: {
|
||||||
model: blockSegments || []
|
model: blockSegments || []
|
||||||
|
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
width: parent.width
|
width: parent ? parent.width : 0
|
||||||
sourceComponent: modelData.type === "diagram" ? diagramComponent : textComponent
|
active: modelData !== null && modelData !== undefined
|
||||||
|
sourceComponent: (modelData && modelData.type === "diagram") ? diagramComponent : textComponent
|
||||||
|
|
||||||
property var segmentData: modelData
|
property var segmentData: modelData || {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1406,6 +1400,7 @@ property bool blockExpanded: {
|
||||||
id: textComponent
|
id: textComponent
|
||||||
|
|
||||||
TextEdit {
|
TextEdit {
|
||||||
|
id: textSegmentEdit
|
||||||
width: parent ? parent.width : 100
|
width: parent ? parent.width : 100
|
||||||
text: segmentData.html || ""
|
text: segmentData.html || ""
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
|
|
@ -1427,12 +1422,12 @@ property bool blockExpanded: {
|
||||||
id: textSegmentMenu
|
id: textSegmentMenu
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Copy"
|
text: "Copy"
|
||||||
enabled: parent.parent.selectedText.length > 0
|
enabled: textSegmentEdit.selectedText.length > 0
|
||||||
onTriggered: parent.parent.copy()
|
onTriggered: textSegmentEdit.copy()
|
||||||
}
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "Select All"
|
text: "Select All"
|
||||||
onTriggered: parent.parent.selectAll()
|
onTriggered: textSegmentEdit.selectAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue