如何在 Qt Creator 中更改终端?
How to change terminal in Qt Creator?
如何在Qt Creator中将iterm2设置为终端?当我单击 "open terminal here" 时,它会打开 Mac OS 默认终端。我怎么能改变它打开例如iterm2
而不是?
看到你在OSX,你可以使用我posted here的解决方案。你可以创建一个新的脚本来打开一个新的iTerm2 window,然后执行一个command/script.
为方便起见,这里是我的回答的副本:
First, create a script (let's say ~/newiTerm.sh
) and put the following content
#! /bin/bash
# ugly escaping: for apple script \ and " need to be escaped, whereas %q takes care of all bash escaping
declare -a args
mydir=`pwd`
mydir=$(printf '%q' "$mydir")
mydir="${mydir//\/\\}"
args[0]="cd ${mydir//\"/\\"};"
for a in "$@" ; do
x=$(printf '%q ' "$a")
x="${x//\/\\}"
args[${#args[@]}]="${x//\"/\\"}"
done
mArgs=${args[@]:0}
osascript <<EOF
set cdScript to "$mArgs"
tell application "iTerm2"
set newWindow to (create window with default profile)
tell newWindow
select
set _session to current session
tell _session
write text cdScript
end tell
end tell
end tell
Then, go to Qt Preferences ( ⌘,
) > Environment > System > Terminal and set the value to ~/newiTerm.sh
干杯
注意 - 确保您拥有 shell 脚本的权限。
您需要给予适当的许可,例如 chmod a+x ~/newiTerm.sh
。否则,QT 将无法 运行 它。
如何在Qt Creator中将iterm2设置为终端?当我单击 "open terminal here" 时,它会打开 Mac OS 默认终端。我怎么能改变它打开例如iterm2
而不是?
看到你在OSX,你可以使用我posted here的解决方案。你可以创建一个新的脚本来打开一个新的iTerm2 window,然后执行一个command/script.
为方便起见,这里是我的回答的副本:
First, create a script (let's say
~/newiTerm.sh
) and put the following content#! /bin/bash # ugly escaping: for apple script \ and " need to be escaped, whereas %q takes care of all bash escaping declare -a args mydir=`pwd` mydir=$(printf '%q' "$mydir") mydir="${mydir//\/\\}" args[0]="cd ${mydir//\"/\\"};" for a in "$@" ; do x=$(printf '%q ' "$a") x="${x//\/\\}" args[${#args[@]}]="${x//\"/\\"}" done mArgs=${args[@]:0} osascript <<EOF set cdScript to "$mArgs" tell application "iTerm2" set newWindow to (create window with default profile) tell newWindow select set _session to current session tell _session write text cdScript end tell end tell end tell
Then, go to Qt Preferences (
⌘,
) > Environment > System > Terminal and set the value to~/newiTerm.sh
干杯
注意 - 确保您拥有 shell 脚本的权限。
您需要给予适当的许可,例如 chmod a+x ~/newiTerm.sh
。否则,QT 将无法 运行 它。