source: trunk/src/gui/kernel/qapplication.cpp@ 352

Last change on this file since 352 was 182, checked in by Dmitry A. Kuminov, 16 years ago

gui: Implemented standard cursor shapes (#54).

File size: 166.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "qabstracteventdispatcher.h"
43#include "qaccessible.h"
44#include "qapplication.h"
45#include "qclipboard.h"
46#include "qcursor.h"
47#include "qdesktopwidget.h"
48#include "qdir.h"
49#include "qevent.h"
50#include "qfile.h"
51#include "qfileinfo.h"
52#include "qgraphicsscene.h"
53#include "qhash.h"
54#include "qset.h"
55#include "qlayout.h"
56#include "qsessionmanager.h"
57#include "qstyle.h"
58#include "qstylefactory.h"
59#include "qtextcodec.h"
60#include "qtranslator.h"
61#include "qvariant.h"
62#include "qwidget.h"
63#include "qdnd_p.h"
64#include "qcolormap.h"
65#include "qdebug.h"
66#include "private/qgraphicssystemfactory_p.h"
67#include "private/qstylesheetstyle_p.h"
68#include "private/qstyle_p.h"
69#include "qmessagebox.h"
70#include <QtGui/qgraphicsproxywidget.h>
71
72#include "qinputcontext.h"
73#include "qkeymapper_p.h"
74
75#ifdef Q_WS_X11
76#include <private/qt_x11_p.h>
77#include "qinputcontextfactory.h"
78#endif
79
80#include <qthread.h>
81#include <private/qthread_p.h>
82
83#include <private/qfont_p.h>
84
85#include <stdlib.h>
86
87#include "qapplication_p.h"
88#include "qwidget_p.h"
89
90#include "qapplication.h"
91
92#ifdef Q_OS_WINCE
93#include "qdatetime.h"
94#include "qguifunctions_wince.h"
95extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp
96extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp
97extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp
98#endif
99
100//#define ALIEN_DEBUG
101
102static void initResources()
103{
104#ifdef Q_OS_WINCE
105 Q_INIT_RESOURCE(qstyle_wince);
106#else
107 Q_INIT_RESOURCE(qstyle);
108#endif
109
110#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)
111 Q_INIT_RESOURCE(qpaintengine_d3d);
112#endif
113 Q_INIT_RESOURCE(qmessagebox);
114#if !defined(QT_NO_PRINTDIALOG)
115 Q_INIT_RESOURCE(qprintdialog);
116#endif
117
118}
119
120QT_BEGIN_NAMESPACE
121
122extern void qt_call_post_routines();
123
124int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0
125
126QApplication::Type qt_appType=QApplication::Tty;
127QApplicationPrivate *QApplicationPrivate::self = 0;
128
129#ifndef QT_NO_IM
130QInputContext *QApplicationPrivate::inputContext;
131#endif
132
133bool QApplicationPrivate::quitOnLastWindowClosed = true;
134
135#ifdef Q_OS_WINCE
136int QApplicationPrivate::autoMaximizeThreshold = -1;
137bool QApplicationPrivate::autoSipEnabled = false;
138#endif
139
140QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type)
141 : QCoreApplicationPrivate(argc, argv)
142{
143 application_type = type;
144 qt_appType = type;
145
146#ifndef QT_NO_SESSIONMANAGER
147 is_session_restored = false;
148#endif
149
150 quitOnLastWindowClosed = true;
151
152#ifdef QT3_SUPPORT
153 qt_compat_used = 0;
154 qt_compat_resolved = 0;
155 qt_tryAccelEvent = 0;
156 qt_tryComposeUnicode = 0;
157 qt_dispatchAccelEvent = 0;
158#endif
159#if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
160 directPainters = 0;
161#endif
162
163 if (!self)
164 self = this;
165}
166
167QApplicationPrivate::~QApplicationPrivate()
168{
169 if (self == this)
170 self = 0;
171}
172
173/*!
174 \class QApplication
175 \brief The QApplication class manages the GUI application's control
176 flow and main settings.
177
178 \ingroup application
179 \mainclass
180
181 QApplication contains the main event loop, where all events from the window
182 system and other sources are processed and dispatched. It also handles the
183 application's initialization and finalization, and provides session
184 management. In addition, it handles most system-wide and application-wide
185 settings.
186
187 For any GUI application using Qt, there is precisely one QApplication
188 object, no matter whether the application has 0, 1, 2 or more windows at
189 any given time. For non-GUI Qt applications, use QCoreApplication instead,
190 as it does not depend on the \l QtGui library.
191
192 The QApplication object is accessible through the instance() function that
193 returns a pointer equivalent to the global qApp pointer.
194
195 QApplication's main areas of responsibility are:
196 \list
197 \o It initializes the application with the user's desktop settings
198 such as palette(), font() and doubleClickInterval(). It keeps
199 track of these properties in case the user changes the desktop
200 globally, for example through some kind of control panel.
201
202 \o It performs event handling, meaning that it receives events
203 from the underlying window system and dispatches them to the
204 relevant widgets. By using sendEvent() and postEvent() you can
205 send your own events to widgets.
206
207 \o It parses common command line arguments and sets its internal
208 state accordingly. See the \l{QApplication::QApplication()}
209 {constructor documentation} below for more details.
210
211 \o It defines the application's look and feel, which is
212 encapsulated in a QStyle object. This can be changed at runtime
213 with setStyle().
214
215 \o It specifies how the application is to allocate colors. See
216 setColorSpec() for details.
217
218 \o It provides localization of strings that are visible to the
219 user via translate().
220
221 \o It provides some magical objects like the desktop() and the
222 clipboard().
223
224 \o It knows about the application's windows. You can ask which
225 widget is at a certain position using widgetAt(), get a list of
226 topLevelWidgets() and closeAllWindows(), etc.
227
228 \o It manages the application's mouse cursor handling, see
229 setOverrideCursor()
230
231 \o On the X window system, it provides functions to flush and sync
232 the communication stream, see flushX() and syncX().
233
234 \o It provides support for sophisticated \l{Session Management}
235 {session management}. This makes it possible for applications
236 to terminate gracefully when the user logs out, to cancel a
237 shutdown process if termination isn't possible and even to
238 preserve the entire application's state for a future session.
239 See isSessionRestored(), sessionId() and commitData() and
240 saveState() for details.
241 \endlist
242
243 The QApplication object does so much initialization. Hence, it \e{must} be
244 created before any other objects related to the user interface are created.
245 Since QApplication also deals with common command line arguments, it is
246 usually a good idea to create it \e before any interpretation or
247 modification of \c argv is done in the application itself.
248
249 \table
250 \header
251 \o{2,1} Groups of functions
252
253 \row
254 \o System settings
255 \o desktopSettingsAware(),
256 setDesktopSettingsAware(),
257 cursorFlashTime(),
258 setCursorFlashTime(),
259 doubleClickInterval(),
260 setDoubleClickInterval(),
261 setKeyboardInputInterval(),
262 wheelScrollLines(),
263 setWheelScrollLines(),
264 palette(),
265 setPalette(),
266 font(),
267 setFont(),
268 fontMetrics().
269
270 \row
271 \o Event handling
272 \o exec(),
273 processEvents(),
274 exit(),
275 quit().
276 sendEvent(),
277 postEvent(),
278 sendPostedEvents(),
279 removePostedEvents(),
280 hasPendingEvents(),
281 notify(),
282 macEventFilter(),
283 qwsEventFilter(),
284 x11EventFilter(),
285 x11ProcessEvent(),
286 winEventFilter().
287
288 \row
289 \o GUI Styles
290 \o style(),
291 setStyle().
292
293 \row
294 \o Color usage
295 \o colorSpec(),
296 setColorSpec(),
297 qwsSetCustomColors().
298
299 \row
300 \o Text handling
301 \o installTranslator(),
302 removeTranslator()
303 translate().
304
305 \row
306 \o Widgets
307 \o allWidgets(),
308 topLevelWidgets(),
309 desktop(),
310 activePopupWidget(),
311 activeModalWidget(),
312 clipboard(),
313 focusWidget(),
314 activeWindow(),
315 widgetAt().
316
317 \row
318 \o Advanced cursor handling
319 \o overrideCursor(),
320 setOverrideCursor(),
321 restoreOverrideCursor().
322
323 \row
324 \o X Window System synchronization
325 \o flushX(),
326 syncX().
327
328 \row
329 \o Session management
330 \o isSessionRestored(),
331 sessionId(),
332 commitData(),
333 saveState().
334
335 \row
336 \o Miscellaneous
337 \o closeAllWindows(),
338 startingUp(),
339 closingDown(),
340 type().
341 \endtable
342
343 \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings
344*/
345
346/*!
347 \enum QApplication::Type
348
349 \value Tty a console application
350 \value GuiClient a GUI client application
351 \value GuiServer a GUI server application (for Qt for Embedded Linux)
352*/
353
354/*!
355 \enum QApplication::ColorSpec
356
357 \value NormalColor the default color allocation policy
358 \value CustomColor the same as NormalColor for X11; allocates colors
359 to a palette on demand under Windows
360 \value ManyColor the right choice for applications that use thousands of
361 colors
362
363 See setColorSpec() for full details.
364*/
365
366/*!
367 \fn QWidget *QApplication::topLevelAt(const QPoint &point)
368
369 Returns the top-level widget at the given \a point; returns 0 if
370 there is no such widget.
371*/
372
373/*!
374 \fn QWidget *QApplication::topLevelAt(int x, int y)
375
376 \overload
377
378 Returns the top-level widget at the point (\a{x}, \a{y}); returns
379 0 if there is no such widget.
380*/
381
382
383/*
384 The qt_init() and qt_cleanup() functions are implemented in the
385 qapplication_xyz.cpp file.
386*/
387
388void qt_init(QApplicationPrivate *priv, int type
389#ifdef Q_WS_X11
390 , Display *display = 0, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0
391#endif
392 );
393void qt_cleanup();
394
395Qt::MouseButtons QApplicationPrivate::mouse_buttons = Qt::NoButton;
396Qt::KeyboardModifiers QApplicationPrivate::modifier_buttons = Qt::NoModifier;
397
398QStyle *QApplicationPrivate::app_style = 0; // default application style
399
400#ifndef QT_NO_STYLE_STYLESHEET
401QString QApplicationPrivate::styleSheet; // default application stylesheet
402#endif
403QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0;
404
405int QApplicationPrivate::app_cspec = QApplication::NormalColor;
406QPalette *QApplicationPrivate::app_pal = 0; // default application palette
407QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
408QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
409
410QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
411QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
412
413Q_GLOBAL_STATIC(QMutex, applicationFontMutex);
414QFont *QApplicationPrivate::app_font = 0; // default application font
415QFont *QApplicationPrivate::sys_font = 0; // default system font
416QFont *QApplicationPrivate::set_font = 0; // default font set by programmer
417
418QIcon *QApplicationPrivate::app_icon = 0;
419QWidget *QApplicationPrivate::main_widget = 0; // main application widget
420QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input focus
421QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()
422QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
423bool QApplicationPrivate::obey_desktop_settings = true; // use winsys resources
424int QApplicationPrivate::cursor_flash_time = 1000; // text caret flash time
425int QApplicationPrivate::mouse_double_click_time = 400; // mouse dbl click limit
426int QApplicationPrivate::keyboard_input_time = 400; // keyboard input interval
427#ifndef QT_NO_WHEELEVENT
428int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll
429#endif
430bool qt_is_gui_used;
431bool Q_GUI_EXPORT qt_tab_all_widgets = true;
432bool qt_in_tab_key_event = false;
433int qt_antialiasing_threshold = -1;
434static int drag_time = 500;
435static int drag_distance = 4;
436static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
437QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut
438bool QApplicationPrivate::animate_ui = true;
439bool QApplicationPrivate::animate_menu = false;
440bool QApplicationPrivate::fade_menu = false;
441bool QApplicationPrivate::animate_combo = false;
442bool QApplicationPrivate::animate_tooltip = false;
443bool QApplicationPrivate::fade_tooltip = false;
444bool QApplicationPrivate::animate_toolbox = false;
445bool QApplicationPrivate::widgetCount = false;
446QString* QApplicationPrivate::styleOverride = 0;
447#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
448bool QApplicationPrivate::inSizeMove = false;
449#endif
450#ifdef QT_KEYPAD_NAVIGATION
451bool QApplicationPrivate::keypadNavigation = false;
452QWidget *QApplicationPrivate::oldEditFocus = 0;
453#endif
454
455bool qt_tabletChokeMouse = false;
456static bool force_reverse = false;
457
458static inline bool isAlien(QWidget *widget)
459{
460 if (!widget)
461 return false;
462#ifdef Q_WS_MAC // Fake alien behavior on the Mac :)
463 return !widget->isWindow() && widget->window()->testAttribute(Qt::WA_DontShowOnScreen);
464#else
465 return !widget->internalWinId();
466#endif
467}
468
469// ######## move to QApplicationPrivate
470// Default application palettes and fonts (per widget type)
471
472typedef QHash<QByteArray, QPalette> PaletteHash;
473Q_GLOBAL_STATIC(PaletteHash, app_palettes)
474PaletteHash *qt_app_palettes_hash()
475{
476 return app_palettes();
477}
478
479typedef QHash<QByteArray, QFont> FontHash;
480Q_GLOBAL_STATIC(FontHash, app_fonts)
481FontHash *qt_app_fonts_hash()
482{
483 return app_fonts();
484}
485
486QWidgetList *QApplicationPrivate::popupWidgets = 0; // has keyboard input focus
487
488QDesktopWidget *qt_desktopWidget = 0; // root window widgets
489#ifndef QT_NO_CLIPBOARD
490QClipboard *qt_clipboard = 0; // global clipboard object
491#endif
492QWidgetList * qt_modal_stack=0; // stack of modal widgets
493
494/*!
495 \internal
496*/
497void QApplicationPrivate::process_cmdline()
498{
499 Q_Q(QApplication);
500 Q_UNUSED(q);// only static members being used.
501 // process platform-indep command line
502 if (!qt_is_gui_used || !argc)
503 return;
504
505 int i, j;
506
507 j = 1;
508 for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments()
509 if (argv[i] && *argv[i] != '-') {
510 argv[j++] = argv[i];
511 continue;
512 }
513 QByteArray arg = argv[i];
514 arg = arg;
515 QString s;
516 if (arg == "-qdevel" || arg == "-qdebug") {
517 // obsolete argument
518 } else if (arg.indexOf("-style=", 0) != -1) {
519 s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());
520 } else if (arg == "-style" && i < argc-1) {
521 s = QString::fromLocal8Bit(argv[++i]).toLower();
522#ifndef QT_NO_SESSIONMANAGER
523 } else if (arg == "-session" && i < argc-1) {
524 ++i;
525 if (argv[i] && *argv[i]) {
526 session_id = QString::fromLatin1(argv[i]);
527 int p = session_id.indexOf(QLatin1Char('_'));
528 if (p >= 0) {
529 session_key = session_id.mid(p +1);
530 session_id = session_id.left(p);
531 }
532 is_session_restored = true;
533 }
534#endif
535#ifndef QT_NO_STYLE_STYLESHEET
536 } else if (arg == "-stylesheet" && i < argc -1) {
537 styleSheet = QLatin1String("file:///");
538 styleSheet.append(QString::fromLocal8Bit(argv[++i]));
539 } else if (arg.indexOf("-stylesheet=") != -1) {
540 styleSheet = QLatin1String("file:///");
541 styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12)));
542#endif
543 } else if (qstrcmp(arg, "-reverse") == 0) {
544 force_reverse = true;
545 q->setLayoutDirection(Qt::RightToLeft);
546 } else if (qstrcmp(arg, "-widgetcount") == 0) {
547 widgetCount = true;
548 } else if (arg == "-graphicssystem" && i < argc-1) {
549 graphics_system_name = QString::fromLocal8Bit(argv[++i]);
550 } else {
551 argv[j++] = argv[i];
552 }
553 if (!s.isEmpty()) {
554 if (app_style) {
555 delete app_style;
556 app_style = 0;
557 }
558 if (!styleOverride)
559 styleOverride = new QString;
560 *styleOverride = s;
561 }
562 }
563
564 if(j < argc) {
565 argv[j] = 0;
566 argc = j;
567 }
568}
569
570/*!
571 Initializes the window system and constructs an application object with
572 \a argc command line arguments in \a argv.
573
574 \warning The data referred to by \a argc and \a argv must stay valid for
575 the entire lifetime of the QApplication object. In addition, \a argc must
576 be greater than zero and \a argv must contain at least one valid character
577 string.
578
579 The global \c qApp pointer refers to this application object. Only one
580 application object should be created.
581
582 This application object must be constructed before any \l{QPaintDevice}
583 {paint devices} (including widgets, pixmaps, bitmaps etc.).
584
585 \note \a argc and \a argv might be changed as Qt removes command line
586 arguments that it recognizes.
587
588 Qt debugging options (not available if Qt was compiled without the QT_DEBUG
589 flag defined):
590 \list
591 \o -nograb, tells Qt that it must never grab the mouse or the
592 keyboard.
593 \o -dograb (only under X11), running under a debugger can cause an
594 implicit -nograb, use -dograb to override.
595 \o -sync (only under X11), switches to synchronous mode for
596 debugging.
597 \endlist
598
599 See \l{Debugging Techniques} for a more detailed explanation.
600
601 All Qt programs automatically support the following command line options:
602 \list
603 \o -style= \e style, sets the application GUI style. Possible values
604 are \c motif, \c windows, and \c platinum. If you compiled Qt with
605 additional styles or have additional styles as plugins these will
606 be available to the \c -style command line option.
607 \o -style \e style, is the same as listed above.
608 \o -stylesheet= \e stylesheet, sets the application \l styleSheet. The
609 value must be a path to a file that contains the Style Sheet.
610 \note Relative URLs in the Style Sheet file are relative to the
611 Style Sheet file's path.
612 \o -stylesheet \e stylesheet, is the same as listed above.
613 \o -session= \e session, restores the application from an earlier
614 \l{Session Management}{session}.
615 \o -session \e session, is the same as listed above.
616 \o -widgetcount, prints debug message at the end about number of
617 widgets left undestroyed and maximum number of widgets existed at
618 the same time
619 \o -reverse, sets the application's layout direction to
620 Qt::RightToLeft
621 \o -graphicssystem, sets the backend to be used for on-screen widgets
622 and QPixmaps. Available options are \c{raster} and \c{opengl}.
623 \endlist
624
625 The Windows version of Qt supports an additional command line option, if
626 Direct3D support has been compiled into Qt:
627 \list
628 \o -direct3d will make the Direct3D paint engine the default widget
629 paint engine in Qt. \bold {This functionality is experimental.}
630 \endlist
631
632 The X11 version of Qt supports some traditional X11 command line options:
633 \list
634 \o -display \e display, sets the X display (default is $DISPLAY).
635 \o -geometry \e geometry, sets the client geometry of the first window
636 that is shown.
637 \o -fn or \c -font \e font, defines the application font. The font
638 should be specified using an X logical font description.
639 \o -bg or \c -background \e color, sets the default background color
640 and an application palette (light and dark shades are calculated).
641 \o -fg or \c -foreground \e color, sets the default foreground color.
642 \o -btn or \c -button \e color, sets the default button color.
643 \o -name \e name, sets the application name.
644 \o -title \e title, sets the application title.
645 \o -visual \c TrueColor, forces the application to use a TrueColor
646 visual on an 8-bit display.
647 \o -ncols \e count, limits the number of colors allocated in the color
648 cube on an 8-bit display, if the application is using the
649 QApplication::ManyColor color specification. If \e count is 216
650 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green,
651 and 6 of blue); for other values, a cube approximately proportional
652 to a 2x3x1 cube is used.
653 \o -cmap, causes the application to install a private color map on an
654 8-bit display.
655 \o -im, sets the input method server (equivalent to setting the
656 XMODIFIERS environment variable)
657 \o -inputstyle, defines how the input is inserted into the given
658 widget, e.g., \c onTheSpot makes the input appear directly in the
659 widget, while \c overTheSpot makes the input appear in a box
660 floating over the widget and is not inserted until the editing is
661 done.
662 \endlist
663
664 \sa arguments()
665*/
666
667QApplication::QApplication(int &argc, char **argv)
668 : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
669{ Q_D(QApplication); d->construct(); }
670
671QApplication::QApplication(int &argc, char **argv, int _internal)
672 : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient))
673{ Q_D(QApplication); d->construct(); QApplicationPrivate::app_compile_version = _internal;}
674
675
676/*!
677 Constructs an application object with \a argc command line arguments in
678 \a argv. If \a GUIenabled is true, a GUI application is constructed,
679 otherwise a non-GUI (console) application is created.
680
681 \warning The data referred to by \a argc and \a argv must stay valid for
682 the entire lifetime of the QApplication object. In addition, \a argc must
683 be greater than zero and \a argv must contain at least one valid character
684 string.
685
686 Set \a GUIenabled to false for programs without a graphical user interface
687 that should be able to run without a window system.
688
689 On X11, the window system is initialized if \a GUIenabled is true. If
690 \a GUIenabled is false, the application does not connect to the X server.
691 On Windows and Macintosh, currently the window system is always
692 initialized, regardless of the value of GUIenabled. This may change in
693 future versions of Qt.
694
695 The following example shows how to create an application that uses a
696 graphical interface when available.
697
698 \snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 0
699*/
700
701QApplication::QApplication(int &argc, char **argv, bool GUIenabled )
702 : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty))
703{ Q_D(QApplication); d->construct(); }
704
705QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal)
706 : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty))
707{ Q_D(QApplication); d->construct(); QApplicationPrivate::app_compile_version = _internal;}
708
709
710
711/*!
712 Constructs an application object with \a argc command line arguments in
713 \a argv.
714
715 \warning The data referred to by \a argc and \a argv must stay valid for