~bfiller/messaging-app/header-on-splash

« back to all changes in this revision

Viewing changes to src/qml/MultiRecipientInput.qml

Fix auto-scrolling on the MultiRecipientInput widget. Fixes: 1356811, 1369519
Approved by: Bill Filler

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        id: scrollableArea
83
83
        anchors.fill: parent
84
84
        contentWidth: contactFlow.width
 
85
        // force content to scroll as the user types the number
 
86
        onContentWidthChanged: {
 
87
            if (scrollableArea.contentWidth > multiRecipientWidget.width) {
 
88
                scrollableArea.contentX = scrollableArea.contentWidth - multiRecipientWidget.width
 
89
            }
 
90
        }
85
91
        flickableDirection: Flickable.HorizontalFlick
86
92
        Flow {
87
93
            id: contactFlow
134
140
                id: searchDelegate
135
141
                TextField {
136
142
                    id: contactSearchInput
 
143
                    // the following items are used to calculate the text size of the hint and text entry
 
144
                    Label {
 
145
                        id: hintLabel 
 
146
                        visible: false
 
147
                        text: i18n.tr("To:")
 
148
                    }
 
149
                    Label {
 
150
                        id: textLabel
 
151
                        visible: false
 
152
                        text: contactSearchInput.text
 
153
                    }
 
154
 
137
155
                    objectName: "contactSearchInput"
138
156
                    focus: true
139
157
                    style: MultiRecipientFieldStyle {}
140
158
                    height: units.gu(4)
141
 
                    // FIXME: this size should be variable
142
 
                    width: units.gu(20)
 
159
                    width: text != "" ? textLabel.paintedWidth + units.gu(3) : hintLabel.paintedWidth + units.gu(3)
143
160
                    hasClearButton: false
144
161
                    clip: false
145
 
                    placeholderText: multiRecipientWidget.recipientCount  <= 0 ? i18n.tr("To:") :""
 
162
                    placeholderText: multiRecipientWidget.recipientCount <= 0 ? hintLabel.text : ""
146
163
                    font.family: "Ubuntu"
147
164
                    font.weight: Font.Light
148
165
                    color: "#752571"