on xenial help sign in
merge
7b1ff45Michael Zanetti
tests/mocks/Unity/Application/MirSurfaceItem.cpp+5−9
@@ -190,16 +190,12 @@ void MirSurfaceItem::createQmlContentItem()
190 m_qmlItem->setParentItem(this);
190 m_qmlItem->setParentItem(this);
191
191
192 if (m_fillMode == FillMode::Stretch && width() != 0 && height() != 0) {
192 if (m_fillMode == FillMode::Stretch && width() != 0 && height() != 0) {
193− m_qmlItem->setWidth(width());
193+ m_qmlItem->setSize(QSize(this->width(), this->height()));
194− m_qmlItem->setHeight(height());
195 } else {
194 } else {
196− m_qmlItem->setWidth(m_surfaceWidth);
195+ m_qmlItem->setSize(m_qmlSurface->size());
197− m_qmlItem->setHeight(m_surfaceHeight);
198 }
196 }
199−
200− qDebug() << "set size to" << m_surfaceWidth;
201− setImplicitWidth(m_qmlItem->implicitWidth());
197+ setImplicitWidth(m_qmlItem->width());
202− setImplicitHeight(m_qmlItem->implicitHeight());
198+ setImplicitHeight(m_qmlItem->height());
203
199
204 {
200 {
205 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
201 QQmlProperty screenshotSource(m_qmlItem, "screenshotSource");
@@ -315,12 +311,12 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
315 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
311 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
316 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
312 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
317 connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
313 connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
314+ setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
318 if (m_fillMode == FillMode::Stretch) {
315 if (m_fillMode == FillMode::Stretch) {
319 m_qmlItem->setSize(QSize(this->width(), this->height()));
316 m_qmlItem->setSize(QSize(this->width(), this->height()));
320 } else {
317 } else {
321 m_qmlItem->setSize(m_qmlSurface->size());
318 m_qmlItem->setSize(m_qmlSurface->size());
322 }
319 }
323− setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
324 });
320 });
325 m_surfaceWidth = surface->size().width();
321 m_surfaceWidth = surface->size().width();
326 m_surfaceHeight = surface->size().height();
322 m_surfaceHeight = surface->size().height();
tests/mocks/Unity/Application/resources/MirSurfaceItem.qml−3
@@ -20,9 +20,6 @@ Rectangle {
20 id: root
20 id: root
21 color: "pink"
21 color: "pink"
22
22
23− implicitWidth: width
24− implicitHeight: height
25−
26 property alias screenshotSource: screenshotImage.source
23 property alias screenshotSource: screenshotImage.source
27 property int orientationAngle
24 property int orientationAngle
28
25