Full clipboard controls for PTextField
This commit is contained in:
parent
d1e7b2f2c9
commit
77ed27a6a0
2 changed files with 50 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
import 'common/constants.js' as Constants
|
import 'common/constants.js' as Constants
|
||||||
|
import 'icons/icons.js' as Icons
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: textField
|
id: textField
|
||||||
|
@ -36,15 +37,15 @@ Item {
|
||||||
height: 50 * pgst.scalef
|
height: 50 * pgst.scalef
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
|
id: textInput
|
||||||
anchors {
|
anchors {
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: clipboardIcon.left
|
||||||
margins: 5 * pgst.scalef
|
margins: 5 * pgst.scalef
|
||||||
}
|
}
|
||||||
color: Constants.colors.text
|
color: Constants.colors.text
|
||||||
selectionColor: Constants.colors.background
|
selectionColor: Constants.colors.background
|
||||||
id: textInput
|
|
||||||
font.pixelSize: parent.height * 0.7
|
font.pixelSize: parent.height * 0.7
|
||||||
font.family: placeholder.font.family
|
font.family: placeholder.font.family
|
||||||
focus: true
|
focus: true
|
||||||
|
@ -59,4 +60,50 @@ Item {
|
||||||
color: Constants.colors.placeholder
|
color: Constants.colors.placeholder
|
||||||
font.pixelSize: textInput.font.pixelSize
|
font.pixelSize: textInput.font.pixelSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconMenuItem {
|
||||||
|
id: clipboardIcon
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
margins: 5 * pgst.scalef
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
icon: Icons.paperclip
|
||||||
|
onClicked: {
|
||||||
|
pgst.showSelection([
|
||||||
|
{
|
||||||
|
label: 'Copy',
|
||||||
|
callback: function () {
|
||||||
|
textInput.copy();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Paste',
|
||||||
|
callback: function() {
|
||||||
|
textInput.paste();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Cut',
|
||||||
|
callback: function() {
|
||||||
|
textInput.cut();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Clear',
|
||||||
|
callback: function() {
|
||||||
|
textInput.text = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Select all',
|
||||||
|
callback: function() {
|
||||||
|
textInput.selectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,3 +20,4 @@ var magnifying_glass = '\ue074';
|
||||||
var cog = '\u2699';
|
var cog = '\u2699';
|
||||||
var link = '\ue077';
|
var link = '\ue077';
|
||||||
var vellipsis = '\u22ee';
|
var vellipsis = '\u22ee';
|
||||||
|
var paperclip = '\ue08a';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue