<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
use QGuiApplication or QCoreApplication. QApplication itself is
deprecated.<br>
<br>
There is also dark side hack for using QML clipboard:<br>
<br>
TextEdit {<br>
id: clipboard<br>
visible: false<br>
function setClipboard(value) {<br>
text = value<br>
selectAll()<br>
copy()<br>
}<br>
function getClipboard() {<br>
text = ""<br>
paste()<br>
return text<br>
}<br>
}<br>
<br>
<div class="moz-cite-prefix">24.04.2014 12:03, Samuli Silvius пишет:<br>
</div>
<blockquote
cite="mid:CABcJ=QxBE9w29C+x-HcOwUH1gSUjSxSgicpJkZ9zhGZDcd+nRw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I use system clipboard in QML app with small C++ adapter</div>
<div><br>
</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#ifndef</span><span style="color:rgb(192,192,192)"> </span>QMLCLIPBOARDADAPTER_H</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">QMLCLIPBOARDADAPTER_H</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><QApplication></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><QClipboard></span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#include</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)"><QObject></span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">class</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QmlClipboardAdapter</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">public</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QObject</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">Q_OBJECT</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">public</span><span style="color:rgb(0,0,0)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">explicit</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QmlClipboardAdapter</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">QObject</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(0,0,0)">parent</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">)</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">:</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QObject</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">parent</span><span style="color:rgb(0,0,0)">)</span><span style="c
olor:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">clipboard</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QApplication</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">clipboard</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">Q_INVOKABLE</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">setText</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,128)">QString</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">text</span><span style="color:rgb(0,0,0)">){</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">clipboard</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setText</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">text</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QClipboard</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Clipboard</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">clipboard</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">setText</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">text</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QClipboard</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Selection</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">private</span><span style="color:rgb(0,0,0)">:</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QClipboard</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(128,0,0)">clipboard</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">};</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,128)">#endif</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">QMLCLIPBOARDADAPTER_H</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">
</pre>
</div>
<div><br>
</div>
<div>And it's working fine. But this requires that I have to
add </div>
<div><br>
</div>
<div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">QT</span><span style="color:rgb(192,192,192)"> </span>+=<span style="color:rgb(192,192,192)"> </span>widgets</pre>
</div>
<div><br>
</div>
<div>to .pro file and seems it's not supported by Jolla Harbour
as also Jolla SDK RPM validation gives me an errors. I have
updated the SDK to the latest.</div>
<div><br>
</div>
<div><font size="1" face="courier new, monospace">ERROR
[/usr/share/harbour-jolla2gether/qml/harbour-jolla2gether.qml]
Import 'QmlClipboardAdapter 1.0' is not allowed<br>
</font></div>
<div><font size="1" face="courier new, monospace">ERROR
[/usr/bin/harbour-jolla2gether] Cannot link to shared
library: libQt5Widgets.so.5</font><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Is there are way around this?</div>
<div><br>
</div>
<div>Br</div>
<div>-Samuli</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list</pre>
</blockquote>
<br>
</body>
</html>