Comments (3)
We could have default value for struct like propose in #2936 , you could do something like:
export struct Style {
border-radius: length,
border-top-left-radius: length = -1px,
background: brush
}
component StyledRectangle {
in property <Style> style;
Rectangle {
background: style.background;
border-radius: style.border-radius;
border-top-left-radius: style.border-top-left-radius >= 0 ? style.border-top-left-radius : style.border-radius;
}
}
export component MyExample inherits Window {
width: 600px;
height: 400px;
StyledRectangle {
style: {
background: #000000;
border-top-left-radius: 8px;
}
}
}
But in general, we might want to have option<...>
types.
from slint.
border-top-left-radius: style.border-top-left-radius >= 0 ? style.border-top-left-radius : style.border-radius;
I think from user perspective that looks more like a workaround. As user I want to do something like on the Rectangle
directly, if I do not define a value for border-radius
it should be ignored and it should not override values like border-top-left-radius
.
from slint.
Right, for the general case, we would need to introduced a new type like option<length>
or length?
or something like that.
Somehow related: #615
from slint.
Related Issues (20)
- Support libraries in LSP
- Compiler panic compiling `init` callback from a component inlined into a repeater HOT 1
- Include LTS Version as slintpad dependency
- I created a TextEdit that automatically fills in a string of keyboard characters when switching from the desktop window. Can anyone tell me why? I am very distressed HOT 4
- hide() directly closes the program HOT 3
- The emoji in TextInput is gray HOT 3
- TextInput symbol output issue HOT 2
- Mousing off the end of a slider drag doesn't change value HOT 1
- Slint has been in contact for a week, summarizing the issues HOT 1
- Why is the result of slint viewer different from vscode, and the rendering result of rust the same as that of slint viewer?
- Text blurry with femtovg renderer HOT 1
- Feature Request: Top Level Generic Widget HOT 4
- Dependencies within slint crates are out of sync with each other. HOT 4
- Winit-skia-vulkan crash HOT 3
- Moving a named element produces a syntax error HOT 3
- Partial override fields of a struct HOT 2
- VSCode language server panic in dynamic_item_tree.rs HOT 3
- Screen doesn't update until manually changing the window to fullscreen in Windows 10 HOT 1
- Property change is propagated too far (even when the value remains the same) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slint.