Skip to content

Cannot open Popup from another Popup or ContextMenuArea #8891

Open
@Skilvingr

Description

@Skilvingr

Bug Description

Hi all,

  • What are the bugs?

    1. A popup cannot be opened from a context menu if that menu is not closed before calling popup.show() [line 43].
    2. A popup cannot be opened from another popup if the first one is not closed before calling popup2.show() [line 30].
  • What behaviour did I expect, and what happened instead?

    1. Maybe the context menu should close itself automatically after a click?
    2. The second popup should display correctly even if opened from another popup.
  • Any error messages or logs, if available.

    qt.qpa.wayland: Creating a popup with a parent, QWidgetWindow(0x5ff6b1570850, name="QWidgetClassWindow") which does not match the current topmost grabbing popup, QWidgetWindow(0x5ff6b154bb50, name="QWidgetClassWindow") With some shell surface protocols, this is not allowed. The wayland QPA plugin is currently handling it by setting the parent to the topmost grabbing popup. Note, however, that this may cause positioning errors and popups closing unxpectedly. Please fix the transient parent of the popup.
    
  • Steps to reproduce the issue
    Just execute the attached code with Qt set as backend.

    I've also made a repository with the exact configuration I used.

  • Suggestions
    I've worked with Qt for some time and this behaviour could well be more a "feature" than a bug, or at least I can remember something similar. If that is the case, I would add a sort of a warning in the docs.

Thanks

Reproducible Code (if applicable)

import { Button } from "std-widgets.slint";

export component App inherits Window {
    preferred-width: 700px;
    preferred-height: 500px;

    popup2 := PopupWindow {
        width: root.width / 2;
        height: root.height / 2;

        Rectangle {
            background: Colors.green;
            Text {
                text: "Text";
            }
        }
    }

    popup := PopupWindow {
        width: root.width / 2;
        height: root.height / 2;

        Rectangle {
            background: Colors.red;

            Button {
                text: "Open second popup";
                clicked => {
                    // The following line must be uncommented to show the second popup
                    //popup.close();
                    popup2.show();
                }
            }
        }
    }

    context_menu := ContextMenuArea {
        Menu {
            MenuItem {
                title: "Open popup";
                activated => {
                    // The following line must be uncommented to show the first popup
                    //context_menu.close();
                    popup.show();
                }
            }
        }
    }

    Button {
        text: "Show context menu";
        clicked => {
            context_menu.show(self.absolute-position);
        }
    }
}

Environment Details

  • Slint Version: 1.12.1
  • Platform/OS: Arch Linux
  • Programming Language: Rust
  • Backend/Renderer: Qt v6.9.0.1

Product Impact

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    need triagingIssue that the owner of the area still need to triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions