QClipboardProxy QML type renamed to ClipboardUtils
Additionally, copyTextToClipboard is renamed to setText, mimicking QClipboard naming.
This commit is contained in:
parent
781133238a
commit
7757f4e615
|
@ -37,7 +37,7 @@ SplitView {
|
|||
padding: 0
|
||||
text: "📋"
|
||||
font.pixelSize: 10
|
||||
onClicked: QClipboardProxy.copyTextToClipboard(textLabel.text)
|
||||
onClicked: ClipboardUtils.setText(textLabel.text)
|
||||
ToolTip.text: "Copy color name"
|
||||
ToolTip.visible: hovered
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ SplitView {
|
|||
padding: 0
|
||||
text: "📋"
|
||||
font.pixelSize: 10
|
||||
onClicked: QClipboardProxy.copyTextToClipboard(colorLabel.text)
|
||||
onClicked: ClipboardUtils.setText(colorLabel.text)
|
||||
ToolTip.text: "Copy color value"
|
||||
ToolTip.visible: hovered
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ Item {
|
|||
compare(amountToSend.empty, true)
|
||||
compare(amountToSend.amount, "0")
|
||||
|
||||
QClipboardProxy.copyTextToClipboard("1.0005")
|
||||
ClipboardUtils.setText("1.0005")
|
||||
const textField = findChild(amountToSend, "amountToSend_textField")
|
||||
verify(!!textField)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ Item {
|
|||
controlUnderTest = createTemporaryObject(componentUnderTest, root)
|
||||
signalSpyClearClicked.clear()
|
||||
signalSpyValidateInputRequested.clear()
|
||||
QClipboardProxy.clear()
|
||||
ClipboardUtils.clear()
|
||||
}
|
||||
|
||||
function test_basicGeometry() {
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
return new ClipboardUtils;
|
||||
}
|
||||
|
||||
Q_INVOKABLE void copyTextToClipboard(const QString& text);
|
||||
Q_INVOKABLE void setText(const QString& text);
|
||||
Q_INVOKABLE void clear();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -72,7 +72,7 @@ QList<QUrl> ClipboardUtils::urls() const
|
|||
return m_clipboard->mimeData()->urls();
|
||||
}
|
||||
|
||||
void ClipboardUtils::copyTextToClipboard(const QString &text)
|
||||
void ClipboardUtils::setText(const QString &text)
|
||||
{
|
||||
m_clipboard->setText(text);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
qmlRegisterType<WritableProxyModel>("StatusQ", 0, 1, "WritableProxyModel");
|
||||
qmlRegisterType<FormattedDoubleProperty>("StatusQ", 0, 1, "FormattedDoubleProperty");
|
||||
|
||||
qmlRegisterSingletonType<ClipboardUtils>("StatusQ", 0, 1, "QClipboardProxy", &ClipboardUtils::qmlInstance);
|
||||
qmlRegisterSingletonType<ClipboardUtils>("StatusQ", 0, 1, "ClipboardUtils", &ClipboardUtils::qmlInstance);
|
||||
qmlRegisterSingletonType<UrlUtils>("StatusQ", 0, 1, "UrlUtils", &UrlUtils::qmlInstance);
|
||||
|
||||
qmlRegisterType<ModelEntry>("StatusQ", 0, 1, "ModelEntry");
|
||||
|
|
|
@ -38,7 +38,7 @@ StatusInput {
|
|||
focusPolicy: Qt.NoFocus
|
||||
onClicked: {
|
||||
root.input.edit.forceActiveFocus()
|
||||
root.text = QClipboardProxy.text // paste plain text
|
||||
root.text = ClipboardUtils.text // paste plain text
|
||||
root.input.edit.cursorPosition = root.input.edit.length
|
||||
root.validateInputRequested()
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ StatusInput {
|
|||
function onKeyPressed(event) {
|
||||
if (event.matches(StandardKey.Paste)) {
|
||||
event.accepted = true
|
||||
root.text = QClipboardProxy.text // paste plain text
|
||||
root.text = ClipboardUtils.text // paste plain text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ Rectangle {
|
|||
|
||||
property int leftOfMentionIndex: -1
|
||||
property int rightOfMentionIndex: -1
|
||||
readonly property int nbEmojisInClipboard: StatusQUtils.Emoji.nbEmojis(QClipboardProxy.html)
|
||||
readonly property int nbEmojisInClipboard: StatusQUtils.Emoji.nbEmojis(ClipboardUtils.html)
|
||||
|
||||
property bool emojiPopupOpened: false
|
||||
property bool stickersPopupOpened: false
|
||||
|
@ -449,12 +449,12 @@ Rectangle {
|
|||
}
|
||||
|
||||
if (event.matches(StandardKey.Paste)) {
|
||||
if (QClipboardProxy.hasImage) {
|
||||
const clipboardImage = QClipboardProxy.imageBase64
|
||||
if (ClipboardUtils.hasImage) {
|
||||
const clipboardImage = ClipboardUtils.imageBase64
|
||||
validateImagesAndShowImageArea([clipboardImage])
|
||||
event.accepted = true
|
||||
} else if (QClipboardProxy.hasText) {
|
||||
const clipboardText = Utils.plainText(QClipboardProxy.text)
|
||||
} else if (ClipboardUtils.hasText) {
|
||||
const clipboardText = Utils.plainText(ClipboardUtils.text)
|
||||
// prevent repetitive & huge clipboard paste, where huge is total char count > than messageLimitHard
|
||||
const selectionLength = messageInputField.selectionEnd - messageInputField.selectionStart;
|
||||
if ((messageLength + clipboardText.length - selectionLength) > control.messageLimitHard)
|
||||
|
@ -500,8 +500,8 @@ Rectangle {
|
|||
d.copiedTextFormatted = ""
|
||||
d.copiedMentionsPos = []
|
||||
messageInputField.insert(d.copyTextStart, ((d.nbEmojisInClipboard === 0) ?
|
||||
("<div style='white-space: pre-wrap'>" + StatusQUtils.StringUtils.escapeHtml(QClipboardProxy.text) + "</div>")
|
||||
: StatusQUtils.Emoji.deparse(QClipboardProxy.html)));
|
||||
("<div style='white-space: pre-wrap'>" + StatusQUtils.StringUtils.escapeHtml(ClipboardUtils.text) + "</div>")
|
||||
: StatusQUtils.Emoji.deparse(ClipboardUtils.html)));
|
||||
}
|
||||
event.accepted = true
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ Rectangle {
|
|||
|
||||
if (messageInputField.readOnly) {
|
||||
messageInputField.readOnly = false;
|
||||
messageInputField.cursorPosition = (d.copyTextStart + QClipboardProxy.text.length + d.nbEmojisInClipboard);
|
||||
messageInputField.cursorPosition = (d.copyTextStart + ClipboardUtils.text.length + d.nbEmojisInClipboard);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue