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


C++ QStringList::empty方法代码示例

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


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

示例1: setArgumentsFromQml

bool FileBackend::setArgumentsFromQml(const QVariantList& arguments)
{
	QStringList list;
	for (auto &item : arguments) {
		QUrl url(item.toString());
		if (url.isLocalFile()) {
			list.append(url.toLocalFile());
		}
	}
	if (!list.empty()) {
		this->setArguments(list);
		return true;
	}
	return false;
}
开发者ID:redcapital,项目名称:skadi,代码行数:15,代码来源:filebackend.cpp

示例2: dropEvent

void MainWindow::dropEvent(QDropEvent *event)
{
    const QMimeData *mimeData = event->mimeData();
    if (mimeData->hasUrls()) {
        QList<QUrl> urlList(mimeData->urls());
        QStringList fileList;
        for(int size = urlList.size(), i=0; i < size; ++i)
            fileList.append(urlList.at(i).toLocalFile());
        fileList = ToolKit::getFilesExist(fileList);   ///
        if(!fileList.empty())
            viewer->openFiles(fileList);
    }

    event->acceptProposedAction();
}
开发者ID:404neko,项目名称:ezviewer-1,代码行数:15,代码来源:mainwindow.cpp

示例3: FindNode

QDomNode SOAPClient::FindNode( QStringList &sParts, QDomNode &curNode )
{
    if (sParts.empty())
        return curNode;

    QString sName = sParts.front();
    sParts.pop_front();

    QDomNode child = curNode.namedItem( sName );

    if (child.isNull() )
        sParts.clear();

    return FindNode( sParts, child );
}
开发者ID:microe,项目名称:mythtv,代码行数:15,代码来源:soapclient.cpp

示例4: initializeDatabase

void Database::initializeDatabase() throw (TimesheetProcessorException )
{
        try {
                QStringList tables = m_storage.database().tables();
                if ( !tables.empty() ) {
                        throw TimesheetProcessorException( "The database is not empty. Only "
                                "empty databases can be automatically initialized." );
                }
                if ( !m_storage.createDatabaseTables() ) {
                        throw TimesheetProcessorException( "Cannot create database contents, please double-check permissions." );
                }
        } catch ( UnsupportedDatabaseVersionException& e ) {
                throw TimesheetProcessorException( e.what() );
        }
}
开发者ID:jktjkt,项目名称:Charm,代码行数:15,代码来源:Database.cpp

示例5: CheckTables

/** \fn DBUtil::CheckTables(const bool repair, const QString options)
 *  \brief Checks database tables
 *
 *   This function will check database tables.
 *
 *  \param repair Repair any tables whose status is not OK
 *  \param options Options to be passed to CHECK TABLE; defaults to QUICK
 *  \return false if any tables have status other than OK; if repair is true,
 *          returns true if those tables were repaired successfully
 *  \sa DBUtil::RepairTables(const QStringList)
 */
bool DBUtil::CheckTables(const bool repair, const QString options)
{
    MSqlQuery query(MSqlQuery::InitCon());
    if (!query.isConnected())
        return false;

    const QStringList all_tables = GetTables(QStringList("MyISAM"));

    if (all_tables.empty())
        return true;

    QString sql = QString("CHECK TABLE %1 %2;").arg(all_tables.join(", "))
                                               .arg(options);

    LOG(VB_GENERAL, LOG_CRIT, "Checking database tables.");
    if (!query.exec(sql))
    {
        MythDB::DBError("DBUtil Checking Tables", query);
        return false;
    }

    QStringList tables = CheckRepairStatus(query);
    bool result = true;
    if (!tables.empty())
    {
        LOG(VB_GENERAL, LOG_CRIT, QString("Found crashed database table(s): %1")
                                      .arg(tables.join(", ")));
        if (repair == true)
            // If RepairTables() repairs the crashed tables, return true
            result = RepairTables(tables);
        else
            result = false;
    }

    return result;
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:47,代码来源:dbutil.cpp

示例6: installFiles

void CModListView::installFiles(QStringList files)
{
	QStringList mods;

	// TODO: some better way to separate zip's with mods and downloaded repository files
	for (QString filename : files)
	{
		if (filename.contains(".zip"))
			mods.push_back(filename);
		if (filename.contains(".json"))
			manager->loadRepository(filename);
	}
	if (!mods.empty())
		installMods(mods);
}
开发者ID:andrew889,项目名称:vcmi,代码行数:15,代码来源:cmodlistview_moc.cpp

示例7: parse

void ApplicationSettings::parse(QStringList cargs, int& argc, char** argv)
{
  QCommandLineParser parser;
  parser.setApplicationDescription(QObject::tr(
      "score - An interactive sequencer for the intermedia arts."));
  parser.addHelpOption();
  parser.addVersionOption();
  parser.addPositionalArgument(
      "file", QCoreApplication::translate("main", "Scenario to load."));

  QCommandLineOption noGUI(
      "no-gui", QCoreApplication::translate("main", "Disable GUI"));
  parser.addOption(noGUI);
  QCommandLineOption noRestore(
      "no-restore",
      QCoreApplication::translate("main", "Disable auto-restore"));
  parser.addOption(noRestore);

  QCommandLineOption autoplayOpt(
      "autoplay",
      QCoreApplication::translate("main", "Auto-play the loaded scenario"));
  parser.addOption(autoplayOpt);

  if (cargs.contains("--help") || cargs.contains("--version"))
  {
    QCoreApplication app(argc, argv);
    setQApplicationMetadata();
    parser.process(cargs);
    exit(0);
  }
  else
  {
    parser.process(cargs);
  }

  const QStringList args = parser.positionalArguments();

  tryToRestore = !parser.isSet(noRestore);
  gui = !parser.isSet(noGUI);
  if (!gui)
    tryToRestore = false;
  autoplay = parser.isSet(autoplayOpt) && args.size() == 1;

  if (!args.empty() && QFile::exists(args[0]))
  {
    loadList.push_back(args[0]);
  }
}
开发者ID:OSSIA,项目名称:Score,代码行数:48,代码来源:ApplicationSettings.cpp

示例8: GetBookmark

uint64_t MythDVDPlayer::GetBookmark(void)
{
    if (gCoreContext->IsDatabaseIgnored() || !player_ctx->buffer->IsDVD())
        return 0;

    QStringList dvdbookmark = QStringList();
    QString name;
    QString serialid;
    uint64_t frames = 0;
    player_ctx->LockPlayingInfo(__FILE__, __LINE__);
    if (player_ctx->playingInfo)
    {
        if (!player_ctx->buffer->DVD()->GetNameAndSerialNum(name, serialid))
        {
            player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);
            return 0;
        }

        dvdbookmark = player_ctx->playingInfo->QueryDVDBookmark(serialid);

        if (!dvdbookmark.empty())
        {
            QStringList::Iterator it = dvdbookmark.begin();

            if (dvdbookmark.count() == 1)
            {
                m_initial_dvdstate = *it;
                frames = ~0x0ULL;
                LOG(VB_PLAYBACK, LOG_INFO, LOC + "Get Bookmark: bookmark found");
            }
            else
            {
                // Legacy bookmarks
                m_initial_title = (*it).toInt();
                frames = (uint64_t)((*++it).toLongLong() & 0xffffffffLL);
                m_initial_audio_track    = (*++it).toInt();
                m_initial_subtitle_track = (*++it).toInt();
                LOG(VB_PLAYBACK, LOG_INFO, LOC +
                    QString("Get Bookmark: title %1 audiotrack %2 subtrack %3 "
                            "frame %4")
                    .arg(m_initial_title).arg(m_initial_audio_track)
                    .arg(m_initial_subtitle_track).arg(frames));
            }
        }
    }
    player_ctx->UnlockPlayingInfo(__FILE__, __LINE__);
    return frames;;
}
开发者ID:Saner2oo2,项目名称:mythtv,代码行数:48,代码来源:mythdvdplayer.cpp

