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

📄 qcoreapplication.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    Use arguments() instead.*/char **QCoreApplication::argv(){    if (!self) {        qWarning("QCoreApplication::argv: Please instantiate the QApplication object first");        return 0;    }    return self->d_func()->argv;}/*!    \since 4.1    Returns the list of command-line arguments.    arguments().at(0) is the program name, arguments().at(1) is the    first argument, and arguments().last() is the last argument.    Calling this function is slow - you should store the result in a variable    when parsing the command line.    \warning On Unix, this list is built from the argc and argv parameters passed    to the constructor in the main() function. The string-data in argv is    interpreted using QString::fromLocal8Bit(); hence it is not possible to    pass i.e. Japanese command line arguments on a system that runs in a latin1    locale. Most modern Unix systems do not have this limitation, as they are    Unicode based.    On NT-based Windows, this limitation does not apply either.*/QStringList QCoreApplication::arguments(){    QStringList list;    if (!self) {        qWarning("QCoreApplication::arguments: Please instantiate the QApplication object first");        return list;    }#ifdef Q_OS_WIN    QString cmdline = QT_WA_INLINE(QString::fromUtf16((unsigned short *)GetCommandLineW()), QString::fromLocal8Bit(GetCommandLineA()));    list = qWinCmdArgs(cmdline);    if (self->d_func()->application_type) { // GUI app? Skip known - see qapplication.cpp        QStringList stripped;        for (int a = 0; a < list.count(); ++a) {            QString arg = list.at(a);            QByteArray l1arg = arg.toLatin1();            if (l1arg == "-qdevel" ||                l1arg == "-qdebug" ||                l1arg == "-reverse" ||                l1arg == "-widgetcount" ||                l1arg == "-direct3d")                ;            else if (l1arg.startsWith("-style="))                ;            else if (l1arg == "-style" ||                l1arg == "-session")                ++a;            else                stripped += arg;        }        list = stripped;    }#else    const int ac = self->d_func()->argc;    char ** const av = self->d_func()->argv;    for (int a = 0; a < ac; ++a) {        list << QString::fromLocal8Bit(av[a]);    }#endif    return list;}/*!    \property QCoreApplication::organizationName    \brief the name of the organization that wrote this application    The value is used by the QSettings class when it is constructed    using the empty constructor. This saves having to repeat this    information each time a QSettings object is created.    On Mac, QSettings uses organizationDomain() as the organization    if it's not an empty string; otherwise it uses    organizationName(). On all other platforms, QSettings uses    organizationName() as the organization.    \sa organizationDomain applicationName*/void QCoreApplication::setOrganizationName(const QString &orgName){    coreappdata()->orgName = orgName;}QString QCoreApplication::organizationName(){    return coreappdata()->orgName;}/*!    \property QCoreApplication::organizationDomain    \brief the Internet domain of the organization that wrote this application    The value is used by the QSettings class when it is constructed    using the empty constructor. This saves having to repeat this    information each time a QSettings object is created.    On Mac, QSettings uses organizationDomain() as the organization    if it's not an empty string; otherwise it uses organizationName().    On all other platforms, QSettings uses organizationName() as the    organization.    \sa organizationName applicationName*/void QCoreApplication::setOrganizationDomain(const QString &orgDomain){    coreappdata()->orgDomain = orgDomain;}QString QCoreApplication::organizationDomain(){    return coreappdata()->orgDomain;}/*!    \property QCoreApplication::applicationName    \brief the name of this application    The value is used by the QSettings class when it is constructed    using the empty constructor. This saves having to repeat this    information each time a QSettings object is created.    \sa organizationName organizationDomain*/void QCoreApplication::setApplicationName(const QString &application){    coreappdata()->application = application;}QString QCoreApplication::applicationName(){    return coreappdata()->application;}#ifndef QT_NO_LIBRARYQ_GLOBAL_STATIC_WITH_ARGS(QMutex, libraryPathMutex, (QMutex::Recursive))/*!    Returns a list of paths that the application will search when    dynamically loading libraries.    Qt provides default library paths, but they can also be set using    a \l{Using qt.conf}{qt.conf} file. Paths specified in this file    will override default values.    This list will include the installation directory for plugins if    it exists (the default installation directory for plugins is \c    INSTALL/plugins, where \c INSTALL is the directory where Qt was    installed).  The directory of the application executable (NOT the    working directory) is always added, as well as the colon separated    entries of the QT_PLUGIN_PATH environment variable.    If you want to iterate over the list, you can use the \l foreach    pseudo-keyword:    \code        foreach (QString path, app.libraryPaths())            do_something(path);    \endcode    \sa setLibraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary,        {How to Create Qt Plugins}*/QStringList QCoreApplication::libraryPaths(){    QMutexLocker locker(libraryPathMutex());    if (!self)        return QStringList();    if (!coreappdata()->app_libpaths) {        QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList;        QString installPathPlugins =  QLibraryInfo::location(QLibraryInfo::PluginsPath);        if (QFile::exists(installPathPlugins)) {            // Make sure we convert from backslashes to slashes.            installPathPlugins = QDir(installPathPlugins).canonicalPath();            if (!app_libpaths->contains(installPathPlugins))                app_libpaths->append(installPathPlugins);        }        // If QCoreApplication is not yet instantiated,        // make sure we add the application path when we construct the QCoreApplication        if (self) self->d_func()->appendApplicationPathToLibraryPaths();        const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");        if (!libPathEnv.isEmpty()) {#ifdef Q_OS_WIN            QLatin1Char pathSep(';');#else            QLatin1Char pathSep(':');#endif            QStringList paths = QString::fromLatin1(libPathEnv).split(pathSep, QString::SkipEmptyParts);            for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {                QString canonicalPath = QDir(*it).canonicalPath();                if (!app_libpaths->contains(canonicalPath))                    app_libpaths->append(canonicalPath);            }        }    }    return *(coreappdata()->app_libpaths);}/*!    Sets the list of directories to search when loading libraries to    \a paths. All existing paths will be deleted and the path list    will consist of the paths given in \a paths.    \sa libraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary */void QCoreApplication::setLibraryPaths(const QStringList &paths){    *(coreappdata()->app_libpaths) = paths;}/*!  Appends \a path to the end of the library path list. If \a path is  empty or already in the path list, the path list is not changed.  The default path list consists of a single entry, the installation  directory for plugins.  The default installation directory for plugins  is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was  installed.  \sa removeLibraryPath(), libraryPaths(), setLibraryPaths() */void QCoreApplication::addLibraryPath(const QString &path){    if (path.isEmpty())        return;    // make sure that library paths is initialized    libraryPaths();    QString canonicalPath = QDir(path).canonicalPath();    if (!coreappdata()->app_libpaths->contains(canonicalPath))        coreappdata()->app_libpaths->prepend(canonicalPath);}/*!    Removes \a path from the library path list. If \a path is empty or not    in the path list, the list is not changed.    \sa addLibraryPath(), libraryPaths(), setLibraryPaths()*/void QCoreApplication::removeLibraryPath(const QString &path){    if (path.isEmpty())        return;    // make sure that library paths is initialized    libraryPaths();    coreappdata()->app_libpaths->removeAll(path);}#endif //QT_NO_LIBRARY/*!    \typedef QCoreApplication::EventFilter    A function with the following signature that can be used as an    event filter:    \code        bool myEventFilter(void *message, long *result);    \endcode    \sa setEventFilter()*//*!    \fn EventFilter QCoreApplication::setEventFilter(EventFilter filter)    Sets the event filter \a filter. Returns a pointer to the filter    function previously defined.    The event filter is a function that is called for every message    received in all threads. This does \e not include messages to    objects that are not handled by Qt.    The function can return true to stop the event to be processed by    Qt, or false to continue with the standard event processing.    Only one filter can be defined, but the filter can use the return    value to call the previously set event filter. By default, no    filter is set (i.e., the function returns 0).    \sa installEventFilter()*/QCoreApplication::EventFilterQCoreApplication::setEventFilter(QCoreApplication::EventFilter filter){    Q_D(QCoreApplication);    EventFilter old = d->eventFilter;    d->eventFilter = filter;    return old;}/*!    Sends \a message through the event filter that was set by    setEventFilter(). If no event filter has been set, this function    returns false; otherwise, this function returns the result of the    event filter function in the \a result parameter.    \sa setEventFilter()*/bool QCoreApplication::filterEvent(void *message, long *result){    Q_D(QCoreApplication);    if (result)        *result = 0;    if (d->eventFilter)        return d->eventFilter(message, result);#ifdef Q_OS_WIN    return winEventFilter(reinterpret_cast<MSG *>(message), result);#else    return false;#endif}/*!    This function returns true if there are pending events; otherwise    returns false. Pending events can be either from the window    system or posted events using postEvent().    \sa QAbstractEventDispatcher::hasPendingEvents()*/bool QCoreApplication::hasPendingEvents(){    QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();    if (eventDispatcher)        return eventDispatcher->hasPendingEvents();    return false;}#ifdef QT3_SUPPORT/*! \fn void QCoreApplication::lock()    In Qt 3, this function locked the Qt library mutex, allowing    non-GUI threads to perform basic printing operations using    QPainter.    In Qt 4, this is no longer supported, since painting is only    supported from within a paint event handler. This function does    nothing.    \sa QWidget::paintEvent()*//*! \fn void QCoreApplication::unlock(bool wakeUpGui)    In Qt 3, this function unlocked the Qt library mutex. The mutex    allowed non-GUI threads to perform basic printing operations    using QPainter.    In Qt 4, this is no longer supported, since painting is only    supported from within a paint event handler. This function does    nothing.*//*! \fn bool QCoreApplication::locked()    This function does nothing. It is there to keep old code working.    It always returns false.    See lock() for details.*//*! \fn bool QCoreApplication::tryLock()    This function does nothing. It is there to keep old code working.    It always returns false.    See lock() for details.*//*! \fn void QCoreApplication::processOneEvent()    \obsolete    Waits for an event to occur, processes it, then returns.    This function is useful for adapting Qt to situations where the    event processing must be grafted onto existing program loops.    Using this function in new applications may be an indication of design    problems.    \sa processEvents(), exec(), QTimer*//*! \obsolete    This function

⌨️ 快捷键说明

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