简体   繁体   English

简单的跨平台剪贴板库?

[英]Simple Cross Platform Clipboard Library?

I was wondering if one was out there. 我想知道是否有人在那里。 Really all I need is a way to copy and paste strings, like from game to Notepad and vice versa. 我真正需要的是一种复制和粘贴字符串的方法,比如从游戏到记事本,反之亦然。

Thanks 谢谢

Each application has to provide support for it. 每个应用程序都必须为它提供支持。 Notepad does. 记事本。 If you want your application to provide it, then you have to implement it. 如果你希望你的应用程序提供它,那么必须实现它。 Luckily this is easy if you're using the right tools. 幸运的是,如果您使用正确的工具,这很容易。

Cross-platform programming frameworks, such as Qt, usually have classes that encapsulate clipboard operations across platforms. 跨平台编程框架(如Qt)通常具有跨平台封装剪贴板操作的类。

Using Qt as an example, you have the QClipboard class which makes it as simple as calling setText() to set the clipboard's textual contents and text() to get them. 以Qt为例,你有QClipboard类,它就像调用setText()来设置剪贴板的文本内容和text()来获取它们一样简单。 There are also methods for images and other data formats - just check the docs. 还有图像和其他数据格式的方法 - 只需检查文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM