⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qapplication.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qabstracteventdispatcher.h"#include "qaccessible.h"#include "qapplication.h"#include "qclipboard.h"#include "qcursor.h"#include "qdesktopwidget.h"#include "qdir.h"#include "qevent.h"#include "qfile.h"#include "qfileinfo.h"#include "qhash.h"#include "qset.h"#include "qlayout.h"#include "qsessionmanager.h"#include "qstyle.h"#include "qstylefactory.h"#include "qtextcodec.h"#include "qtranslator.h"#include "qvariant.h"#include "qwidget.h"#include "qdnd_p.h"#include "qcolormap.h"#include "qdebug.h"#include "private/qstylesheetstyle_p.h"#include "private/qstyle_p.h"#include "qmessagebox.h"#include "qinputcontext.h"#include "qkeymapper_p.h"#ifdef Q_WS_X11#include <private/qt_x11_p.h>#include "qinputcontextfactory.h"#endif#include <qthread.h>#include <private/qthread_p.h>#include <private/qfont_p.h>#include <stdlib.h>extern void qt_call_post_routines();#include "qapplication_p.h"#include "qwidget_p.h"#include "qapplication.h"int QApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0QApplication::Type qt_appType=QApplication::Tty;QApplicationPrivate *QApplicationPrivate::self = 0;QInputContext *QApplicationPrivate::inputContext;bool QApplicationPrivate::quitOnLastWindowClosed = true;bool QApplicationPrivate::tryEmitLastWindowClosedPending = false;QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::Type type)    : QCoreApplicationPrivate(argc, argv){    application_type = type;    qt_appType = type;#ifndef QT_NO_SESSIONMANAGER    is_session_restored = false;#endif    quitOnLastWindowClosed = true;    tryEmitLastWindowClosedPending = false;#ifdef QT3_SUPPORT    qt_compat_used = 0;    qt_compat_resolved = 0;    qt_tryAccelEvent = 0;    qt_tryComposeUnicode = 0;    qt_dispatchAccelEvent = 0;#endif#if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)    directPainters = 0;#endif    if (!self)        self = this;}QApplicationPrivate::~QApplicationPrivate(){    if (self == this)        self = 0;}/*!  \class QApplication  \brief The QApplication class manages the GUI application's control  flow and main settings.  \ingroup application  \mainclass  It contains the main event loop, where all events from the window  system and other sources are processed and dispatched. It also  handles the application's initialization and finalization, and  provides session management. It also handles most system-wide and  application-wide settings.  For any GUI application that uses Qt, there is precisely one  QApplication object, no matter whether the application has 0, 1, 2  or more windows at any time. For non-GUI Qt applications, use  QCoreApplication instead, which doesn't depend on the \l QtGui  library.  The QApplication object is accessible through the instance()  function which return a pointer equivalent to the global qApp  pointer.  QApplication's main areas of responsibility are:  \list  \o It initializes the application with the user's desktop settings  such as palette(), font() and doubleClickInterval(). It keeps track  of these properties in case the user changes the desktop globally, for  example through some kind of control panel.  \o It performs event handling, meaning that it receives events  from the underlying window system and dispatches them to the relevant  widgets. By using sendEvent() and postEvent() you can send your own  events to widgets.  \o It parses common command line arguments and sets its internal  state accordingly. See the \link QApplication::QApplication()  constructor documentation\endlink below for more details about this.  \o It defines the application's look and feel, which is  encapsulated in a QStyle object. This can be changed at runtime  with setStyle().  \o It specifies how the application is to allocate colors.  See setColorSpec() for details.  \o It provides localization of strings that are visible to the user  via translate().  \o It provides some magical objects like the desktop() and the  clipboard().  \o It knows about the application's windows. You can ask which  widget is at a certain position using widgetAt(), get a list of  topLevelWidgets() and closeAllWindows(), etc.  \o It manages the application's mouse cursor handling,  see setOverrideCursor()  \o On the X window system, it provides functions to flush and sync  the communication stream, see flushX() and syncX().  \o It provides support for sophisticated \link  session.html session management \endlink. This makes it possible  for applications to terminate gracefully when the user logs out, to  cancel a shutdown process if termination isn't possible and even to  preserve the entire application's state for a future session. See  isSessionRestored(), sessionId() and commitData() and saveState()  for details.  \endlist  Since the QApplication object does so much initialization, it  \e{must} be created before any other objects related to the user  interface are created.  Since it also deals with common command line arguments, it is  usually a good idea to create it \e before any interpretation or  modification of \c argv is done in the application itself.  \table    \header \o{2,1} Groups of functions    \row     \o System settings     \o        desktopSettingsAware(),        setDesktopSettingsAware(),        cursorFlashTime(),        setCursorFlashTime(),        doubleClickInterval(),        setDoubleClickInterval(),        setKeyboardInputInterval(),        wheelScrollLines(),        setWheelScrollLines(),        palette(),        setPalette(),        font(),        setFont(),        fontMetrics().    \row     \o Event handling     \o        exec(),        processEvents(),        exit(),        quit().        sendEvent(),        postEvent(),        sendPostedEvents(),        removePostedEvents(),        hasPendingEvents(),        notify(),        macEventFilter(),        qwsEventFilter(),        x11EventFilter(),        x11ProcessEvent(),        winEventFilter().    \row     \o GUI Styles     \o        style(),        setStyle().    \row     \o Color usage     \o        colorSpec(),        setColorSpec(),        qwsSetCustomColors().    \row     \o Text handling     \o        installTranslator(),        removeTranslator()        translate().    \row     \o Widgets     \o        allWidgets(),        topLevelWidgets(),        desktop(),        activePopupWidget(),        activeModalWidget(),        clipboard(),        focusWidget(),        winFocus(),        activeWindow(),        widgetAt().    \row     \o Advanced cursor handling     \o        overrideCursor(),        setOverrideCursor(),        restoreOverrideCursor().    \row     \o X Window System synchronization     \o        flushX(),        syncX().    \row     \o Session management     \o        isSessionRestored(),        sessionId(),        commitData(),        saveState().    \row     \o Miscellaneous     \o        closeAllWindows(),        startingUp(),        closingDown(),        type().  \endtable    \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings*//*!    \enum QApplication::Type    \value Tty a console application    \value GuiClient a GUI client application    \value GuiServer a GUI server application (for Qtopia Core)*//*!    \enum QApplication::ColorSpec    \value NormalColor the default color allocation policy    \value CustomColor the same as NormalColor for X11; allocates colors    to a palette on demand under Windows    \value ManyColor the right choice for applications that use thousands of    colors    See setColorSpec() for full details.*//*!    \fn QWidget *QApplication::topLevelAt(const QPoint &point)    Returns the top-level widget at the given \a point; returns 0 if    there is no such widget.*//*!    \fn QWidget *QApplication::topLevelAt(int x, int y)    \overload    Returns the top-level widget at the point (\a{x}, \a{y}); returns    0 if there is no such widget.*//*  The qt_init() and qt_cleanup() functions are implemented in the  qapplication_xyz.cpp file.*/void qt_init(QApplicationPrivate *priv, int type#ifdef Q_WS_X11              , Display *display = 0, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0#endif   );void qt_cleanup();Qt::MouseButtons QApplicationPrivate::mouse_buttons = Qt::NoButton;Qt::KeyboardModifiers QApplicationPrivate::modifier_buttons = Qt::NoModifier;QStyle *QApplicationPrivate::app_style = 0;        // default application style#ifndef QT_NO_STYLE_STYLESHEETQString QApplicationPrivate::styleSheet;           // default application stylesheet#endifint QApplicationPrivate::app_cspec = QApplication::NormalColor;QPalette *QApplicationPrivate::app_pal = 0;        // default application paletteQPalette *QApplicationPrivate::sys_pal = 0;        // default system paletteQPalette *QApplicationPrivate::set_pal = 0;        // default palette set by programmerQFont *QApplicationPrivate::app_font = 0;        // default application fontQFont *QApplicationPrivate::sys_font = 0;        // default system fontQFont *QApplicationPrivate::set_font = 0;        // default font set by programmerQIcon *QApplicationPrivate::app_icon = 0;QWidget *QApplicationPrivate::main_widget = 0;        // main application widgetQWidget *QApplicationPrivate::focus_widget = 0;        // has keyboard input focusQWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()QWidget *QApplicationPrivate::active_window = 0;        // toplevel with keyboard focusbool QApplicationPrivate::obey_desktop_settings = true;        // use winsys resourcesint QApplicationPrivate::cursor_flash_time = 1000;        // text caret flash timeint QApplicationPrivate::mouse_double_click_time = 400;        // mouse dbl click limitint QApplicationPrivate::keyboard_input_time = 400; // keyboard input interval#ifndef QT_NO_WHEELEVENTint QApplicationPrivate::wheel_scroll_lines = 3;                // number of lines to scroll#endifbool qt_is_gui_used;bool Q_GUI_EXPORT qt_tab_all_widgets = true;bool qt_in_tab_key_event = false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -