on xenial help sign in
MockMirSurfaceItem: Rotate whole thing, even if image looks weird
commitef8d8774731e3d8e4528bbf6a1ee02b6493afa92 authorGerry Boland <gerry.boland@canonical.com> dateWed 10 Sep 2014, 18:10 (12 years ago) parent8393c49
1 file changed+11−8
tests/mocks/Unity/Application/MirSurfaceItem.qml+11−8
tests/mocks/Unity/Application/MirSurfaceItem.qml+11−8
@@ -21,11 +21,20 @@ Rectangle {
2121 id: root
2222 color: "pink"
2323
24− anchors.fill: parent
25−
2624 implicitWidth: units.gu(40)
2725 implicitHeight: units.gu(70)
2826
27+ rotation: {
28+ if (orientation == Qt.PortraitOrientation) return 0;
29+ else if (orientation == Qt.LandscapeOrientation) return 90;
30+ else if (orientation == Qt.InvertedPortraitOrientation) return 180;
31+ else return 270;
32+ }
33+ x: parent ? (parent.width - width) / 2 : 0
34+ y: parent ? (parent.height - height) / 2 : 0
35+ width: parent ? (rotation == 0 || rotation == 180 ? parent.width : parent.height) : implicitWidth
36+ height: parent ? (rotation == 0 || rotation == 180 ? parent.height : parent.width) : implicitHeight
37+
2938 property alias screenshotSource: screenshotImage.source
3039 property int orientation: Qt.PortraitOrientation
3140
@@ -48,12 +57,6 @@ Rectangle {
4857 fontSizeMode: Text.Fit
4958 minimumPixelSize: 10; font.pixelSize: 200
5059 verticalAlignment: Text.AlignVCenter
51− rotation: {
52− if (orientation == Qt.PortraitOrientation) return 0;
53− else if (orientation == Qt.LandscapeOrientation) return 90;
54− else if (orientation == Qt.InvertedPortraitOrientation) return 180;
55− else return 270;
56− }
5760 }
5861
5962 MultiPointTouchArea {