on xenial help sign in
Use binding for filter popover contentWidth (LP: #1595116)
4dc626dAndrea Cimitan
qml/Dash/GenericScopeView.qml+1−1
@@ -662,7 +662,7 @@ FocusScope {
662 }
662 }
663 onShowFiltersPopup: { // item
663 onShowFiltersPopup: { // item
664 extraPanel.visible = false;
664 extraPanel.visible = false;
665− scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": scopeView.width - units.gu(2) } );
665+ scopeView.filtersPopover = PopupUtils.open(Qt.resolvedUrl("FiltersPopover.qml"), item, { "contentWidth": Qt.binding(function() { return scopeView.width - units.gu(2); } ) } );
666 scopeView.filtersPopover.Component.onDestruction.connect(function () {
666 scopeView.filtersPopover.Component.onDestruction.connect(function () {
667 categoryView.pageHeader.closePopup(false, true);
667 categoryView.pageHeader.closePopup(false, true);
668 categoryView.pageHeader.unfocus(true); // remove the focus from the search field
668 categoryView.pageHeader.unfocus(true); // remove the focus from the search field
tests/qmltests/Dash/tst_DashContent.qml+13−1
@@ -524,7 +524,6 @@ Item {
524 var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel");
524 var peExtraPanel = findChild(dashContentList.currentItem, "peExtraPanel");
525 var headerContainer = findChild(pageHeader, "headerContainer");
525 var headerContainer = findChild(pageHeader, "headerContainer");
526
526
527− // test that closing the filters popover without a search unfocuses and removes the navigation
528 mouseClick(searchButton);
527 mouseClick(searchButton);
529 tryCompare(peExtraPanel, "visible", true);
528 tryCompare(peExtraPanel, "visible", true);
530
529
@@ -536,6 +535,19 @@ Item {
536 filtersPopover = findChild(shell, "filtersPopover")
535 filtersPopover = findChild(shell, "filtersPopover")
537 verify(filtersPopover);
536 verify(filtersPopover);
538
537
538+ // test that popover resizes
539+ var shellWidth = shell.width;
540+ var popoverWidth = filtersPopover.contentWidth;
541+
542+ shell.width = shellWidth + units.gu(60);
543+ waitForRendering(shell);
544+
545+ tryCompare(filtersPopover, "contentWidth", popoverWidth + units.gu(60));
546+
547+ shell.width = shellWidth;
548+ waitForRendering(shell);
549+
550+ // test that closing the filters popover without a search unfocuses and removes the navigation
539 mouseClick(shell, shell.width - 1, shell.height - 1);
551 mouseClick(shell, shell.width - 1, shell.height - 1);
540
552
541 tryCompare(pageHeader.extraPanel, "visible", false);
553 tryCompare(pageHeader.extraPanel, "visible", false);