Working flex model
This commit is contained in:
parent
599290bf97
commit
9657c3f792
20
demo.ts
20
demo.ts
@ -56,8 +56,7 @@ const testFlexLayout = () => {
|
||||
view.setStyleSheet(
|
||||
`
|
||||
background-color: green;
|
||||
qproperty-alignItems:center;
|
||||
qproperty-justifyContent:center;
|
||||
qproperty-flex: 1;
|
||||
`
|
||||
);
|
||||
|
||||
@ -67,10 +66,21 @@ const testFlexLayout = () => {
|
||||
const label = new QLabel();
|
||||
label.setText("Hello12321");
|
||||
label.setStyleSheet(`
|
||||
background-color:blue;
|
||||
color:white;
|
||||
background-color:blue;
|
||||
color:white;
|
||||
qproperty-alignSelf: 'center';
|
||||
qproperty-minWidth: '50%';
|
||||
`);
|
||||
|
||||
const label2 = new QLabel();
|
||||
label2.setText("SECOND LABEL");
|
||||
label2.setStyleSheet(`
|
||||
background-color:green;
|
||||
color:white;
|
||||
qproperty-alignSelf: 'stretch';
|
||||
`);
|
||||
|
||||
flayout.addWidget(label2, label2.getFlexNode());
|
||||
flayout.addWidget(label, label.getFlexNode());
|
||||
|
||||
view.setLayout(flayout);
|
||||
@ -79,5 +89,5 @@ const testFlexLayout = () => {
|
||||
return win;
|
||||
};
|
||||
|
||||
// (global as any).win1 = testGridLayout(); //to keep gc from collecting
|
||||
(global as any).win1 = testGridLayout(); //to keep gc from collecting
|
||||
(global as any).win2 = testFlexLayout(); //to keep gc from collecting
|
||||
|
||||
@ -7,8 +7,54 @@ class NWidget: public QWidget, public YogaWidget
|
||||
{
|
||||
|
||||
public:
|
||||
// SET_YOGA_WIDGET_Q_PROPERTIES
|
||||
|
||||
Q_PROPERTY(QString display MEMBER _yDisplay WRITE setYDisplay)
|
||||
Q_PROPERTY(QString alignItems MEMBER _yAlignItems WRITE setYAlignItems)
|
||||
Q_PROPERTY(QString alignContent MEMBER _yAlignContent WRITE setYAlignContent)
|
||||
Q_PROPERTY(QString alignSelf MEMBER _yAlignSelf WRITE setYAlignSelf)
|
||||
Q_PROPERTY(QString justifyContent MEMBER _yJustifyContent WRITE setYJustifyContent)
|
||||
Q_PROPERTY(QString direction MEMBER _yDirection WRITE setYDirection)
|
||||
Q_PROPERTY(QString flexDirection MEMBER _yFlexDirection WRITE setYFlexDirection)
|
||||
Q_PROPERTY(QString overflow MEMBER _yOverflow WRITE setYOverflow)
|
||||
Q_PROPERTY(QString position MEMBER _yPosition WRITE setYPosition)
|
||||
Q_PROPERTY(QString flexWrap MEMBER _yFlexWrap WRITE setYFlexWrap)
|
||||
Q_PROPERTY(float flex MEMBER _yFlex WRITE setYFlex)
|
||||
Q_PROPERTY(float flexGrow MEMBER _yFlexGrow WRITE setYFlexGrow)
|
||||
Q_PROPERTY(float flexShrink MEMBER _yFlexShrink WRITE setYFlexShrink)
|
||||
Q_PROPERTY(float aspectRatio MEMBER _yAspectRatio WRITE setYAspectRatio)
|
||||
Q_PROPERTY(QString top MEMBER _yTop WRITE setYNodeTop)
|
||||
Q_PROPERTY(QString right MEMBER _yRight WRITE setYNodeRight)
|
||||
Q_PROPERTY(QString bottom MEMBER _yBottom WRITE setYNodeBottom)
|
||||
Q_PROPERTY(QString left MEMBER _yLeft WRITE setYNodeLeft)
|
||||
Q_PROPERTY(QString flexBasis MEMBER _yFlexBasis WRITE setYFlexBasis)
|
||||
Q_PROPERTY(QString minWidth MEMBER _yMinWidth WRITE setYMinWidth)
|
||||
Q_PROPERTY(QString minHeight MEMBER _yMinHeight WRITE setYMinHeight)
|
||||
Q_PROPERTY(QString maxWidth MEMBER _yMaxWidth WRITE setYMaxWidth)
|
||||
Q_PROPERTY(QString maxHeight MEMBER _yMaxHeight WRITE setYMaxHeight)
|
||||
Q_PROPERTY(QString paddingTop MEMBER _yPaddingTop WRITE setYPaddingTop)
|
||||
Q_PROPERTY(QString paddingRight MEMBER _yPaddingRight WRITE setYPaddingRight)
|
||||
Q_PROPERTY(QString paddingBottom MEMBER _yPaddingBottom WRITE setYPaddingBottom)
|
||||
Q_PROPERTY(QString paddingLeft MEMBER _yPaddingLeft WRITE setYPaddingLeft)
|
||||
Q_PROPERTY(QString paddingHorizontal MEMBER _yPaddingHorizontal WRITE setYPaddingHorizontal)
|
||||
Q_PROPERTY(QString paddingVertical MEMBER _yPaddingVertical WRITE setYPaddingVertical)
|
||||
Q_PROPERTY(QString padding MEMBER _yPadding WRITE setYPadding)
|
||||
Q_PROPERTY(QString marginTop MEMBER _yMarginTop WRITE setYMarginTop)
|
||||
Q_PROPERTY(QString marginRight MEMBER _yMarginRight WRITE setYMarginRight)
|
||||
Q_PROPERTY(QString marginBottom MEMBER _yMarginBottom WRITE setYMarginBottom)
|
||||
Q_PROPERTY(QString marginLeft MEMBER _yMarginLeft WRITE setYMarginLeft)
|
||||
Q_PROPERTY(QString marginHorizontal MEMBER _yMarginHorizontal WRITE setYMarginHorizontal)
|
||||
Q_PROPERTY(QString marginVertical MEMBER _yMarginVertical WRITE setYMarginVertical)
|
||||
Q_PROPERTY(QString margin MEMBER _yMargin WRITE setYMarginAll)
|
||||
Q_PROPERTY(float borderTop MEMBER _yBorderTop WRITE setYBorderTop)
|
||||
Q_PROPERTY(float borderRight MEMBER _yBorderRight WRITE setYBorderRight)
|
||||
Q_PROPERTY(float borderBottom MEMBER _yBorderBottom WRITE setYBorderBottom)
|
||||
Q_PROPERTY(float borderLeft MEMBER _yBorderLeft WRITE setYBorderLeft)
|
||||
Q_PROPERTY(float borderHorizontal MEMBER _yBorderHorizontal WRITE setYBorderHorizontal)
|
||||
Q_PROPERTY(float borderVertical MEMBER _yBorderVertical WRITE setYBorderVertical)
|
||||
Q_PROPERTY(float border MEMBER _yBorder WRITE setYBorder)
|
||||
|
||||
using QWidget::QWidget; //inherit all constructors of QWidget
|
||||
SET_YOGA_WIDGET_Q_PROPERTIES
|
||||
Q_OBJECT
|
||||
};
|
||||
|
||||
|
||||
@ -8,8 +8,55 @@ class NLabel: public QLabel, public YogaWidget
|
||||
{
|
||||
|
||||
public:
|
||||
SET_YOGA_WIDGET_Q_PROPERTIES
|
||||
// SET_YOGA_WIDGET_Q_PROPERTIES
|
||||
|
||||
Q_PROPERTY(QString display MEMBER _yDisplay WRITE setYDisplay)
|
||||
Q_PROPERTY(QString alignItems MEMBER _yAlignItems WRITE setYAlignItems)
|
||||
Q_PROPERTY(QString alignContent MEMBER _yAlignContent WRITE setYAlignContent)
|
||||
Q_PROPERTY(QString alignSelf MEMBER _yAlignSelf WRITE setYAlignSelf)
|
||||
Q_PROPERTY(QString justifyContent MEMBER _yJustifyContent WRITE setYJustifyContent)
|
||||
Q_PROPERTY(QString direction MEMBER _yDirection WRITE setYDirection)
|
||||
Q_PROPERTY(QString flexDirection MEMBER _yFlexDirection WRITE setYFlexDirection)
|
||||
Q_PROPERTY(QString overflow MEMBER _yOverflow WRITE setYOverflow)
|
||||
Q_PROPERTY(QString position MEMBER _yPosition WRITE setYPosition)
|
||||
Q_PROPERTY(QString flexWrap MEMBER _yFlexWrap WRITE setYFlexWrap)
|
||||
Q_PROPERTY(float flex MEMBER _yFlex WRITE setYFlex)
|
||||
Q_PROPERTY(float flexGrow MEMBER _yFlexGrow WRITE setYFlexGrow)
|
||||
Q_PROPERTY(float flexShrink MEMBER _yFlexShrink WRITE setYFlexShrink)
|
||||
Q_PROPERTY(float aspectRatio MEMBER _yAspectRatio WRITE setYAspectRatio)
|
||||
Q_PROPERTY(QString top MEMBER _yTop WRITE setYNodeTop)
|
||||
Q_PROPERTY(QString right MEMBER _yRight WRITE setYNodeRight)
|
||||
Q_PROPERTY(QString bottom MEMBER _yBottom WRITE setYNodeBottom)
|
||||
Q_PROPERTY(QString left MEMBER _yLeft WRITE setYNodeLeft)
|
||||
Q_PROPERTY(QString flexBasis MEMBER _yFlexBasis WRITE setYFlexBasis)
|
||||
Q_PROPERTY(QString minWidth MEMBER _yMinWidth WRITE setYMinWidth)
|
||||
Q_PROPERTY(QString minHeight MEMBER _yMinHeight WRITE setYMinHeight)
|
||||
Q_PROPERTY(QString maxWidth MEMBER _yMaxWidth WRITE setYMaxWidth)
|
||||
Q_PROPERTY(QString maxHeight MEMBER _yMaxHeight WRITE setYMaxHeight)
|
||||
Q_PROPERTY(QString paddingTop MEMBER _yPaddingTop WRITE setYPaddingTop)
|
||||
Q_PROPERTY(QString paddingRight MEMBER _yPaddingRight WRITE setYPaddingRight)
|
||||
Q_PROPERTY(QString paddingBottom MEMBER _yPaddingBottom WRITE setYPaddingBottom)
|
||||
Q_PROPERTY(QString paddingLeft MEMBER _yPaddingLeft WRITE setYPaddingLeft)
|
||||
Q_PROPERTY(QString paddingHorizontal MEMBER _yPaddingHorizontal WRITE setYPaddingHorizontal)
|
||||
Q_PROPERTY(QString paddingVertical MEMBER _yPaddingVertical WRITE setYPaddingVertical)
|
||||
Q_PROPERTY(QString padding MEMBER _yPadding WRITE setYPadding)
|
||||
Q_PROPERTY(QString marginTop MEMBER _yMarginTop WRITE setYMarginTop)
|
||||
Q_PROPERTY(QString marginRight MEMBER _yMarginRight WRITE setYMarginRight)
|
||||
Q_PROPERTY(QString marginBottom MEMBER _yMarginBottom WRITE setYMarginBottom)
|
||||
Q_PROPERTY(QString marginLeft MEMBER _yMarginLeft WRITE setYMarginLeft)
|
||||
Q_PROPERTY(QString marginHorizontal MEMBER _yMarginHorizontal WRITE setYMarginHorizontal)
|
||||
Q_PROPERTY(QString marginVertical MEMBER _yMarginVertical WRITE setYMarginVertical)
|
||||
Q_PROPERTY(QString margin MEMBER _yMargin WRITE setYMarginAll)
|
||||
Q_PROPERTY(float borderTop MEMBER _yBorderTop WRITE setYBorderTop)
|
||||
Q_PROPERTY(float borderRight MEMBER _yBorderRight WRITE setYBorderRight)
|
||||
Q_PROPERTY(float borderBottom MEMBER _yBorderBottom WRITE setYBorderBottom)
|
||||
Q_PROPERTY(float borderLeft MEMBER _yBorderLeft WRITE setYBorderLeft)
|
||||
Q_PROPERTY(float borderHorizontal MEMBER _yBorderHorizontal WRITE setYBorderHorizontal)
|
||||
Q_PROPERTY(float borderVertical MEMBER _yBorderVertical WRITE setYBorderVertical)
|
||||
Q_PROPERTY(float border MEMBER _yBorder WRITE setYBorder)
|
||||
|
||||
using QLabel::QLabel; //inherit all constructors of QLabel
|
||||
|
||||
Q_OBJECT
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user