Merge branch 'master' of https://invent.kde.org/frameworks/plasma-framework into work/plasmoidsCanIgnoreMargins
This commit is contained in:
commit
143a9418ce
@ -25,6 +25,7 @@ T.BusyIndicator {
|
|||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
id: baseItem
|
||||||
/* implicitWidth and implicitHeight won't work unless they come
|
/* implicitWidth and implicitHeight won't work unless they come
|
||||||
* from a child of the contentItem. No idea why.
|
* from a child of the contentItem. No idea why.
|
||||||
*/
|
*/
|
||||||
@ -61,7 +62,7 @@ T.BusyIndicator {
|
|||||||
to: 360
|
to: 360
|
||||||
duration: 2000
|
duration: 2000
|
||||||
loops: Animation.Infinite
|
loops: Animation.Infinite
|
||||||
running: visible
|
running: control.running || baseItem.opacity > 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ T.ComboBox {
|
|||||||
delegate: ItemDelegate {
|
delegate: ItemDelegate {
|
||||||
width: control.popup.width
|
width: control.popup.width
|
||||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
||||||
highlighted: mouseArea.pressed ? listView.currentIndex == index : control.highlightedIndex == index
|
highlighted: control.highlightedIndex == index
|
||||||
property bool separatorVisible: false
|
property bool separatorVisible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,113 +51,55 @@ T.ComboBox {
|
|||||||
elementId: "down-arrow"
|
elementId: "down-arrow"
|
||||||
}
|
}
|
||||||
|
|
||||||
// contentItem: Label {
|
contentItem: T.TextField {
|
||||||
// text: control.displayText
|
id: textField
|
||||||
// font: control.font
|
padding: 0
|
||||||
// color: theme.buttonTextColor
|
anchors {
|
||||||
// horizontalAlignment: Text.AlignLeft
|
fill:parent
|
||||||
// verticalAlignment: Text.AlignVCenter
|
leftMargin: control.leftPadding
|
||||||
// elide: Text.ElideRight
|
rightMargin: control.rightPadding
|
||||||
// }
|
topMargin: control.topPadding
|
||||||
contentItem: MouseArea {
|
bottomMargin: control.bottomPadding
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
preventStealing: true
|
|
||||||
property int indexUnderMouse: -1
|
|
||||||
onWheel: {
|
|
||||||
if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) {
|
|
||||||
control.currentIndex = Math.min(control.currentIndex + 1, delegateModel.count -1);
|
|
||||||
} else {
|
|
||||||
control.currentIndex = Math.max(control.currentIndex - 1, 0);
|
|
||||||
}
|
|
||||||
control.activated(control.currentIndex);
|
|
||||||
}
|
}
|
||||||
onPressed: {
|
text: control.editable ? control.editText : control.displayText
|
||||||
indexUnderMouse = -1;
|
|
||||||
listView.currentIndex = control.highlightedIndex
|
enabled: control.editable
|
||||||
control.down = true;
|
autoScroll: control.editable
|
||||||
control.pressed = true;
|
|
||||||
control.popup.visible = !control.popup.visible;
|
readOnly: control.down || !control.hasOwnProperty("editable") || !control.editable
|
||||||
}
|
inputMethodHints: control.inputMethodHints
|
||||||
onReleased: {
|
validator: control.validator
|
||||||
if (!containsMouse) {
|
|
||||||
control.down = false;
|
// Work around Qt bug where NativeRendering breaks for non-integer scale factors
|
||||||
control.pressed = false;
|
// https://bugreports.qt.io/browse/QTBUG-70481
|
||||||
control.popup.visible = false;
|
renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
|
||||||
}
|
color: PlasmaCore.ColorScope.textColor
|
||||||
if (indexUnderMouse > -1) {
|
selectionColor: Kirigami.Theme.highlightColor
|
||||||
control.currentIndex = indexUnderMouse;
|
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
||||||
|
|
||||||
|
selectByMouse: !Kirigami.Settings.tabletMode
|
||||||
|
cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined
|
||||||
|
|
||||||
|
font: control.font
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
opacity: control.enabled ? 1 : 0.3
|
||||||
|
onFocusChanged: {
|
||||||
|
if (focus) {
|
||||||
|
MobileTextSelection.MobileTextActionsToolBar.controlRoot = textField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCanceled: {
|
|
||||||
control.down = false;
|
|
||||||
control.pressed = false;
|
|
||||||
}
|
|
||||||
onPositionChanged: {
|
|
||||||
var pos = listView.mapFromItem(this, mouse.x, mouse.y);
|
|
||||||
indexUnderMouse = listView.indexAt(pos.x, pos.y);
|
|
||||||
listView.currentIndex = indexUnderMouse;
|
|
||||||
controlRoot.activated(indexUnderMouse);
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
||||||
target: popup
|
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
||||||
onClosed: {
|
|
||||||
control.down = false;
|
onPressAndHold: {
|
||||||
control.pressed = false;
|
if (!Kirigami.Settings.tabletMode) {
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
T.TextField {
|
|
||||||
id: textField
|
|
||||||
padding: 0
|
|
||||||
anchors {
|
|
||||||
fill:parent
|
|
||||||
leftMargin: control.leftPadding
|
|
||||||
rightMargin: control.rightPadding
|
|
||||||
topMargin: control.topPadding
|
|
||||||
bottomMargin: control.bottomPadding
|
|
||||||
}
|
|
||||||
text: control.editable ? control.editText : control.displayText
|
|
||||||
|
|
||||||
enabled: control.editable
|
|
||||||
autoScroll: control.editable
|
|
||||||
|
|
||||||
readOnly: control.down || !control.hasOwnProperty("editable") || !control.editable
|
|
||||||
inputMethodHints: control.inputMethodHints
|
|
||||||
validator: control.validator
|
|
||||||
|
|
||||||
// Work around Qt bug where NativeRendering breaks for non-integer scale factors
|
|
||||||
// https://bugreports.qt.io/browse/QTBUG-70481
|
|
||||||
renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
|
|
||||||
color: PlasmaCore.ColorScope.textColor
|
|
||||||
selectionColor: Kirigami.Theme.highlightColor
|
|
||||||
selectedTextColor: Kirigami.Theme.highlightedTextColor
|
|
||||||
|
|
||||||
selectByMouse: !Kirigami.Settings.tabletMode
|
|
||||||
cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined
|
|
||||||
|
|
||||||
font: control.font
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
opacity: control.enabled ? 1 : 0.3
|
|
||||||
onFocusChanged: {
|
|
||||||
if (focus) {
|
|
||||||
MobileTextSelection.MobileTextActionsToolBar.controlRoot = textField;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onTextChanged: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = false;
|
|
||||||
onPressed: MobileTextSelection.MobileTextActionsToolBar.shouldBeVisible = true;
|
|
||||||
|
|
||||||
onPressAndHold: {
|
|
||||||
if (!Kirigami.Settings.tabletMode) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
forceActiveFocus();
|
|
||||||
cursorPosition = positionAt(event.x, event.y);
|
|
||||||
selectWord();
|
|
||||||
}
|
}
|
||||||
|
forceActiveFocus();
|
||||||
|
cursorPosition = positionAt(event.x, event.y);
|
||||||
|
selectWord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,10 +421,12 @@ Item {
|
|||||||
PlasmaComponents3.Label {
|
PlasmaComponents3.Label {
|
||||||
id: listItemSubtitle
|
id: listItemSubtitle
|
||||||
|
|
||||||
enabled: false
|
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
font: PlasmaCore.Theme.smallestFont
|
font: PlasmaCore.Theme.smallestFont
|
||||||
|
|
||||||
|
// Otherwise colored text can be hard to see
|
||||||
|
opacity: color === PlasmaCore.Theme.textColor ? 0.7 : 1.0
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
textFormat: listItem.allowStyledText ? Text.StyledText : Text.PlainText
|
textFormat: listItem.allowStyledText ? Text.StyledText : Text.PlainText
|
||||||
|
Loading…
x
Reference in New Issue
Block a user