hlayout & vlayout change to flex

This commit is contained in:
王劲鹏 2021-03-01 17:03:28 +08:00 committed by osborn
parent 06f47e31cc
commit 257f3f0dab
4 changed files with 8 additions and 19 deletions

View File

@ -25,7 +25,7 @@ Item {
property string alignItems: "auto" property string alignItems: "auto"
property string alignSelf: "auto" property string alignSelf: "auto"
property string justifyContent: "spaceBetween" property string justifyContent: "flexStart"
property string display: "flex" property string display: "flex"

View File

@ -2,21 +2,5 @@ import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Flex { Flex {
height: 400
width: 675
flexDirection: "row" 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 }
} }

View File

@ -1,7 +1,11 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.5 import QtQuick.Controls 2.5
Column { Flex {
flexDirection: "column"
alignItems: "center"
alignSelf: "center"
justifyContent: "spaceAround"
alignContent: "stretch"
} }

View File

@ -2,6 +2,7 @@
FlexLayout::FlexLayout(FlexLayoutConfig *config, QObject *parent) FlexLayout::FlexLayout(FlexLayoutConfig *config, QObject *parent)
: QObject(parent) { : QObject(parent) {
qCritical() << "create flex";
node = YGNodeNewWithConfig(config->getConfig()); node = YGNodeNewWithConfig(config->getConfig());
this->config = config; this->config = config;
} }