-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ListView: fix default height of items
- Loading branch information
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* LICENSE BEGIN | ||
This file is part of the SixtyFPS Project -- https://sixtyfps.io | ||
Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io> | ||
Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io> | ||
|
||
SPDX-License-Identifier: GPL-3.0-only | ||
This file is also available under commercial licensing terms. | ||
Please contact info@sixtyfps.io for more information. | ||
LICENSE END */ | ||
|
||
import { ListView } from "sixtyfps_widgets.60"; | ||
|
||
TestCase := Window { | ||
width: 400px; | ||
height: 540px; | ||
|
||
property <string> value; | ||
|
||
listview := ListView { | ||
for data in [ | ||
{ text: "Blue", color: #0000ff, bg: #eeeeee}, | ||
{ text: "Red", color: #ff0000, bg: #eeeeee}, | ||
{ text: "Green", color: #00ff00, bg: #eeeeee}, | ||
{ text: "Yellow", color: #ffff00, bg: #222222 }, | ||
{ text: "Black", color: #000000, bg: #eeeeee }, | ||
{ text: "White", color: #ffffff, bg: #222222 }, | ||
{ text: "Magenta", color: #ff00ff, bg: #eeeeee }, | ||
{ text: "Cyan", color: #00ffff, bg: #222222 }, | ||
] : delegate := Rectangle { | ||
background: @linear-gradient(90deg, data.bg,data.bg.brighter(0.5)); | ||
width: 100%; // FIXME shouldn't be needed | ||
HorizontalLayout { | ||
text_Name := Text { | ||
height: 100px; | ||
text: data.text; | ||
color: data.color; | ||
font_size: 20px ; | ||
} | ||
} | ||
TouchArea { clicked => { value = data.text; } } | ||
} | ||
} | ||
} | ||
|
||
/* | ||
```cpp | ||
auto handle = TestCase::create(); | ||
const TestCase &instance = *handle; | ||
sixtyfps::testing::send_mouse_click(&instance, 5., 205.); | ||
assert_eq(instance.get_value(), "Green"); | ||
``` | ||
|
||
```rust | ||
let instance = TestCase::new(); | ||
sixtyfps::testing::send_mouse_click(&instance, 5., 205.); | ||
assert_eq!(instance.get_value(), "Green"); | ||
``` | ||
|
||
```js | ||
var instance = new sixtyfps.TestCase(); | ||
instance.send_mouse_click(5., 205.); | ||
assert.equal(instance.value, "Green"); | ||
``` | ||
|
||
*/ |