diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-08-10 12:14:37 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-08-10 12:14:37 -0500 |
commit | 6b749249eec1ce412afbbdfd78138c3c62b8bbbc (patch) | |
tree | 5a9c1436408cf5dcdbed33c1a88bc65bc33caef9 /main/dependencies/qt3/src/kernel | |
parent | b6c6d9f8dd1221e5d9dc5b674e93797761470024 (diff) | |
download | tde-6b749249eec1ce412afbbdfd78138c3c62b8bbbc.tar.gz tde-6b749249eec1ce412afbbdfd78138c3c62b8bbbc.zip |
Add new delayed initialization constructor to QApplication
Diffstat (limited to 'main/dependencies/qt3/src/kernel')
-rw-r--r-- | main/dependencies/qt3/src/kernel/qapplication.cpp | 97 | ||||
-rw-r--r-- | main/dependencies/qt3/src/kernel/qapplication.h | 6 |
2 files changed, 103 insertions, 0 deletions
diff --git a/main/dependencies/qt3/src/kernel/qapplication.cpp b/main/dependencies/qt3/src/kernel/qapplication.cpp index 7296f4c9e..849c41c8a 100644 --- a/main/dependencies/qt3/src/kernel/qapplication.cpp +++ b/main/dependencies/qt3/src/kernel/qapplication.cpp @@ -923,6 +923,103 @@ QApplication::QApplication(Display *dpy, int argc, char **argv, #endif // Q_WS_X11 +QApplication::QApplication( bool delayed_init ) { + if (!delayed_init) { + qWarning( "QApplication: incorrect constructor likely specified." ); + } +} + +#if defined(Q_WS_X11) +/*! + Create an application, given an already open display \a dpy. If \a + visual and \a colormap are non-zero, the application will use those as + the default Visual and Colormap contexts. + + \warning Qt only supports TrueColor visuals at depths higher than 8 + bits-per-pixel. + + This is available only on X11. +*/ + +void QApplication::doLateInitialization( Display* dpy, HANDLE visual, HANDLE colormap ) +{ + static int aargc = 1; + // ### a string literal is a cont char* + // ### using it as a char* is wrong and could lead to segfaults + // ### if aargv is modified someday + static char *aargv[] = { (char*)"unknown", 0 }; + + app_argc = aargc; + app_argv = aargv; + + qt_appType = GuiClient; + qt_is_gui_used = TRUE; + qt_appType = GuiClient; + init_precmdline(); + // ... no command line. + + if ( ! dpy ) { +#ifdef QT_CHECK_STATE + qWarning( "QApplication: invalid Display* argument." ); +#endif // QT_CHECK_STATE + + qt_init( &aargc, aargv, GuiClient ); + } else { + qt_init( dpy, visual, colormap ); + } + + initialize( aargc, aargv ); + + if ( qt_is_gui_used ) + qt_maxWindowRect = desktop()->rect(); + if ( eventloop ) + eventloop->appStartingUp(); +} + +/*! + Create an application, given an already open display \a dpy and using + \a argc command line arguments in \a argv. If \a + visual and \a colormap are non-zero, the application will use those as + the default Visual and Colormap contexts. + + \warning Qt only supports TrueColor visuals at depths higher than 8 + bits-per-pixel. + + This is available only on X11. + +*/ +void QApplication::doLateInitialization(Display *dpy, int argc, char **argv, + HANDLE visual, HANDLE colormap) +{ + qt_appType = GuiClient; + qt_is_gui_used = TRUE; + qt_appType = GuiClient; + init_precmdline(); + + app_argc = argc; + app_argv = argv; + + if ( ! dpy ) { +#ifdef QT_CHECK_STATE + qWarning( "QApplication: invalid Display* argument." ); +#endif // QT_CHECK_STATE + + qt_init( &argc, argv, GuiClient ); + } else { + qt_init(dpy, visual, colormap); + } + + process_cmdline( &argc, argv ); + initialize(argc, argv); + + if ( qt_is_gui_used ) + qt_maxWindowRect = desktop()->rect(); + if ( eventloop ) + eventloop->appStartingUp(); +} + + +#endif // Q_WS_X11 void QApplication::init_precmdline() { diff --git a/main/dependencies/qt3/src/kernel/qapplication.h b/main/dependencies/qt3/src/kernel/qapplication.h index 39f7858eb..83781352a 100644 --- a/main/dependencies/qt3/src/kernel/qapplication.h +++ b/main/dependencies/qt3/src/kernel/qapplication.h @@ -74,6 +74,7 @@ class Q_EXPORT QApplication : public QObject { Q_OBJECT public: + QApplication( bool delayed_init ); QApplication( int &argc, char **argv ); QApplication( int &argc, char **argv, bool GUIenabled ); enum Type { Tty, GuiClient, GuiServer }; @@ -85,6 +86,11 @@ public: #endif virtual ~QApplication(); +#if defined(Q_WS_X11) + void doLateInitialization( Display* dpy, HANDLE visual = 0, HANDLE cmap = 0 ); + void doLateInitialization( Display *dpy, int argc, char **argv, HANDLE visual = 0, HANDLE cmap= 0 ); +#endif + int argc() const; char **argv() const; |