mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
fix notif coordinates
This commit is contained in:
parent
640eaefade
commit
f40797af3b
2 changed files with 25 additions and 15 deletions
|
|
@ -169,19 +169,28 @@ bool Notifier::createNotification(Notifier::NotificationType type, QVariantMap d
|
|||
window->setProperty(NotificationPropertyData, data);
|
||||
// for (auto it = data.begin(); it != data.end(); ++it)
|
||||
// window->setProperty(it.key().toLatin1(), it.value());
|
||||
int *screenHeightOffset = &mScreenHeightOffset[screen->name()]; // Access optimization
|
||||
QRect availableGeometry = screen->availableGeometry();
|
||||
int heightOffset =
|
||||
availableGeometry.y() +
|
||||
(availableGeometry.height() -
|
||||
window->height()); //*screen->devicePixelRatio(); when using manual scaler
|
||||
|
||||
window->setX(availableGeometry.x() +
|
||||
(availableGeometry.width() -
|
||||
window->property("width")
|
||||
.toInt())); //*screen->devicePixelRatio()); when using manual scaler
|
||||
window->setY(heightOffset - (*screenHeightOffset % heightOffset));
|
||||
const int timeout = Notifications[type].getTimeout() * 1000;
|
||||
auto updateNotificationCoordinates = [this, window, screen](int width, int height) {
|
||||
int *screenHeightOffset = &mScreenHeightOffset[screen->name()]; // Access optimization
|
||||
QRect availableGeometry = screen->availableGeometry();
|
||||
int heightOffset = availableGeometry.y() +
|
||||
(availableGeometry.height() -
|
||||
height); //*screen->devicePixelRatio(); when using manual scaler
|
||||
|
||||
window->setX(availableGeometry.x() +
|
||||
(availableGeometry.width() -
|
||||
width)); //*screen->devicePixelRatio()); when using manual scaler
|
||||
window->setY(heightOffset - (*screenHeightOffset % heightOffset));
|
||||
};
|
||||
QObject::connect(window, &QQuickWindow::widthChanged,
|
||||
[window, updateNotificationCoordinates](int w) {
|
||||
updateNotificationCoordinates(w, window->height());
|
||||
});
|
||||
QObject::connect(window, &QQuickWindow::heightChanged,
|
||||
[window, updateNotificationCoordinates](int h) {
|
||||
updateNotificationCoordinates(window->width(), h);
|
||||
});
|
||||
updateNotificationCoordinates(window->width(), window->height());
|
||||
QObject::connect(window, &QQuickWindow::closing, window,
|
||||
[this, window] { deleteNotification(QVariant::fromValue(window)); });
|
||||
showNotification(window, timeout);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ import UtilsCpp
|
|||
Notification {
|
||||
id: mainItem
|
||||
radius: 20 * DefaultStyle.dp
|
||||
overriddenWidth: content.width//101 * DefaultStyle.dp
|
||||
overriddenHeight: content.height//422 * DefaultStyle.dp
|
||||
overriddenWidth: 450 * DefaultStyle.dp//content.width//101 * DefaultStyle.dp
|
||||
overriddenHeight: 101 * DefaultStyle.dp//content.height//
|
||||
|
||||
readonly property var call: notificationData && notificationData.call
|
||||
property var state: call.core.state
|
||||
|
|
@ -33,7 +33,7 @@ Notification {
|
|||
contentItem: RowLayout {
|
||||
id: notifContent
|
||||
|
||||
spacing: 30 * DefaultStyle.dp
|
||||
spacing: 15 * DefaultStyle.dp
|
||||
height: childrenRect.height
|
||||
width: childrenRect.width
|
||||
RowLayout {
|
||||
|
|
@ -51,6 +51,7 @@ Notification {
|
|||
Text {
|
||||
text: call.core.remoteName
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: 200 * DefaultStyle.dp
|
||||
maximumLineCount: 1
|
||||
color: DefaultStyle.grey_600
|
||||
font {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue