本文整理汇总了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");
}
示例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;
}
}
示例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;
}
}
示例4: on_about_qt
void MainWindow::on_about_qt()
{
QCoreApplication * app = QCoreApplication::instance();
QMessageBox::aboutQt(this, app->applicationName());
}
示例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;
}