粘贴和获取代码片段
要将代码片段或整个文件粘贴到服务器上,或从服务器上获取它们,请使用以下代码粘贴服务之一:
- DPaste.com
- Pastebin.com
例如,您可能会要求同事审核您计划提交到版本控制系统的变更。如果您使用的是 Git 版本控制系统,请通过Tools >Git >Local Repository >Diff 创建一个差异视图。然后,通过Tools >Code Pasting >Paste Snippet 将其内容上传到服务器。
审核人员可以通过选择Tools >Code Pasting >Fetch Snippet 来获取代码片段。如果他们当前在Qt Creator 中打开了项目,他们可以通过访问Tools >Git >Local Repository >Patch >Apply from Editor 来应用和测试更改。
粘贴代码段
将代码段粘贴到服务器上:
- 转到Tools >Code Pasting >Paste Snippet 或选择Alt+C,Alt+P。
- 在Protocol 中,选择要使用的代码粘贴服务。
- 在Expires after 中,指定在服务器上保留粘贴代码段的时间。
- 在Username 和Description 中,输入用户名并添加有关粘贴内容的信息。
- 检查并编辑要粘贴的内容。
- 选择Paste 。
默认情况下,Qt Creator 会将片段的 URL 复制到剪贴板,并在General Messages 中显示 URL。
要粘贴差异,右键单击一个片段并在上下文菜单中选择Send Chunk to CodePaster 。
获取片段
从服务器获取代码片段:
- 转到Tools >Code Pasting >Fetch Snippet 或选择Alt+C,Alt+F。
- 从列表中选择要获取的代码段。
要获取存储在 URL 中的内容,请选择Tools >Code Pasting >Fetch from URL 。
设置代码粘贴首选项
为代码粘贴服务设置首选项:
- 转到首选项>Code Pasting >General 。
- 在Default protocol 中,选择默认使用的代码粘贴服务。
- 在Username 中,输入您的用户名。
- 在Expires after 中,指定在服务器上保留粘贴代码段的时间。
- 选择Copy-paste URL to clipboard 可在粘贴文章时将代码粘贴服务上的文章 URL 复制到剪贴板。
- 选择Display General Messages after sending a post 可在粘贴帖子时在常规信息中显示 URL。
为代码粘贴设置共享网络驱动器
进入首选项>Code Pasting >Fileshare ,指定共享网络驱动器的路径。
代码片段会以简单文件的形式复制到驱动器中。你必须手动删除驱动器中过时的文件。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.