[kcm/kwinrules] Fix first item position on property list
The first time the list in `Add properties` is shown, the position of the first delegate is miscalculated as (0, 0) and gets hidden behind the section header. It only repositions when the delegate is destroyed and re-created, for example, when setting and deleting a filter text. (https://bugs.kde.org/show_bug.cgi?id=422289) This works-around it by delaying the `overlayModel` filtering until the list is first shown, which makes the delegate position correctly. BUG: 421583 FIXED-IN: 5.19
This commit is contained in:
parent
783c2f47d6
commit
623ee1011c
1 changed files with 12 additions and 0 deletions
|
@ -202,6 +202,7 @@ ScrollViewKCM {
|
|||
onSheetOpenChanged: {
|
||||
searchField.text = "";
|
||||
if (sheetOpen) {
|
||||
overlayModel.ready = true;
|
||||
searchField.forceActiveFocus();
|
||||
} else {
|
||||
overlayModel.onlySuggestions = false;
|
||||
|
@ -249,8 +250,19 @@ ScrollViewKCM {
|
|||
invalidateFilter();
|
||||
}
|
||||
|
||||
// Delay the model filtering until `ready` is set
|
||||
// FIXME: Workaround https://bugs.kde.org/show_bug.cgi?id=422289
|
||||
property bool ready: false
|
||||
onReadyChanged: {
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
filterString: searchField.text.trim().toLowerCase()
|
||||
filterRowCallback: (source_row, source_parent) => {
|
||||
if (!ready) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var index = sourceModel.index(source_row, 0, source_parent);
|
||||
|
||||
var hasSuggestion = sourceModel.data(index, RulesModel.SuggestedValueRole) != null;
|
||||
|
|
Loading…
Reference in a new issue