当前位置: 首页>>代码示例>>C++>>正文


C++ QCoreApplication::applicationName方法代码示例

本文整理汇总了C++中QCoreApplication::applicationName方法的典型用法代码示例。如果您正苦于以下问题:C++ QCoreApplication::applicationName方法的具体用法?C++ QCoreApplication::applicationName怎么用?C++ QCoreApplication::applicationName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QCoreApplication的用法示例。


在下文中一共展示了QCoreApplication::applicationName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: on_about

void MainWindow::on_about()
{
	QCoreApplication * app = QCoreApplication::instance();
	QMessageBox::about(this, app->applicationName(), app->applicationName()
			+ ": example of Qt using marnav\n\nVersion: " + app->applicationVersion()
			+ "\n\nSee file: LICENSE");
}
开发者ID:mb12,项目名称:marnav,代码行数:7,代码来源:MainWindow.cpp

示例2: listAppletInfoForUrl

KPluginInfo::List PluginLoader::listAppletInfoForUrl(const QUrl &url)
{
    QString parentApp;
    QCoreApplication *app = QCoreApplication::instance();
    if (app) {
        parentApp = app->applicationName();
    }

    auto filter = [&parentApp](const KPluginMetaData &md) -> bool
    {
        const QString pa = md.value(QStringLiteral("X-KDE-ParentApp"));
        return (pa.isEmpty() || pa == parentApp) && !md.value(QStringLiteral("X-Plasma-DropUrlPatterns")).isEmpty();
    };
    KPluginInfo::List allApplets =  KPluginInfo::fromMetaData(KPackage::PackageLoader::self()->findPackages("Plasma/Applet", QString(), filter).toVector());

    KPluginInfo::List filtered;
    foreach (const KPluginInfo &info, allApplets) {
        QStringList urlPatterns = info.property("X-Plasma-DropUrlPatterns").toStringList();
        foreach (const QString &glob, urlPatterns) {
            QRegExp rx(glob);
            rx.setPatternSyntax(QRegExp::Wildcard);
            if (rx.exactMatch(url.toString())) {
#ifndef NDEBUG
                // qCDebug(LOG_PLASMA) << info.name() << "matches" << glob << url;
#endif
                filtered << info;
            }
        }
开发者ID:Rodsevich,项目名称:plasma-framework,代码行数:28,代码来源:pluginloader.cpp

示例3: getMayaWindow

void MainWindow::getMayaWindow()
{
    QCoreApplication*  app = qApp;
    if (app) {
        cout << "Application name is '" << app->applicationName().toStdString() << "'" << endl;
    }
    else
    {
        cout << "No maya app detected: " << app << endl;
    }
}
开发者ID:EmreTekinalp,项目名称:Qt,代码行数:11,代码来源:mayaMainWindow.cpp

示例4: on_about_qt

void MainWindow::on_about_qt()
{
	QCoreApplication * app = QCoreApplication::instance();
	QMessageBox::aboutQt(this, app->applicationName());
}
开发者ID:mb12,项目名称:marnav,代码行数:5,代码来源:MainWindow.cpp

示例5: dirPath

QSqlDatabase SObjectManager::Private::connection()
{
    if (!mConnection.isValid()) {
        QString databasePath;
        QCoreApplication *a = QCoreApplication::instance();

        QString orgName = a->organizationName();
        QString appName = a->applicationName();

        a->setOrganizationName(QLatin1String("saesu"));
        a->setApplicationName(QLatin1String("clouds"));

        databasePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);

        QDir dirPath(databasePath);
        if (!dirPath.exists())
            dirPath.mkpath(databasePath);


        // restore app name/org details
        a->setOrganizationName(orgName);
        a->setApplicationName(appName);

        mConnection = QSqlDatabase::addDatabase("QSQLITE", QLatin1String("saesu-cloud://") + mTableName);
        mConnection.setDatabaseName(databasePath + "/" + mTableName);
        if (!mConnection.open()) {
            // TODO: error handling
            sWarning() << "Couldn't open database";
            return mConnection;
        }

        const int currentDbVersion = 3;

        // TODO: make this work with multiple ObjectManagers
        if (!mConnection.tables().contains("_saesu")) {
            QSqlQuery q(mConnection);
            mConnection.transaction();

            // create table(s)
            sDebug() << "Creating tables";

            q.exec("CREATE TABLE _saesu (version integer)");
            q.exec("INSERT INTO _saesu VALUES (" + QString::number(currentDbVersion) + ")");
            q.exec("CREATE TABLE objects (key primary key, timestamp integer, hash blob, object blob)");
            q.exec("CREATE TABLE deletelist (key primary key, timestamp integer)");

            mConnection.commit();
        } else {
            QSqlQuery q(mConnection);
            mConnection.transaction();

            sDebug() << "Checking for migration";
            q.exec("SELECT version FROM _saesu");
            q.next();
            qint64 dbVersion = q.value(0).toLongLong();
            
            switch (dbVersion) {
                case currentDbVersion:
                    sDebug() << "Database up to date";
                    break;
                case 1:
                case 2:
                    // need to add a 'deletelist' table.
                    q.exec("CREATE TABLE deletelist (key primary key, timestamp integer)");
                    sDebug() << "Migrated successfully from schema v1";
                    break;
                default:
                    qCritical("I don't understand schema version!");
                    
            }

            q.exec("UPDATE _saesu SET version = '" + QString::number(currentDbVersion) + "'");

            mConnection.commit();
        }
    }

    return mConnection;
}
开发者ID:saesu,项目名称:libsaesu,代码行数:79,代码来源:sobjectmanager.cpp


注:本文中的QCoreApplication::applicationName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。