@Mesrine
I solved the chrome error by only copying the text to the clipboard. It seems that
textEdit.copy();
try to copy images also to the clipboard and this still is not supported on some browsers.
so I made my own class for text-only copy to clipboard
class TextClipboard :public QObject
{
Q_OBJECT
Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)
QML_ELEMENT
public:
TextClipboard(QObject *parent = nullptr):QObject(parent),m_text(QString()),clipboard(QGuiApplication::clipboard())
{
}
Q_INVOKABLE void copy()const
{
clipboard->setText(m_text);
}
signals:
void textChanged();
public:
QString m_text;
QClipboard *clipboard;
};
In the qml file where the text has to be copied on click on a Image I set
TextClipboard
{
id:tclip
text:root.address
}
Image {
id:img
anchors.centerIn:parent
sourceSize.width: root.width-10
source: "image://qrcodeblack/"+root.address
MouseArea {
anchors.fill: img
onClicked:
{
tclip.copy();
}
}
}
And this solves the error