Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: application output in a separate window, instead of the output pane?

Qt Creator: application output in a separate window, instead of the output pane?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qt creatoroutputos x
7 Posts 5 Posters 7.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guy Gizmo
    wrote on 3 May 2016, 03:15 last edited by
    #1

    When using Qt Creator, I'd like to be able to have my application's output appear in a separate window form the main Qt Creator window, instead of the "Application Output" pane that is always anchored to the bottom of the main window. This will help me better utilize all of my available screen real estate. Is there any way to do this?

    In case there are platform specific solutions, I'm running OS X. However if there's a cross-platform solution that would be great too.

    1 Reply Last reply
    1
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 May 2016, 20:56 last edited by
      #2

      Hi,

      What about the "Run in Terminal" option in the Project panel under Run ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply 5 May 2016, 04:55
      2
      • S SGaist
        3 May 2016, 20:56

        Hi,

        What about the "Run in Terminal" option in the Project panel under Run ?

        G Offline
        G Offline
        Guy Gizmo
        wrote on 5 May 2016, 04:55 last edited by
        #3

        @SGaist It's a bit inconvenient because it causes a new terminal window to open every time. I'd prefer to have just one window that all of my app's output goes to so I can place it in a specific spot.

        I see that, behind the scenes, Qt Creator is calling a bash script that executes some AppleScript to get the terminal window to open. I may try tinkering with it to see if I can get it to behave how I want, but it'd be much more convenient if Qt Creator allowed breaking off the Application Output (and the issues section now that I think about it) into its own floating window so that I can make full use of the vertical real estate of my screen.

        O 1 Reply Last reply 6 Nov 2019, 13:56
        0
        • S Offline
          S Offline
          Sl3dg3
          wrote on 6 Nov 2019, 13:31 last edited by
          #4

          There is a task for this in Jira: https://bugreports.qt.io/browse/QTCREATORBUG-9488

          If you want this feature, please REGISTER THERE AND VOTE FOR IT!

          1 Reply Last reply
          1
          • G Guy Gizmo
            5 May 2016, 04:55

            @SGaist It's a bit inconvenient because it causes a new terminal window to open every time. I'd prefer to have just one window that all of my app's output goes to so I can place it in a specific spot.

            I see that, behind the scenes, Qt Creator is calling a bash script that executes some AppleScript to get the terminal window to open. I may try tinkering with it to see if I can get it to behave how I want, but it'd be much more convenient if Qt Creator allowed breaking off the Application Output (and the issues section now that I think about it) into its own floating window so that I can make full use of the vertical real estate of my screen.

            O Offline
            O Offline
            ODБOï
            wrote on 6 Nov 2019, 13:56 last edited by
            #5

            @Guy-Gizmo hi
            you can use qInstallMessageHandler to do whatever you need with the application output

            1 Reply Last reply
            1
            • G Offline
              G Offline
              Guy Gizmo
              wrote on 6 Nov 2019, 15:23 last edited by
              #6

              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.

              1 Reply Last reply
              2
              • D Offline
                D Offline
                DrSnowLabs
                wrote on 10 Sept 2024, 15:23 last edited by DrSnowLabs 9 Oct 2024, 15:23
                #7

                Hello from the future. 5 years later and still not a feature, but here's a ugly workaround I have been using to some degree of satisfaction:

                • On the main Qt Creator window:
                  • pull up the bottom panel divider all the way up covering as much of the window as possible
                  • select <no document>
                • open a new window(s) form the "split" icon, and use that as the main editor window

                This way, I have a window just for the output separated from the code editing.

                Anyway, not pretty, but gets the job done.

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved