add modal demo

This commit is contained in:
王劲鹏 2021-04-21 11:08:49 +08:00 committed by osborn
parent 7202bbfe67
commit e735beba1e
4 changed files with 13 additions and 5 deletions

View File

@ -22,9 +22,12 @@ void DoricDemoBridge::navigate(QVariant route) {
name = "LayoutDemo.js";
break;
case 3:
name = "SimpleDemo.js";
name = "ModalDemo.js";
break;
case 4:
name = "SimpleDemo.js";
break;
case 5:
name = "Snake.js";
break;
}

View File

@ -11,6 +11,7 @@
<file alias="Counter.js">../../doric-demo/bundle/src/Counter.js</file>
<file alias="Gobang.js">../../doric-demo/bundle/src/Gobang.js</file>
<file alias="LayoutDemo.js">../../doric-demo/bundle/src/LayoutDemo.js</file>
<file alias="ModalDemo.js">../../doric-demo/bundle/src/ModalDemo.js</file>
<file alias="SimpleDemo.js">../../doric-demo/bundle/src/SimpleDemo.js</file>
<file alias="Snake.js">../../doric-demo/bundle/src/Snake.js</file>
</qresource>

View File

@ -15,7 +15,7 @@ ApplicationWindow {
ListView {
width: parent.width
model: 5
model: 6
delegate: Rectangle {
Column {
anchors.centerIn: parent
@ -29,8 +29,10 @@ ApplicationWindow {
case 2:
return "LayoutDemo.js"
case 3:
return "SimpleDemo.js"
return "ModalDemo.js"
case 4:
return "SimpleDemo.js"
case 5:
return "Snake.js"
}
}

View File

@ -134,7 +134,8 @@ void DoricLayouts::measureSelf(QSizeF targetSize) {
QQuickItem *parent = this->view->parentItem();
DoricLayouts *parentDoricLayout =
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
if (parentDoricLayout->layoutType == DoricLayoutType::DoricHLayout &&
if (parentDoricLayout != nullptr &&
parentDoricLayout->layoutType == DoricLayoutType::DoricHLayout &&
this->weight > 0) {
width = 0;
setMeasuredWidth(0);
@ -155,7 +156,8 @@ void DoricLayouts::measureSelf(QSizeF targetSize) {
QQuickItem *parent = this->view->parentItem();
DoricLayouts *parentDoricLayout =
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
if (parentDoricLayout->layoutType == DoricLayoutType::DoricVLayout &&
if (parentDoricLayout != nullptr &&
parentDoricLayout->layoutType == DoricLayoutType::DoricVLayout &&
this->weight > 0) {
height = 0;
setMeasuredHeight(0);