reparent to flickable if possible

This commit is contained in:
Marco Martin 2015-09-02 11:43:27 +02:00
parent e688b3d483
commit b2bfd6cdf5
2 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015 by Marco MArtin <mart@kde.org>
* Copyright (C) 2015 by Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as

View File

@ -36,9 +36,12 @@ Item {
z: 9999
Component.onCompleted: {
var par = control
while (par.parent) {
//heuristic: if a flickable is found in the parents,
//reparent to it, so it scrolls together
while (par.parent && par.parent.contentY === undefined) {
par = par.parent
}
popup.parent = par
}
@ -46,11 +49,9 @@ Item {
popup.x = pos.x;
popup.y = pos.y;
popup.visible = true;
popup.z = 9999
}
function dismiss() {
popup.visible = false;
input.z = 0
}
Row {
x: parent.margins.left
@ -59,18 +60,18 @@ Item {
PlasmaComponents.ToolButton {
iconSource: "edit-cut"
flat: false
enabled: input.selectedText != ""
visible: input.selectedText != ""
onClicked: {
cut();
control.cut();
select(input.cursorPosition, input.cursorPosition);
}
}
PlasmaComponents.ToolButton {
iconSource: "edit-copy"
enabled: input.selectedText != ""
visible: input.selectedText != ""
flat: false
onClicked: {
copy();
control.copy();
select(input.cursorPosition, input.cursorPosition);
}
}
@ -79,7 +80,7 @@ Item {
enabled: input.canPaste
flat: false
onClicked: {
paste();
control.paste();
}
}
}