-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tripolskypetr
committed
Jul 3, 2019
1 parent
d57e635
commit 677a128
Showing
3 changed files
with
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# QML flex layout | ||
|
||
Qt quick layout system is real ugly. It would be much more convenient to use flexbox for positioning elements. This repository contains a set of qt quick bindings to the [Yoga](https://github.com/facebook/yoga) layout engine from React Native for rendering flexbox. | ||
|
||
![Screenshot](docs/screenshot.png) | ||
|
||
``` | ||
import QtQuick 2.5 | ||
import QtQuick.Window 2.0 | ||
Window { | ||
visible: true | ||
height: 400 | ||
width: 675 | ||
Rectangle { | ||
anchors.fill: parent | ||
color: "cyan" | ||
Flex { | ||
height: parent.height | ||
width: parent.width | ||
flexDirection: "row" | ||
flexWrap: "wrap" | ||
justifyContent: "spaceAround" | ||
alignItems: "center" | ||
alignSelf: "center" | ||
alignContent: "stretch" | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
Rectangle { color: "green"; height: 150; width: 150 } | ||
} | ||
} | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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