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

📄 qapplication.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
int qt_antialiasing_threshold = -1;static int drag_time = 500;static int drag_distance = 4;static Qt::LayoutDirection layout_direction = Qt::LeftToRight;QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strutbool QApplicationPrivate::animate_ui = true;bool QApplicationPrivate::animate_menu = false;bool QApplicationPrivate::fade_menu = false;bool QApplicationPrivate::animate_combo = false;bool QApplicationPrivate::animate_tooltip = false;bool QApplicationPrivate::fade_tooltip = false;bool QApplicationPrivate::animate_toolbox = false;bool QApplicationPrivate::widgetCount = false;QString* QApplicationPrivate::styleOverride = 0;#ifdef QT_KEYPAD_NAVIGATIONbool QApplicationPrivate::keypadNavigation = false;QWidget *QApplicationPrivate::oldEditFocus = 0;#endifbool qt_tabletChokeMouse = false;static bool force_reverse = false;// ######## move to QApplicationPrivate// Default application palettes and fonts (per widget type)typedef QHash<QByteArray, QPalette> PaletteHash;Q_GLOBAL_STATIC(PaletteHash, app_palettes)PaletteHash *qt_app_palettes_hash(){    return app_palettes();}typedef QHash<QByteArray, QFont> FontHash;Q_GLOBAL_STATIC(FontHash, app_fonts)FontHash *qt_app_fonts_hash(){    return app_fonts();}QWidgetList *QApplicationPrivate::popupWidgets = 0;        // has keyboard input focusQDesktopWidget *qt_desktopWidget = 0;                // root window widgets#ifndef QT_NO_CLIPBOARDQClipboard              *qt_clipboard = 0;        // global clipboard object#endifQWidgetList * qt_modal_stack=0;                // stack of modal widgets/*!    \internal*/void QApplicationPrivate::process_cmdline(){    Q_Q(QApplication);    Q_UNUSED(q);// only static members being used.    // process platform-indep command line    if (!qt_is_gui_used || !argc)        return;    int i, j;    j = 1;    for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments()        if (argv[i] && *argv[i] != '-') {            argv[j++] = argv[i];            continue;        }        QByteArray arg = argv[i];        arg = arg;        QString s;        if (arg == "-qdevel" || arg == "-qdebug") {            // obsolete argument        } else if (arg.indexOf("-style=", 0) != -1) {            s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower());        } else if (arg == "-style" && i < argc-1) {            s = QString::fromLocal8Bit(argv[++i]).toLower();#ifndef QT_NO_SESSIONMANAGER        } else if (arg == "-session" && i < argc-1) {            ++i;            if (argv[i] && *argv[i]) {                session_id = QString::fromLatin1(argv[i]);                int p = session_id.indexOf(QLatin1Char('_'));                if (p >= 0) {                    session_key = session_id.mid(p +1);                    session_id = session_id.left(p);                }                is_session_restored = true;            }#endif#ifndef QT_NO_STYLE_STYLESHEET        } else if (arg == "-stylesheet" && i < argc -1) {            styleSheet = QLatin1String("file:///");            styleSheet.append(QString::fromLocal8Bit(argv[++i]));        } else if (arg.indexOf("-stylesheet=") != -1) {            styleSheet = QLatin1String("file:///");            styleSheet.append(QString::fromLocal8Bit(arg.right(arg.length() - 12)));#endif        } else if (qstrcmp(arg, "-reverse") == 0) {            force_reverse = true;            q->setLayoutDirection(Qt::RightToLeft);        } else if (qstrcmp(arg, "-widgetcount") == 0) {            widgetCount = true;        } else {            argv[j++] = argv[i];        }        if (!s.isEmpty()) {            if (app_style) {                delete app_style;                app_style = 0;            }            if (!styleOverride)                styleOverride = new QString;            *styleOverride = s;        }    }    if(j < argc) {        argv[j] = 0;        argc = j;    }}/*!  Initializes the window system and constructs an application object  with \a argc command line arguments in \a argv.  \warning The data pointed to by \a argc and \a argv must stay valid  for the entire lifetime of the QApplication object.  The global \c qApp pointer refers to this application object. Only  one application object should be created.  This application object must be constructed before any \link  QPaintDevice paint devices\endlink (including widgets, pixmaps, bitmaps  etc.).  Note that \a argc and \a argv might be changed. Qt removes command  line arguments that it recognizes. The original \a argc and \a argv  can be accessed later with arguments().  Qt debugging options (not available if Qt was compiled without the  QT_DEBUG flag defined):  \list  \o -nograb, tells Qt that it must never grab the mouse or the keyboard.  \o -dograb (only under X11), running under a debugger can cause  an implicit -nograb, use -dograb to override.  \o -sync (only under X11), switches to synchronous mode for        debugging.  \endlist  See \link debug.html Debugging Techniques \endlink for a more  detailed explanation.  All Qt programs automatically support the following command line options:  \list  \o -style= \e style, sets the application GUI style. Possible values       are \c motif, \c windows, and \c platinum. If you compiled Qt       with additional styles or have additional styles as plugins these       will be available to the \c -style command line option.  \o -style \e style, is the same as listed above.  \o -stylesheet= \e stylesheet, sets the application \l styleSheet. The value       must be a path to a file that contains the Style Sheet. Note that relative URLs       in the Style Sheet file are relative to the Style Sheet file's path.  \o -stylesheet \e stylesheet, is the same as listed above.  \o -session= \e session, restores the application from an earlier       \link session.html session \endlink.  \o -session \e session, is the same as listed above.  \o -widgetcount, prints debug message at the end about number of widgets left        undestroyed and maximum number of widgets existed at the same time  \o -reverse, sets the application's layout direction to Qt::RightToLeft  \endlist  The Windows version of Qt also support one additional command line  option, if Direct3D support has been compiled into Qt:  \list  \o -direct3d will make the Direct3D paint engine the default widget               paint engine in Qt. \bold {This functionality is experimental.}  \endlist  The X11 version of Qt also supports some traditional X11  command line options:  \list  \o -display \e display, sets the X display (default is $DISPLAY).  \o -geometry \e geometry, sets the client geometry of the        first window that is shown.  \o -fn or \c -font \e font, defines the application font. The  font should be specified using an X logical font description.  \o -bg or \c -background \e color, sets the default background color        and an application palette (light and dark shades are calculated).  \o -fg or \c -foreground \e color, sets the default foreground color.  \o -btn or \c -button \e color, sets the default button color.  \o -name \e name, sets the application name.  \o -title \e title, sets the application title.  \o -visual \c TrueColor, forces the application to use a TrueColor visual       on an 8-bit display.  \o -ncols \e count, limits the number of colors allocated in the       color cube on an 8-bit display, if the application is using the       QApplication::ManyColor color specification. If \e count is       216 then a 6x6x6 color cube is used (i.e. 6 levels of red, 6 of green,       and 6 of blue); for other values, a cube       approximately proportional to a 2x3x1 cube is used.  \o -cmap, causes the application to install a private color map       on an 8-bit display.  \o -im, sets the input method server (equivalent to setting the XMODIFIERS       environment variable)  \o -noxim, disables the input method framework ("no X input method").  \o -inputstyle, defines how the input is inserted into the given widget. E.g.,       \c onTheSpot makes the input appear directly in the widget, while       \c overTheSpot makes the input appear in a box floating over the       widget and is not inserted until the editing is done.  \endlist  \sa arguments()*/QApplication::QApplication(int &argc, char **argv)    : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)){ Q_D(QApplication); d->construct(); }QApplication::QApplication(int &argc, char **argv, int _internal)    : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)){ Q_D(QApplication); d->construct(); QApplicationPrivate::app_compile_version = _internal;}/*!    Constructs an application object with \a argc command line arguments    in \a argv. If \a GUIenabled is true, a GUI application is    constructed, otherwise a non-GUI (console) application is created.    Set \a GUIenabled to false for programs without a graphical user    interface that should be able to run without a window system.    On X11, the window system is initialized if \a GUIenabled is true.    If \a GUIenabled is false, the application does not connect to the    X server. On Windows and Macintosh, currently the window system is    always initialized, regardless of the value of GUIenabled. This may    change in future versions of Qt.    The following example shows how to create an application that    uses a graphical interface when available.    \code        int main(int argc, char **argv)        {        #ifdef Q_WS_X11            bool useGUI = getenv("DISPLAY") != 0;        #else            bool useGUI = true;        #endif            QApplication app(argc, argv, useGUI);            if (useGUI) {               // start GUI version               ...            } else {               // start non-GUI version               ...            }            return app.exec();        }    \endcode*/QApplication::QApplication(int &argc, char **argv, bool GUIenabled )    : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty)){ Q_D(QApplication); d->construct(); }QApplication::QApplication(int &argc, char **argv, bool GUIenabled , int _internal)    : QCoreApplication(*new QApplicationPrivate(argc, argv, GUIenabled ? GuiClient : Tty)){ Q_D(QApplication); d->construct();  QApplicationPrivate::app_compile_version = _internal;}/*!  Constructs an application object with \a argc command line arguments  in \a argv.  For Qtopia Core, passing QApplication::GuiServer for \a type  makes this application the server (equivalent to running with the  \c -qws option).*/QApplication::QApplication(int &argc, char **argv, Type type)    : QCoreApplication(*new QApplicationPrivate(argc, argv, type)){ Q_D(QApplication); d->construct(); }QApplication::QApplication(int &argc, char **argv, Type type , int _internal)    : QCoreApplication(*new QApplicationPrivate(argc, argv, type)){ Q_D(QApplication); d->construct();  QApplicationPrivate::app_compile_version = _internal;}/*!    \internal*/void QApplicationPrivate::construct(#ifdef Q_WS_X11                                    Display *dpy, Qt::HANDLE visual, Qt::HANDLE cmap#endif                                    ){    Q_INIT_RESOURCE(qstyle);#if !defined(QT_NO_DIRECT3D) && defined(Q_WS_WIN)    Q_INIT_RESOURCE(qpaintengine_d3d);#endif    qt_is_gui_used = (qt_appType != QApplication::Tty);    process_cmdline();    // Must be called before initialize()    qt_init(this, qt_appType#ifdef Q_WS_X11            , dpy, visual, cmap#endif            );    initialize();    eventDispatcher->startingUp();#ifdef QT_EVAL    extern void qt_gui_eval_init(uint);    qt_gui_eval_init(application_type);#endif}#if defined(Q_WS_X11)// ### a string literal is a cont char*// ### using it as a char* is wrong and could lead to segfaults// ### if aargv is modified someday// ########## make it work with argc == argv == 0static int aargc = 1;static char *aargv[] = { (char*)"unknown", 0 };/*!  \fn QApplication::QApplication(Display* display, Qt::HANDLE visual, Qt::HANDLE colormap)  Create an application, given an already open display \a display. 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.*/QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)    : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient)){    if (! dpy)        qWarning("QApplication: Invalid Display* argument");    Q_D(QApplication);    d->construct(dpy, visual, colormap);}QApplication::QApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)    : QCoreApplication(*new QApplicationPrivate(aargc, aargv, GuiClient)){    if (! dpy)        qWarning("QApplication: Invalid Display* argument");    Q_D(QApplication);    d->construct(dpy, visual, colormap);    QApplicationPrivate::app_compile_version = _internal;}/*!  \fn QApplication::QApplication(Display *display, int &argc, char **argv,                           Qt::HANDLE visual, Qt::HANDLE colormap)  Create an application, given an already open \a display 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.*/QApplication::QApplication(Display *dpy, int &argc, char **argv,                           Qt::HANDLE visual, Qt::HANDLE colormap)    : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)){    if (! dpy)        qWarning("QApplication: Invalid Display* argument");    Q_D(QApplication);    d->construct(dpy, visual, colormap);}QApplication::QApplication(Display *dpy, int &argc, char **argv,                           Qt::HANDLE visual, Qt::HANDLE colormap, int _internal)    : QCoreApplication(*new QApplicationPrivate(argc, argv, GuiClient)){    if (! dpy)        qWarning("QApplication: Invalid Display* argument");    Q_D(QApplication);    d->construct(dpy, visual, colormap);    QApplicationPrivate::app_compile_version = _internal;}#endif // Q_WS_X11

⌨️ 快捷键说明

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