Commit 5f35b40c authored by David Redondo's avatar David Redondo 🏎
Browse files

Make setting columnDisplay equivalent to user configuration

Do the same actions on initial load as if the user changed something
manually. This should fix all the column missing/duplication bugs and
reduces code duplication on top.
BUG:436686
parent 38b28765
......@@ -45,24 +45,30 @@ Dialog {
Kirigami.Theme.colorSet: Kirigami.Theme.View
function setColumnDisplay(display) {
sortModel.sortedColumns = sortedColumns
columnDisplay = display
displayModel.columnDisplay = display
visibleColumns = fixedColumns.concat(displayModel.visibleColumnIds)
prepare()
apply()
}
onAccepted: {
sortedColumns = fixedColumns.concat(sortModel.sortedColumns)
visibleColumns = fixedColumns.concat(displayModel.visibleColumnIds)
columnDisplay = displayModel.columnDisplay
apply()
}
onAboutToShow: {
prepare()
}
function prepare() {
sortModel.sortedColumns = sortedColumns.filter(id => fixedColumns.indexOf(id) == -1)
let tempDisplay = columnDisplay
fixedColumns.forEach(column => delete tempDisplay[column])
displayModel.columnDisplay = tempDisplay
}
function apply() {
sortedColumns = fixedColumns.concat(sortModel.sortedColumns)
visibleColumns = fixedColumns.concat(displayModel.visibleColumnIds)
columnDisplay = displayModel.columnDisplay
}
Rectangle {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment