qCC version 2.13.alpha (Qt) - 31 May 2022
Main CloudCompare application (GUI & command line)
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ccConsole Class Reference

Console. More...

#include <ccConsole.h>

Inheritance diagram for ccConsole:
Inheritance graph
[legend]
Collaboration diagram for ccConsole:
Collaboration graph
[legend]

Public Member Functions

 ~ccConsole () override
 Destructor.
 
void setAutoRefresh (bool state)
 Sets auto-refresh state.
 
bool setLogFile (const QString &filename)
 Sets log file.
 
QWidget * parentWidget ()
 Returns the parent widget (if any)
 
void refresh ()
 Refreshes console (display all messages still in queue)
 

Static Public Member Functions

static void Init (QListWidget *textDisplay=nullptr, QWidget *parentWidget=nullptr, MainWindow *parentWindow=nullptr, bool redirectToStdOut=false)
 Inits console (and optionaly associates it with a text output widget) More...
 
static ccConsoleTheInstance (bool autoInit=true)
 Returns the (unique) static instance. More...
 
static void ReleaseInstance (bool flush=true)
 Releases unique instance.
 
static void EnableQtMessages (bool state)
 Whether to show Qt messages (qDebug / qWarning / etc.) in Console.
 
static bool QtMessagesEnabled ()
 Returns whether to show Qt messages (qDebug / qWarning / etc.) in Console or not.
 

Protected Types

using ConsoleItemType = QPair< QString, int >
 Queue element type (message + color)
 

Protected Member Functions

 ccConsole ()
 Default constructor. More...
 
void logMessage (const QString &message, int level) override
 

Protected Attributes

QListWidget * m_textDisplay
 Associated text display widget.
 
QWidget * m_parentWidget
 Parent widget.
 
MainWindowm_parentWindow
 Parent window (if any)
 
QMutex m_mutex
 Mutex for concurrent thread access to console.
 
QVector< ConsoleItemTypem_queue
 Queue for incoming messages.
 
QTimer m_timer
 Timer for auto-refresh.
 
QFile m_logFile
 Log file.
 
QTextStream * m_logStream
 Log file stream.
 

Static Protected Attributes

static bool s_showQtMessagesInConsole = false
 Whether to show Qt messages (qDebug / qWarning / etc.) in Console.
 
static bool s_redirectToStdOut = false
 

Detailed Description

Console.

Constructor & Destructor Documentation

◆ ccConsole()

ccConsole::ccConsole ( )
protected

Default constructor.

Constructor is protected to avoid using this object as a non static class.

Member Function Documentation

◆ Init()

void ccConsole::Init ( QListWidget *  textDisplay = nullptr,
QWidget *  parentWidget = nullptr,
MainWindow parentWindow = nullptr,
bool  redirectToStdOut = false 
)
static

Inits console (and optionaly associates it with a text output widget)

WARNING: in release mode, no message will be output if no 'textDisplay' widget is defined. Moreover, error messages will only appear in a (blocking) QMessageBox if a 'parentWidget' widget is defined. In debug mode, all message are sent to system console (with 'printf').

Parameters
textDisplaytext output widget (optional)
parentWidgetparent widget (optional)
parentWindowparent window (if any - optional)
redirectToStdOutwhether to redirect log messages to the system std::out output or not (optional)

◆ TheInstance()

ccConsole * ccConsole::TheInstance ( bool  autoInit = true)
static

Returns the (unique) static instance.

Parameters
autoInitautomatically initialize the console instance (with no widget!) if not done already

The documentation for this class was generated from the following files: