[Qt-components] Ubuntu UI toolkit - Clipboard access

Aaron J. Seigo aseigo at kde.org
Wed Jan 23 11:09:30 CET 2013


On Wednesday, January 23, 2013 10:06:59 Zsombor Egri wrote:
> Here's an API we are proposing for accessing the system clipboard from
> QML and to filter its content before being copied into a TextField/TextArea.

proposing to be added to Qt's QML API? (that seems the best place for such a 
thing)

> The API consists of an object, a data transfer type and a filter element.
> 
> The global object is based on (and uses) QClipboard functionality:
> 
> *clipboard* {
>     function *clear*() - to clear the clipboard content
>     function *setData*(string mimeType, var data) - pushes data to the
> clipboard
>     function MimeData *data*() - retrieves the clipboard data
> }

i'm not a fan of global objects in the least. much nicer to instantiate items 
that are actually needed. otherwise, we end up with a growing pile of objects 
of limited value in many use cases.

also, why functions instead of a data property? an object with mimeType and 
data properties could be assigned/retrieved from it. setting an invalid object 
would be a no-op.

it also makes clear unnecessary: just set data to be an empty / invalid 
MimeData object.

> The MimeData type provides access to the clipboard data itself; all
> properties are read-only.
> 
> *MimeData* {
>     readonly property list<string> *types* - contains the available
> types in the clipboard
>     readonly property string *text* - text data or undefined if no text
> data in clipboard
>     readonly property string *html* - HTML data or undefined
>     readonly property list<url> *urls* - list or URLs or undefined
>     readonly property color *color* - color data or undefined
> 
>     function var *mimeData*(string type) - returns data corresponding to
> the MIME type
> }

why not a single variant property?
why a function to return the mimeData? this is going to be implemented in C++ 
i imagine anyways, so a property that is retrieved via a C++ function seems 
normal. it can be set to read-only.

> And finally the clipboard filter element, which is meant to capture
> clipboard changes aswell as to grab clipboard key shortcuts from a
> TextField or TextArea so data can be filtered before pasting it into the
> text inputs.

this feels like something that would make sense as part of MimeData above, 
perhaps? 

also, what sort of filtering do you forsee being done?

-- 
Aaron J. Seigo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-components/attachments/20130123/58e9f393/attachment.bin 


More information about the Qt-components mailing list