remove 88 minus; set text order changed
This commit is contained in:
parent
398fef351c
commit
c087f06647
@ -29,8 +29,6 @@ void DoricModalPlugin::toast(QString jsValueString, QString callbackId) {
|
|||||||
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
QQuickItem *item = qobject_cast<QQuickItem *>(component.create());
|
||||||
item->setParentItem(rootObject);
|
item->setParentItem(rootObject);
|
||||||
|
|
||||||
item->childItems().at(0)->childItems().at(0)->setProperty("text", msg);
|
|
||||||
|
|
||||||
// init set y
|
// init set y
|
||||||
if ((gravity & DoricGravity::DoricGravityBottom) ==
|
if ((gravity & DoricGravity::DoricGravityBottom) ==
|
||||||
DoricGravity::DoricGravityBottom) {
|
DoricGravity::DoricGravityBottom) {
|
||||||
@ -39,8 +37,7 @@ void DoricModalPlugin::toast(QString jsValueString, QString callbackId) {
|
|||||||
DoricGravity::DoricGravityTop) {
|
DoricGravity::DoricGravityTop) {
|
||||||
item->setProperty("y", 20);
|
item->setProperty("y", 20);
|
||||||
} else {
|
} else {
|
||||||
item->setProperty("y",
|
item->setProperty("y", (rootObject->height() - item->height()) / 2);
|
||||||
(rootObject->height() - item->height() - 88) / 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update x
|
// update x
|
||||||
@ -49,20 +46,22 @@ void DoricModalPlugin::toast(QString jsValueString, QString callbackId) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// update y
|
// update y
|
||||||
connect(item, &QQuickItem::heightChanged,
|
connect(
|
||||||
[rootObject, item, gravity]() {
|
item, &QQuickItem::heightChanged, [rootObject, item, gravity]() {
|
||||||
if ((gravity & DoricGravity::DoricGravityBottom) ==
|
if ((gravity & DoricGravity::DoricGravityBottom) ==
|
||||||
DoricGravity::DoricGravityBottom) {
|
DoricGravity::DoricGravityBottom) {
|
||||||
item->setProperty("y", rootObject->height() -
|
item->setProperty("y",
|
||||||
item->height() - 20);
|
rootObject->height() - item->height() - 20);
|
||||||
} else if ((gravity & DoricGravity::DoricGravityTop) ==
|
} else if ((gravity & DoricGravity::DoricGravityTop) ==
|
||||||
DoricGravity::DoricGravityTop) {
|
DoricGravity::DoricGravityTop) {
|
||||||
item->setProperty("y", 20);
|
item->setProperty("y", 20);
|
||||||
} else {
|
} else {
|
||||||
item->setProperty(
|
item->setProperty("y",
|
||||||
"y", (rootObject->height() - item->height() - 88) / 2);
|
(rootObject->height() - item->height()) / 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
item->childItems().at(0)->childItems().at(0)->setProperty("text", msg);
|
||||||
|
|
||||||
QTimer::singleShot(2000, qApp, [item]() {
|
QTimer::singleShot(2000, qApp, [item]() {
|
||||||
item->setParent(nullptr);
|
item->setParent(nullptr);
|
||||||
|
Reference in New Issue
Block a user