示例9: displayMenu

void AbstractTableTab::displayMenu(QPoint pos) {
    QMenu menu(getTable());

    QList<QDockWidget*> dockWindows = this->getDockWindows();
    QModelIndexList selection = getTable()->selectionModel()->selectedRows();
    if (selection.count() > 0) {
        QModelIndex index = selection.at(0);
        AlterSettingsEntry entry = settingEntries.at(index.row());
        QStringList selected = entry.targetList;

        bool all = false;
        if(selected.contains(WINDOW_SELECT_ALL) || selected.empty()) all = true;

        QAction* allAction = menu.addAction(WINDOW_SELECT_ALL);
        allAction->setCheckable(true);
        allAction->setChecked(all);        

        QAction* mainAction = menu.addAction(WINDOW_TITLE_MAIN);
        mainAction->setCheckable(true);
        mainAction->setChecked(!all && selected.contains(WINDOW_TITLE_MAIN));

        for(QDockWidget* dock : dockWindows) {
            QAction *action = menu.addAction(dock->objectName());
            action->setCheckable(true);
            action->setChecked(!all && selected.contains(dock->objectName()));
        }

        menu.addSeparator();

        QAction* enabled = menu.addAction("Enabled");
        enabled->setCheckable(true);
        enabled->setChecked(entry.enabled);

        pos.rx()--; pos.ry()--;
        QAction *a = menu.exec(getTable()->viewport()->mapToGlobal(pos));
        if(a != NULL) {
            if(a->text() == "Enabled") {
                entry.enabled = a->isChecked();
            } else if(a->isChecked()) {
                entry.targetList.append(a->text());                
            } else {
                entry.targetList.removeAll(a->text());
            }
            settingEntries.replace(index.row(), entry);
            this->registerChange(index.row(), TableChangeEvent::Update);
        }
    }
}
开发者ID:matoom,项目名称:frostbite,代码行数:48,代码来源:abstracttabletab.cpp

示例10: make_tuple

static QGpgMEKeyListJob::result_type list_keys(Context *ctx, QStringList pats, bool secretOnly)
{
    if (pats.size() < 2) {
        std::vector<Key> keys;
        const KeyListResult r = do_list_keys(ctx, pats, keys, secretOnly);
        return std::make_tuple(r, keys, QString(), Error());
    }

    // The communication channel between gpgme and gpgsm is limited in
    // the number of patterns that can be transported, but they won't
    // say to how much, so we need to find out ourselves if we get a
    // LINE_TOO_LONG error back...

    // We could of course just feed them single patterns, and that would
    // probably be easier, but the performance penalty would currently
    // be noticeable.

    unsigned int chunkSize = pats.size();
retry:
    std::vector<Key> keys;
    keys.reserve(pats.size());
    KeyListResult result;
    do {
        const KeyListResult this_result = do_list_keys(ctx, pats.mid(0, chunkSize), keys, secretOnly);
        if (this_result.error().code() == GPG_ERR_LINE_TOO_LONG) {
            // got LINE_TOO_LONG, try a smaller chunksize:
            chunkSize /= 2;
            if (chunkSize < 1)
                // chunks smaller than one can't be -> return the error.
            {
                return std::make_tuple(this_result, keys, QString(), Error());
            } else {
                goto retry;
            }
        } else if (this_result.error().code() == GPG_ERR_EOF) {
            // early end of keylisting (can happen when ~/.gnupg doesn't
            // exist). Fakeing an empty result:
            return std::make_tuple(KeyListResult(), std::vector<Key>(), QString(), Error());
        }
        // ok, that seemed to work...
        result.mergeWith(this_result);
        if (result.error().code()) {
            break;
        }
        pats = pats.mid(chunkSize);
    } while (!pats.empty());
    return std::make_tuple(result, keys, QString(), Error());
}
开发者ID:gpg,项目名称:gpgme,代码行数:48,代码来源:qgpgmekeylistjob.cpp

