I am using the R console in Intellij. This is started automatically when invoking Run or Debug from within the Editor
From within the R console we can return to the Editor by hitting ESC. How can we then go back to the R console from the Editor via a shortcut (and without hitting Run or Debug again)?
Note: CMD-6 does open the R Tool
But that is not the R console instead some kind of messages window:
Update Here are the Run menu options
Problems and R Console tool windows have the same shortcuts, changing the shortcuts for the tool windows should help:
If I run a Qt application directly from the Windows command-line (cmd), it immediately returns back to the shell even as the GUI continues running; I assume it creates a second process before the parent exits.
If I run the Qt application indirectly though, from a batch file or Python script, it doesn't behave the same way; it blocks until the application actually exits:
Is this standard Qt behavior? I can't find any mention of it in the documentation or anywhere else. Can it be customized? I would prefer that the application always block when run from the command-line.
This is NORMAL Windows behavior.
In a console console programs are waited on. GUI programs are not. The rules are specified in start /?(mention of new behavior is NT4 to Windows 2000).
So Start /w c:\windows\notepad.
When running my Qt5 application on linux, I don't see any output from qDebug, qWarning, qCritical or qFatal. I know that I can use qInstallMsgHandler to install a message handler and see them, but this is rather heavyweight.
I just want to check the qWarning log to see if there is any signal that mis-connected. Is there a way to look at this log? A special command-line option, an environment variable?
I think I remember that in the past, everything was printed to stderr, perhaps that's a Qt5 change?
Please do not make the mistake of assuming that qDebug, qWarning, qCritical and qFatal always log on standard error. That's absolutely not the case.
The actual destination varies depending on the Qt configuration and the targeting OS. Plus, 5.4 and then 5.11 introduced some behavioural changes. See here and here for discussions.
TL;DR:
On Qt >= 5.11
If the process' stderr has a console attached, that's where the debug log will go.
If you want to always log on stderr, set QT_FORCE_STDERR_LOGGING to 1.
In alternative, set QT_ASSUME_STDERR_HAS_CONSOLE to 1. I suspect this one is meant to be used by a parent process that reads a child's stderr and shows it to the user somehow.
QT_LOGGING_TO_CONSOLE to 1 still works, but Qt will complain.
On Qt >= 5.4 and < 5.11
If you want to always log on stderr, set the QT_LOGGING_TO_CONSOLE environment variable to 1.
If you do not want to log on stderr, the QT_LOGGING_TO_CONSOLE environment variable to 0 (this will force logging through the native system logger).
If the QT_LOGGING_TO_CONSOLE environment variable is not set, then whether logging to the console or not depends on whether the application is running in a TTY (on UNIX) or whether there's a console window (on Windows).
On Qt < 5.4, the situation is more confusing.
If Qt has been built with support for a specific logging framework (e.g. SLOG2, journald, Android log, etc.) then logging always goes to that framework
Otherwise on UNIX it goes to stderr
Otherwise on Windows OutputDebugString or stderr is used depending whether the app is a console app.
The problem with the pre-5.4 approach was that, f.i., under Unix IDEs would not capture an application's debug output if Qt had been built with journald support. That's because the output went to journald, not to the IDE. In 5.4 the approach has been made more flexible and uniform across OSes.
If you happen to run Arch Linux, which compiles Qt with the -journald option, all debug output is per default directed to the systemd journal (display with journalctl).
You can override this behaviour by defining QT_LOGGING_TO_CONSOLE=1 as an environment variable.
They are still printed to standard error.
If you launch the application from the command line, it is usually printed there, or if using Qt Creator, it's displayed in the Application Output window.
If you are using visual studio, qDebug etc are printed to the output window in the IDE.
Is there a possible way to attach the console to a GUI so that the user will be able to enter commands into the console from the GUI?
As long as the program is launched from the console, it can read and write from/to the console. There's nothing that makes a Java program "GUI" or "Console" except for the code.
If you want to always have a console regardless of how the program is launched, you could just code a frame to behave as one.
I have a GUI program that opens a Windows console in a separate window to display output and accept user input. My development environment is Qt 4.7.1 with mingw. The console works fine, until I try to run the program in Qt's debugger (gdb); then, although AllocConsole succeeds, and GetStdHandle appears to return a valid handle (0x000000d8), any attempt to use the handle causes Windows error 6 (invalid handle).
So I can't debug my program. Which is a pain, because it has some serious bugs. The problem may be that gdb's console prevents me opening my own console; but then why do AllocConsole and GetStdHandle succeed? I upgraded to Qt Creator 2.0.94 (Qt 4.7.1), but it didn't help. Any ideas?
Update I have found that I can debug the program by running it without the debugger, and then attaching to it from Qt. Not ideal, but better than nothing.
Can't you use the standard output console, using
CONFIG += console
in the .pro file?
Hmm -- check this out:
A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console. A process can use the FreeConsole function to detach itself from its current console, then it can call AllocConsole to create a new console or AttachConsole to attach to another console.
Can you try running FreeConsole before you create yours?