Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-alignment-fix into lp:ubuntu-ui-toolkit

Proposed by Loïc Molinari
Status: Merged
Approved by: Florian Boucault
Approved revision: 599
Merged at revision: 613
Proposed branch: lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-alignment-fix
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 66 lines (+22/-7)
2 files modified
modules/Ubuntu/Components/plugin/shapeitem.cpp (+20/-5)
modules/Ubuntu/Components/plugin/shapeitem.h (+2/-2)
To merge this branch: bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-alignment-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu SDK team Pending
Review via email: mp+173774@code.launchpad.net

Commit message

[UbuntuShape] Fixed alignment support.

Description of the change

[UbuntuShape] Fixed alignment support.

To post a comment you must log in.
599. By Loïc Molinari

Fixed typo.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/plugin/shapeitem.cpp'
2--- modules/Ubuntu/Components/plugin/shapeitem.cpp 2013-07-09 15:21:04 +0000
3+++ modules/Ubuntu/Components/plugin/shapeitem.cpp 2013-07-09 17:07:27 +0000
4@@ -231,6 +231,8 @@
5
6 void ShapeItem::updateFromImageProperties(QQuickItem* image)
7 {
8+ int alignment;
9+
10 // ShapeItem::stretched depends on image::fillMode
11 QQuickImage::FillMode fillMode = (QQuickImage::FillMode)image->property("fillMode").toInt();
12 if (fillMode == QQuickImage::PreserveAspectCrop) {
13@@ -240,12 +242,26 @@
14 }
15
16 // ShapeItem::horizontalAlignment depends on image::horizontalAlignment
17- QQuickImage::HAlignment horizontalAlignment = (QQuickImage::HAlignment)image->property("horizontalAlignment").toInt();
18- setHorizontalAlignment((ShapeItem::HAlignment)horizontalAlignment);
19+ int imageHorizontalAlignment = image->property("horizontalAlignment").toInt();
20+ if (imageHorizontalAlignment == Qt::AlignLeft) {
21+ alignment = ShapeItem::AlignLeft;
22+ } else if (imageHorizontalAlignment == Qt::AlignRight) {
23+ alignment = ShapeItem::AlignRight;
24+ } else {
25+ alignment = ShapeItem::AlignHCenter;
26+ }
27+ setHorizontalAlignment(static_cast<ShapeItem::HAlignment>(alignment));
28
29 // ShapeItem::verticalAlignment depends on image::verticalAlignment
30- QQuickImage::VAlignment verticalAlignment = (QQuickImage::VAlignment)image->property("verticalAlignment").toInt();
31- setVerticalAlignment((ShapeItem::VAlignment)verticalAlignment);
32+ int imageVerticalAlignment = image->property("verticalAlignment").toInt();
33+ if (imageVerticalAlignment == Qt::AlignTop) {
34+ alignment = ShapeItem::AlignTop;
35+ } else if (imageVerticalAlignment == Qt::AlignBottom) {
36+ alignment = ShapeItem::AlignBottom;
37+ } else {
38+ alignment = ShapeItem::AlignVCenter;
39+ }
40+ setVerticalAlignment(static_cast<ShapeItem::VAlignment>(alignment));
41 }
42
43 void ShapeItem::connectToPropertyChange(QObject* sender, const char* property,
44@@ -274,7 +290,6 @@
45 updateFromImageProperties(image);
46 }
47
48-
49 void ShapeItem::setStretched(bool stretched)
50 {
51 if (stretched_ != stretched) {
52
53=== modified file 'modules/Ubuntu/Components/plugin/shapeitem.h'
54--- modules/Ubuntu/Components/plugin/shapeitem.h 2013-07-01 12:54:42 +0000
55+++ modules/Ubuntu/Components/plugin/shapeitem.h 2013-07-09 17:07:27 +0000
56@@ -47,8 +47,8 @@
57
58 enum Radius { SmallRadius, MediumRadius };
59 enum Border { RawBorder, IdleBorder, PressedBorder };
60- enum HAlignment { AlignLeft = Qt::AlignLeft, AlignHCenter = Qt::AlignHCenter, AlignRight = Qt::AlignRight };
61- enum VAlignment { AlignTop = Qt::AlignTop, AlignVCenter = Qt::AlignVCenter, AlignBottom = Qt::AlignBottom };
62+ enum HAlignment { AlignLeft = 0, AlignHCenter = 1, AlignRight = 2 };
63+ enum VAlignment { AlignTop = 0, AlignVCenter = 1, AlignBottom = 2 };
64
65 QColor color() const { return color_; }
66 void setColor(const QColor& color);

Subscribers

People subscribed via source and target branches

to status/vote changes: