31 #include "Riostream.h"
34 #include <QtCore/QObject>
35 #include <QtCore/QTimer>
45 if ( err->error_code == BadWindow ) {
50 else if ( err->error_code == BadMatch
51 && err->request_code == 42 ) {
54 else if ( err->error_code == BadDrawable
55 && err->request_code == 14 ) {
61 XGetErrorText( dpy, err->error_code, errstr, 256 );
62 qWarning(
"X11 Error: %s %d\n Major opcode: %d",
63 errstr, err->error_code, err->request_code );
76 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
77 void qMessageOutput( QtMsgType type,
const char *
msg )
82 std::cerr <<
"QtRoot-Debug: " << msg << std::endl;
86 std::cerr <<
"QtRoot-Warning: " << msg << std::endl;
89 std::cerr <<
"QtRoot-Fatal: " << msg << std::endl;
92 std::cerr <<
"QtRoot-Critical: " << msg << std::endl;
95 std::cerr <<
"QtRoot-Other: " << msg << std::endl;
101 void q5MessageOutput(QtMsgType type,
const QMessageLogContext &context,
const QString &msg)
103 QByteArray localMsg = msg.toLocal8Bit();
107 fprintf(stderr,
"QtRoot-Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
111 fprintf(stderr,
"QtRoot-Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
114 fprintf(stderr,
"QtRoot-Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
117 fprintf(stderr,
"QtRoot-Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
120 fprintf(stderr,
"QtRoot-other: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
127 QApplication(argc,argv, true)
132 timer =
new QTimer(
this );
133 QObject::connect(
timer, SIGNAL(timeout()),
135 timer->setSingleShot(
false);
140 #if QT_VERSION < QT_VERSION_CHECK(5,0,0)
141 qInstallMsgHandler( qMessageOutput );
154 const char* env = gSystem->Getenv(
"ROOT_CANVAS");
157 if ((strcmp(env,
"yes")==0) || (strcmp(env,
"YES")==0)) flag = 1;
else
158 if ((strcmp(env,
"no")==0) || (strcmp(env,
"NO")==0)) flag = -1;
182 gSystem->ProcessEvents();
virtual ~QRootApplication()
QRootApplication(int &argc, char **argv, int poll=0)
static bool IsRootCanvasMenuEnabled()
void q5MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
static bool fRootCanvasMenusEnabled
static int qt_x11_errhandler(Display *dpy, XErrorEvent *err)