示例11: setContactIcon

void ContactWidgetItem::setContactIcon()
{

    if (m_addressee->photo().isEmpty()) {

        m_icon->setIcon(KIcon("user-identity"));

    } else {

        QPixmap pixmap;

        pixmap.convertFromImage(m_addressee->photo().data());

        m_icon->setIcon(KIcon(QIcon(pixmap)));

    }

    if (m_addressee->formattedName().isEmpty() && m_addressee->name().isEmpty()) {

        QStringList emails = m_addressee->emails();

        if (!emails.empty()) {

            m_icon->setText(emails.first());

        } else {

            m_icon->setText(i18n("Contact without name"));

        }

    } else {

        if (!m_addressee->formattedName().isEmpty()) {

            m_icon->setText(m_addressee->formattedName());

        }

        else {

            m_icon->setText(m_addressee->name());

        }

    }

}
开发者ID:kyriakosbrastianos,项目名称:akonadi-google-plasmoids,代码行数:48,代码来源:contactwidgetitem.cpp

示例12: copyTorrentURLs

void SearchJobWidget::copyTorrentURLs()
{
    const QModelIndexList rows {m_ui->resultsBrowser->selectionModel()->selectedRows()};
    QStringList urls;
    for (const QModelIndex &rowIndex : rows) {
        const QString descrLink = m_proxyModel->data(
                    m_proxyModel->index(rowIndex.row(), SearchSortModel::DESC_LINK)).toString();
        if (!descrLink.isEmpty())
            urls << descrLink;
    }

    if (!urls.empty()) {
        QClipboard *clipboard = QApplication::clipboard();
        clipboard->setText(urls.join('\n'));
    }
}
开发者ID:elFarto,项目名称:qBittorrent,代码行数:16,代码来源:searchjobwidget.cpp

示例13: fontFromFile

QFont FontHelper::fontFromFile(const QString &fontFile) {
    QFont font;
    int fontId;
    QStringList loadedFontFamilies;

    fontId = QFontDatabase::addApplicationFont(fontFile);
    loadedFontFamilies = QFontDatabase::applicationFontFamilies(fontId);

    if(!loadedFontFamilies.empty()) {
        font = loadedFontFamilies.at(0);
    }

    font.setStyleStrategy(QFont::PreferAntialias);

    return font;
}
开发者ID:filesdnd,项目名称:filesdnd-qt,代码行数:16,代码来源:fonthelper.cpp

示例14: setArguments

void FileBackend::setArguments(const QStringList& arguments)
{
	status = Status::Loading;
	emit statusChanged();
	this->files.clear();
	if (!arguments.empty()) {
		QFileInfo info(arguments.at(0));
		reader.setFileName(info.absoluteFilePath());
		if (info.exists() && info.isFile() && reader.canRead()) {
			this->initFromSingleFile(info);
		}
	}
	status = (this->getCurrentFile() != nullptr) ? Status::Ready : Status::Empty;
	emit statusChanged();
	emit currentFileChanged();
}
开发者ID:Bluelich,项目名称:skadi,代码行数:16,代码来源:filebackend.cpp

示例15: choose_save_file

void MainWindow::choose_save_file(){
    QStringList filenames;
    QFileDialog dialog(this);
    dialog.setDirectory(ui->line_outputFile->text());
    dialog.setFileMode(QFileDialog::AnyFile);
    dialog.setViewMode(QFileDialog::Detail);
    dialog.setNameFilter(tr("ROOT Files (*.root)"));
    if(dialog.exec()){
        filenames = dialog.selectedFiles();
    }

    if(!filenames.empty()){
        ui->line_outputFile->setText(filenames.first());
        outputFilename = filenames.first();
    }
}
开发者ID:victoriablackmore,项目名称:Extract-MAUS-data,代码行数:16,代码来源:mainwindow.cpp


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