Wasn't expecting this thread to get resurrected! I'm glad to see there's a feature I can vote for to have this ability added to Qt Creator.
I've dealt with this in the meantime by enabling "run in terminal" in all of my project's run settings and then setting my terminal in Preferences > Environment > System > Terminal to a custom script that uses whichever terminal window is the closest to the lower right corner of my desktop. (That's where I want my program output to go.) This lets me effectively have it be in a separate window from Qt Creator that I can position wherever I like.
I'm running macOS so my solution only works for that, but in case anyone wants it, here's the script I'm using to do the above in iTerm2:
#! /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]="bribriSaveDir=\`pwd\`; cd ${mydir//\"/\\\"}; "
# args[0]="cd ${mydir//\"/\\\"};"
for a in "$@" ; do
x=$(printf '%q ' "$a")
x="${x//\\/\\\\}"
args[${#args[@]}]="${x//\"/\\\"}"
done
args+=('; cd ${bribriSaveDir}')
mArgs=${args[@]:0}
osascript <<EOF
tell application "System Events" to set terminalRunning to exists process "iTerm2"
if not terminalRunning then
tell application "iTerm"
activate
repeat while the (count of the windows) = 0
delay 0.1
end repeat
end tell
end if
set exec to "$mArgs"
tell application "iTerm"
set theWindows to {}
repeat with i from 1 to the count of the windows
if (is hotkey window of window i) = false and (is at shell prompt of current session of window i) = true then
copy window i to the end of theWindows
end if
end repeat
if (count of theWindows) = 0 then
set newWindow to create window with default profile
tell current session of newWindow to write text exec with newline
else
set currentWin to window 1
set currentDistance to 0
repeat with i from 1 to the count of theWindows
set theWindow to item i of theWindows
set bb to bounds of theWindow
set x to (item 3 of bb)
set y to (item 4 of bb)
set dist to x * x + y * y
if dist > currentDistance then
set currentWin to theWindow
set currentDistance to dist
end if
end repeat
tell current session of currentWin to write text exec with newline
end if
end tell
EOF
The criteria for which window it selects can be adjusted by changing the interior of the repeat with i from 1 to the count of theWindows loop. Whichever window currentWin gets assigned to will be the one that Qt Creator runs the app in.
I also got annoyed with the way that you have to press enter in the terminal window after the program I'm running in Qt Creator exits, since that doesn't really make sense to do if you're reusing the same terminal window over and over again. So I downloaded the source to Qt Creator and made a small modification to the qtcreator_process_stub tool it includes (which is the little executable that communicates with Qt Creator and manages running your app in a terminal window) so that it doesn't do that any longer, and it prints the return code of my program since I find it's useful to know precisely when it's terminated and how. Each time I update Qt Creator I just copy my version of qtcreator_process_stub into its application bundle to get the behavior I want. So far there hasn't been any changes to qtcreator_process_stub in several versions so it's been fine to just keep copying in my version of it.
Here's a diff of the changes I made to it, at least for the unix / macOS side of things. I imagine it'd be easy to do something similar on Windows:
--- a/src/libs/utils/process_stub_unix.c
+++ b/src/libs/utils/process_stub_unix.c
@@ -70,8 +70,8 @@ static volatile int chldPid;
static void __attribute__((noreturn)) doExit(int code)
{
tcsetpgrp(0, getpid());
- puts(sleepMsg);
- fgets(sleepMsg, 2, stdin); /* Minimal size to make it wait */
+ //puts(sleepMsg);
+ //fgets(sleepMsg, 2, stdin); /* Minimal size to make it wait */
exit(code);
}
@@ -163,9 +163,11 @@ static void sigchldHandler(int sig)
}
}
sendMsg("exit %d\n", WEXITSTATUS(chldStatus));
+ printf("\nExited with status %d\n", chldStatus >> 8);
doExit(0);
} else {
sendMsg("crash %d\n", WTERMSIG(chldStatus));
+ printf("\nExited with status %d\n", chldStatus >> 8);
doExit(0);
}
}
@@ -180,7 +182,8 @@ int main(int argc, char *argv[])
char **env = 0;
struct sockaddr_un sau;
struct sigaction act;
+ printf("\n");
memset(&act, 0, sizeof(act));
if (argc < ArgEnv) {
I figured I'd post all that stuff just in case someone else finds it useful. I definitely appreciate that Qt Creator is open source so I can make little modifications to it like this.