diff --git a/declarativeimports/plasmacomponents/fullscreenwindow.cpp b/declarativeimports/plasmacomponents/fullscreenwindow.cpp index 576840b38..caef8acde 100644 --- a/declarativeimports/plasmacomponents/fullscreenwindow.cpp +++ b/declarativeimports/plasmacomponents/fullscreenwindow.cpp @@ -189,10 +189,10 @@ void FullScreenWindow::setMainItem(QGraphicsObject *mainItem) mainItem->setParentItem(0); mainItem->setParent(this); m_scene = mainItem->scene(); + m_view->resize(mainItem->boundingRect().size().toSize()); + mainItem->installEventFilter(this); } - mainItem->installEventFilter(this); - //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene QTimer::singleShot(0, this, SLOT(syncViewToMainItem())); } @@ -243,9 +243,12 @@ void FullScreenWindow::syncViewToMainItem() m_view->setScene(scene); + QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), + QSizeF(m_mainItem.data()->boundingRect().size())); if (m_declarativeItemContainer) { - m_view->resize(m_declarativeItemContainer->size().toSize()); + m_view->resize(itemGeometry.size().toSize()); m_view->setSceneRect(m_declarativeItemContainer->geometry()); + } else { QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), QSizeF(m_mainItem.data()->boundingRect().size())); diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml index c229538f9..b8a3b035d 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml @@ -48,8 +48,8 @@ import "." 0.1 Item { id: root - width: Math.max(buttonItem.childrenRect.width + dialog.margins.left + dialog.margins.right + theme.defaultFont.mSize.width * 4, theme.defaultFont.mSize.width * 45) - height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8 + dialog.margins.top + dialog.margins.bottom + width: 600 + height: 400 property alias title: titleBar.children property alias content: contentItem.children @@ -136,7 +136,7 @@ Item { Item { id: titleBar - height: childrenRect.height + height: Math.max(theme.defaultFont.mSize.height * 1.5, childrenRect.height) anchors { top: parent.top left: parent.left @@ -148,11 +148,14 @@ Item { id: contentItem clip: true - onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width) + dialog.margins.left + dialog.margins.right + onChildrenRectChanged: { + root.width = Math.max(childrenRect.width, buttonItem.childrenRect.width) + dialog.margins.left + dialog.margins.right + root.height = childrenRect.height + titleBar.height + buttonItem.height + dialog.margins.top + dialog.margins.bottom + } + width: childrenRect.width > 0 ? Math.min(childrenRect.width, parent.width) : parent.width anchors { top: titleBar.bottom - left: parent.left - right: parent.right + horizontalCenter: parent.horizontalCenter bottom: buttonItem.top } }