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"; name = "LayoutDemo.js";
break; break;
case 3: case 3:
name = "SimpleDemo.js"; name = "ModalDemo.js";
break; break;
case 4: case 4:
name = "SimpleDemo.js";
break;
case 5:
name = "Snake.js"; name = "Snake.js";
break; break;
} }

View File

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

View File

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

View File

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