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: {
|
||||
// New block added - always scroll if we were following
|
||||
if (count > 0) {
|
||||
|
|
@ -1393,10 +1386,11 @@ property bool blockExpanded: {
|
|||
model: blockSegments || []
|
||||
|
||||
delegate: Loader {
|
||||
width: parent.width
|
||||
sourceComponent: modelData.type === "diagram" ? diagramComponent : textComponent
|
||||
width: parent ? parent.width : 0
|
||||
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
|
||||
|
||||
TextEdit {
|
||||
id: textSegmentEdit
|
||||
width: parent ? parent.width : 100
|
||||
text: segmentData.html || ""
|
||||
textFormat: Text.RichText
|
||||
|
|
@ -1427,12 +1422,12 @@ property bool blockExpanded: {
|
|||
id: textSegmentMenu
|
||||
MenuItem {
|
||||
text: "Copy"
|
||||
enabled: parent.parent.selectedText.length > 0
|
||||
onTriggered: parent.parent.copy()
|
||||
enabled: textSegmentEdit.selectedText.length > 0
|
||||
onTriggered: textSegmentEdit.copy()
|
||||
}
|
||||
MenuItem {
|
||||
text: "Select All"
|
||||
onTriggered: parent.parent.selectAll()
|
||||
onTriggered: textSegmentEdit.selectAll()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in New Issue