Open asuper0 opened 10 months ago
I just add two commit for testing. this commit support "save" button to show message box this one show the bug
and the two pictures show difference between the two commits.
Thanks for filling a bug report. I can reproduce the problem: Here is a minimal testcase:
component PopMessageBox inherits Rectangle {
background: red;
z: 1;
// Incomment for this to work
// visible: true;
}
export component Main inherits Window {
PopMessageBox{ }
Rectangle { background: blue; }
}
You'd expect the red rectangle to be on top because of the z:1
, but that doesn't work.
It strangely does work when setting visible: true
.
This seems to point to a bug in the compiler.
When there is a visible
property in the root, we always inline earlier in the process. Which is why it "works" when visible property is present.
That said, I'm actually wondering if the z
on the root element should be allowed at all.
For example if you have:
component SomeComponent {
Abc {}
Def {}
}
Would you expect Def
to be under Abc
? (if Abc or Def have a z
at their root changing the order)
IMHO, the z
ordering should be limited to the current "scope" of components, and one shouldn't be able to hack the order by having z
set on the root.
So I'd say Def
should always be on top of Abc
regardless what z
property they set internally.
IMO it should always apply to siblings in the tree of elements. Abc and Def are siblings. Their z should apply regardless of set inside Abc or at the use-site.
So it's better to move message-box := PopMessageBox
to bottom of the main window, without giving the z property
, right?
Environment: Slint 1.3.2 Win 10
Please see the code. I implement a message box with slint. Currently the code is ok. If I comment out visable: false within the PopMessageBox and uncomment // visible: false; in main window, the message box can't mask the whole window. You can try to reproduce by invoke
show_message_box
inmain.rs
.