~mzanetti/unity8/fix-1648251

« back to all changes in this revision

Viewing changes to qml/Dash/Previews/PreviewActionCombo.qml

  • Committer: Michael Zanetti
  • Date: 2016-12-01 12:20:34 UTC
  • mfrom: (2525.1.179 unity8)
  • Revision ID: michael.zanetti@canonical.com-20161201122034-cpvbf7webbhg2wph
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    id: root
22
22
 
23
23
    implicitHeight: childrenRect.height
 
24
    implicitWidth: Math.max(moreButton.implicitWidth, column.maxButtonImplicitWidth)
24
25
 
25
26
    signal triggeredAction(var actionData)
26
27
 
39
40
    }
40
41
 
41
42
    Column {
 
43
        id: column
42
44
        anchors {
43
45
            top: moreButton.bottom
44
46
            topMargin: height > 0 ? spacing : 0
45
47
        }
46
48
        objectName: "buttonColumn"
47
49
        spacing: units.gu(1)
48
 
        width: parent.width
49
50
        height: moreButton.expanded ? implicitHeight : 0
 
51
 
 
52
        property real maxButtonImplicitWidth: 0
 
53
        function calculateImplicitWidth() {
 
54
            maxButtonImplicitWidth = 0;
 
55
            for (var i in children) {
 
56
                maxButtonImplicitWidth = Math.max(maxButtonImplicitWidth, children[i].implicitWidth);
 
57
            }
 
58
        }
 
59
 
50
60
        clip: true
51
61
        Behavior on height {
52
62
            UbuntuNumberAnimation {
59
69
 
60
70
            delegate: PreviewActionButton {
61
71
                data: modelData
62
 
                width: implicitWidth < root.width ? root.width : implicitWidth
 
72
                width: root.width
 
73
                onImplicitWidthChanged: column.calculateImplicitWidth();
63
74
                onClicked: root.triggeredAction(modelData)
64
75
                strokeColor: moreButton.strokeColor
65
76
            }