管理会话
退出Qt Creator 时,系统会将当前工作区的快照存储为会话。要在启动Qt Creator 时自动恢复会话,请选择File >Sessions >Manage >Restore last session on startup 。
打开或创建以下项目时,它们会自动成为会话的一部分:
- 项目及其依赖项(包括使用 qmake 时的 SUBDIRS 项目)
- 编辑器
- 断点和表达式
- 书签
会话是个人的,也就是说,不是用来共享的。它不应该反映项目结构。会话中包含的个人数据,如书签和断点,通常不会引起在同一项目中工作的其他开发人员的兴趣。
例如,如果你在一个项目上工作,需要暂时切换到另一个项目,你可以克隆当前会话,将其保存在一个名称下,然后为另一个项目创建一个新的会话。切换到新会话后,打开的所有内容都会成为新会话的一部分。当你想回到第一个项目时,切换到保存的会话。Qt Creator ,打开属于该会话的项目和文件。
要管理会话,请选择File >Sessions >Manage 。
要以新名称保存会话,请选择Clone 。
创建新会话
要创建新会话,请
- 选择New 。
- 在Enter the name of the session 字段中,输入会话名称。
- 选择Create 创建一个新的空会话,或选择Create and Open 创建一个会话并切换到该会话。
打开会话
在会话之间切换:
- 转到File >Sessions ,然后选择一个会话。
- 在Session Manager 中选择Open 。
Welcome 模式中的Projects 选项卡列出了现有会话。要打开会话,请选择该会话或按Ctrl+Alt+<编号>,其中<编号>是要打开的会话编号(前九个会话可用)。
要查看会话的更多信息,请选择将鼠标光标移到会话名称上时出现的向下箭头图标。选择复制、重命名和删除会话的操作。
从命令行启动Qt Creator 时,可以将会话名称作为参数,使用该会话启动Qt Creator 。
从定位器打开会话
使用t
过滤器触发菜单命令打开会话。
查找会话:
- 选择Ctrl+K(macOS 上为Cmd+K)激活定位器。
- 输入
t
<会话名称t sess
<会话名称
其中<session_name>是要打开的会话名称。
- 双击会话名称即可打开它。
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.