Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
451
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
deffa06e
Commit
deffa06e
authored
1 year ago
by
Benjamin Arnaud
Committed by
Steve Lhomme
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
qml/MainViewLoader: Fix the component loading behavior
parent
7bd00edc
No related branches found
No related tags found
1 merge request
!3805
qml/MainViewLoader: Fix the component loading behavior
Pipeline
#365901
passed with warnings with stages
in 42 minutes and 35 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gui/qt/maininterface/qml/MainViewLoader.qml
+27
-17
27 additions, 17 deletions
modules/gui/qt/maininterface/qml/MainViewLoader.qml
with
27 additions
and
17 deletions
modules/gui/qt/maininterface/qml/MainViewLoader.qml
+
27
−
17
View file @
deffa06e
...
...
@@ -52,7 +52,6 @@ Widgets.StackViewExt {
// optional, loaded when model.loading is true
property
Component
loadingComponent
:
null
property
var
selectionModel
:
Util.SelectableDelegateModel
{
model
:
root
.
model
}
...
...
@@ -71,12 +70,12 @@ Widgets.StackViewExt {
return
Helpers
.
get
(
currentItem
,
"
setCurrentItemFocus
"
,
_setCurrentItemFocusDefault
)
}
property
var
c
urrentComponent
:
{
if
(
typeof
model
===
"
undefined
"
||
!
model
)
return
null
// invalid state
// NOTE: We have to use a Component here. When using a var the onC
urrentComponent
Changed event
// gets called multiple times even when the currentComponent stays the same.
property
Component
currentComponent
:
{
if
(
model
.
loading
)
return
loadingComponent
if
(
model
.
count
===
0
)
else
if
(
model
.
count
===
0
)
return
emptyLabel
else
if
(
MainCtx
.
gridView
)
return
grid
...
...
@@ -84,8 +83,11 @@ Widgets.StackViewExt {
return
list
}
onCurrentComponentChanged
:
{
_loadCurrentViewType
()
Component.onCompleted
:
{
_updateView
()
// NOTE: This call is useful to avoid a binding loop on currentComponent.
currentComponentChanged
.
connect
(
function
()
{
_updateView
()
})
}
onModelChanged
:
resetFocus
()
...
...
@@ -103,19 +105,27 @@ Widgets.StackViewExt {
}
}
function
_setCurrentItemFocusDefault
(
reason
)
{
if
(
currentItem
)
currentItem
.
forceActiveFocus
(
reason
)
function
_updateView
()
{
// NOTE: When the currentItem is null we default to the StackView focusReason.
if
(
currentItem
&&
currentItem
.
activeFocus
)
_applyView
(
currentItem
.
focusReason
)
else
if
(
activeFocus
)
_applyView
(
focusReason
)
else
replace
(
null
,
currentComponent
)
}
function
_loadCurrentViewType
()
{
if
(
typeof
currentComponent
===
"
undefined
"
||
!
currentComponent
)
{
// invalid case, don't show anything
clear
()
return
}
function
_applyView
(
reason
)
{
replace
(
null
,
currentComponent
)
setCurrentItemFocus
(
reason
)
}
function
_setCurrentItemFocusDefault
(
reason
)
{
if
(
currentItem
)
currentItem
.
forceActiveFocus
(
reason
)
else
Helpers
.
enforceFocus
(
root
,
reason
)
}
// makes the views currentIndex initial index and position view at that index
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment