从命令行运行Qt Creator
您可以通过命令行启动Qt Creator 并指定一些选项。例如,您可以将文件从任意行和列开始打开。
要使用命令行选项,请在包含Qt Creator 可执行文件的目录中输入以下命令,或在命令中指定Qt Creator 的路径:
qtcreator [option] [filename[:line_number[:column_number]]]
注意: 文件名与行号之间、行号与列号之间,既可以使用 冒号 (:)也可以使用 加号 (+) 作为分隔符。分隔符与行号之间也可以使用空格。
CLI 命令示例
以下是在支持的平台上安装Qt Creator 时,将程序安装到 Qt Online Installer 安装到默认位置时,在受支持平台上的命令示例如下。请根据需要修改路径。
在 Windows 上:
C:\Qt\Tools\QtCreator\bin\qtcreator -helpC:\Qt\Tools\QtCreator\bin\qtcreator C:\TextFinder\textfinder.cpp:100:2C:\Qt\Tools\QtCreator\bin\qtcreator C:\TextFinder\textfinder.cpp +100+2
在 Linux 上:
~/Qt/Tools/QtCreator/bin/qtcreator -help~/Qt/Tools/QtCreator/bin/qtcreator /src/TextFinder/textfinder.cpp:100:2~/Qt/Tools/QtCreator/bin/qtcreator /src/TextFinder/textfinder.cpp+100+2
在 macOS 上:
~/Qt/Qt\ Creator.app/Contents/MacOS/Qt\ Creator -help
从目录中打开项目
要打开位于特定目录中的项目,您可以将目录名称作为命令行参数传递。Qt Creator 会查找与该目录名称匹配的会话并加载它;或者在该目录中查找项目文件并打开它。
例如,在 Windows 上:
C:\qtcreator\bin>qtcreator.exe C:\Examples\alarms
另请参阅 “命令行选项”。
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.