Changeset View
Changeset View
Standalone View
Standalone View
src/declarativeimports/plasmacomponents3/ComboBox.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.6 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Window 2.2 | 21 | import QtQuick.Window 2.2 | ||
22 | import QtQuick.Templates @QQC2_VERSION@ as T | 22 | import QtQuick.Templates @QQC2_VERSION@ as T | ||
23 | import QtQuick.Controls @QQC2_VERSION@ as Controls | 23 | import QtQuick.Controls @QQC2_VERSION@ as Controls | ||
24 | import QtGraphicalEffects 1.0 | 24 | import QtGraphicalEffects 1.0 | ||
25 | import org.kde.plasma.core 2.0 as PlasmaCore | 25 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
26 | import org.kde.kirigami 2.5 as Kirigami | 26 | import org.kde.kirigami 2.5 as Kirigami | ||
27 | import "private" as Private | 27 | import "private" as Private | ||
28 | import "mobiletextselection" as MobileTextSelection | ||||
28 | 29 | | |||
29 | T.ComboBox { | 30 | T.ComboBox { | ||
30 | id: control | 31 | id: control | ||
31 | 32 | | |||
32 | implicitWidth: Math.max(background ? background.implicitWidth : 0, | 33 | implicitWidth: Math.max(background ? background.implicitWidth : 0, | ||
33 | contentItem.implicitWidth + leftPadding + rightPadding) + indicator.implicitWidth + rightPadding | 34 | contentItem.implicitWidth + leftPadding + rightPadding) + indicator.implicitWidth + rightPadding | ||
34 | implicitHeight: units.gridUnit * 1.6 | 35 | implicitHeight: units.gridUnit * 1.6 | ||
35 | baselineOffset: contentItem.y + contentItem.baselineOffset | 36 | baselineOffset: contentItem.y + contentItem.baselineOffset | ||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 123 | T.TextField { | |||
149 | cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined | 150 | cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined | ||
150 | 151 | | |||
151 | font: control.font | 152 | font: control.font | ||
152 | horizontalAlignment: Text.AlignLeft | 153 | horizontalAlignment: Text.AlignLeft | ||
153 | verticalAlignment: Text.AlignVCenter | 154 | verticalAlignment: Text.AlignVCenter | ||
154 | opacity: control.enabled ? 1 : 0.3 | 155 | opacity: control.enabled ? 1 : 0.3 | ||
155 | onFocusChanged: { | 156 | onFocusChanged: { | ||
156 | if (focus) { | 157 | if (focus) { | ||
157 | Private.MobileTextActionsToolBar.controlRoot = textField; | 158 | MobileTextSelection.MobileTextActionsToolBar.controlRoot = textField; | ||
158 | } | 159 | } | ||
159 | } | 160 | } | ||
160 | 161 | | |||
161 | onPressAndHold: { | 162 | onPressAndHold: { | ||
162 | if (!Kirigami.Settings.tabletMode) { | 163 | if (!Kirigami.Settings.tabletMode) { | ||
163 | return; | 164 | return; | ||
164 | } | 165 | } | ||
165 | forceActiveFocus(); | 166 | forceActiveFocus(); | ||
166 | cursorPosition = positionAt(event.x, event.y); | 167 | cursorPosition = positionAt(event.x, event.y); | ||
167 | selectWord(); | 168 | selectWord(); | ||
168 | } | 169 | } | ||
169 | } | 170 | } | ||
170 | } | 171 | } | ||
171 | 172 | | |||
172 | Component { | 173 | Component { | ||
173 | id: mobileCursor | 174 | id: mobileCursor | ||
174 | Private.MobileCursor { | 175 | Private.MobileCursor { | ||
broulik: Does this not need to be adjusted? `ComboBox` is broken here. | |||||
175 | target: textField | 176 | target: textField | ||
176 | } | 177 | } | ||
177 | } | 178 | } | ||
178 | 179 | | |||
179 | Private.MobileCursor { | 180 | MobileTextSelection.MobileCursor { | ||
180 | target: textField | 181 | target: textField | ||
181 | selectionStartHandle: true | 182 | selectionStartHandle: true | ||
182 | property var rect: textField.positionToRectangle(textField.selectionStart) | 183 | property var rect: textField.positionToRectangle(textField.selectionStart) | ||
183 | //FIXME: this magic values seem to be always valid, for every font,every dpi, every scaling | 184 | //FIXME: this magic values seem to be always valid, for every font,every dpi, every scaling | ||
184 | x: rect.x + 5 | 185 | x: rect.x + 5 | ||
185 | y: rect.y + 6 | 186 | y: rect.y + 6 | ||
186 | } | 187 | } | ||
187 | 188 | | |||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |
Does this not need to be adjusted? ComboBox is broken here.