on xenial help sign in
Review suggestions
commit3c64a91766a866e2dcc5cca38c810dadc5d83e1f authorAndrea Cimitan <andrea.cimitan@gmail.com> dateMon 19 Oct 2015, 13:00 (11 years ago) parent18e9de0
6 files changed+16−16
qml/Components/LazyImage.qml+4−12 qml/Dash/Previews/Preview.qml+2−2 qml/Dash/Previews/PreviewVideoPlayback.qml+2−1 qml/Dash/Previews/PreviewWidget.qml+3 qml/Dash/Previews/PreviewWidgetFactory.qml+3 qml/Dash/Previews/PreviewZoomableImage.qml+2−1
qml/Components/LazyImage.qml+4−12
@@ -85,16 +85,13 @@ Item {
8585 height: root.initialHeight
8686 width: root.initialWidth
8787 anchors.centerIn: root.scaleTo == "fit" ? parent : undefined
88−
88+ active: useUbuntuShape
8989 opacity: 0
9090 visible: opacity != 0
91−
92− sourceComponent: useUbuntuShape ? ubuntuShapeComponent : itemComponent
91+ sourceComponent: UbuntuShape {}
9392 onLoaded: {
94− if (sourceComponent === ubuntuShapeComponent) {
95− item.image = image;
96− item.borderSource = Qt.binding(function() { return root.borderSource })
97− }
93+ item.image = image;
94+ item.borderSource = Qt.binding(function() { return root.borderSource })
9895 }
9996
10097 Image {
@@ -120,11 +117,6 @@ Item {
120117 }
121118 }
122119
123− Component {
124− id: itemComponent
125− Item {}
126− }
127−
128120 Component {
129121 id: ubuntuShapeComponent
130122 UbuntuShape {}
qml/Dash/Previews/Preview.qml+2−2
@@ -100,8 +100,8 @@ Item {
100100 anchors {
101101 left: parent.left
102102 right: parent.right
103− leftMargin: units.gu(1)
104− rightMargin: units.gu(1)
103+ leftMargin: widgetMargins
104+ rightMargin: widgetMargins
105105 }
106106
107107 onTriggered: {
qml/Dash/Previews/PreviewVideoPlayback.qml+2−1
@@ -30,12 +30,13 @@ PreviewWidget {
3030 implicitWidth: units.gu(35)
3131 implicitHeight: childrenRect.height
3232
33+ widgetMargins: -units.gu(1)
34+
3335 LazyImage {
3436 objectName: "screenshot"
3537 anchors {
3638 left: parent.left
3739 right: parent.right
38− margins: -units.gu(2) // to counterbalance the margins of each Preview and have them touch the edges
3940 }
4041 scaleTo: "width"
4142 source: {
qml/Dash/Previews/PreviewWidget.qml+3
@@ -34,6 +34,9 @@ Item {
3434 //! Should the widget show in expanded mode (For those that support it)
3535 property bool expanded: true
3636
37+ //! Set margins width.
38+ property real widgetMargins: units.gu(1)
39+
3740 /*! \brief This signal should be emitted when a preview action was triggered.
3841 *
3942 * \param widgetId, actionId Respective identifiers from widgetData.
qml/Dash/Previews/PreviewWidgetFactory.qml+3
@@ -40,6 +40,9 @@ Loader {
4040 //! Set to true if the parent preview is displayed.
4141 property bool isCurrentPreview: false
4242
43+ //! Set margins width.
44+ property real widgetMargins: status === Loader.Ready ? item.widgetMargins : units.gu(1)
45+
4346 //! Triggered signal forwarded from the widgets.
4447 signal triggered(string widgetId, string actionId, var data)
4548
qml/Dash/Previews/PreviewZoomableImage.qml+2−1
@@ -30,6 +30,8 @@ PreviewWidget {
3030 implicitWidth: units.gu(35)
3131 implicitHeight: lazyImage.height
3232
33+ widgetMargins: -units.gu(1)
34+
3335 property Item rootItem: QuickUtils.rootItem(root)
3436
3537 LazyImage {
@@ -38,7 +40,6 @@ PreviewWidget {
3840 anchors {
3941 left: parent.left
4042 right: parent.right
41− margins: -units.gu(2) // to counterbalance the margins of each Preview and have them touch the edges
4243 }
4344 scaleTo: "width"
4445 source: widgetData["source"]