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


C++ QList::mid方法代码示例

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


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

示例1: setSizes

void HistoryMessagesTab::setSizes(const QList<int> &newSizes)
{
    Q_ASSERT(newSizes.size() == 4);

    Splitter->setSizes(newSizes.mid(0, 2));
    TimelineView->setSizes(newSizes.mid(2, 2));
}
开发者ID:vogel,项目名称:kadu,代码行数:7,代码来源:history-messages-tab.cpp

示例2: sizes

void tst_QColumnView::sizes()
{
    QColumnView view;
    QCOMPARE(view.columnWidths().count(), 0);

    QList<int> newSizes;
    newSizes << 10 << 4 << 50 << 6;

    QList<int> visibleSizes;
    view.setColumnWidths(newSizes);
    QCOMPARE(view.columnWidths(), visibleSizes);

    QDirModel model;
    view.setModel(&model);
    QModelIndex home = model.index(QDir::homePath());
    view.setCurrentIndex(home);

    QList<int> postSizes = view.columnWidths().mid(0, newSizes.count());
    QCOMPARE(postSizes, newSizes.mid(0, postSizes.count()));

    QVERIFY(view.columnWidths().count() > 1);
    QList<int> smallerSizes;
    smallerSizes << 6;
    view.setColumnWidths(smallerSizes);
    QList<int> expectedSizes = newSizes;
    expectedSizes[0] = 6;
    postSizes = view.columnWidths().mid(0, newSizes.count());
    QCOMPARE(postSizes, expectedSizes.mid(0, postSizes.count()));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:29,代码来源:tst_qcolumnview.cpp

示例3: update

void Generator::update()
{
	m_error.clear();

	LanguageSettings settings("Current");
	m_dictionary_url = settings.dictionary();

	// Load dice
	QString dice_path = settings.dice();
	if (dice_path != m_dice_path) {
		m_dice_path.clear();
		m_dice.clear();
		m_dice_large.clear();

		QList<QStringList> dice;
		QFile file(dice_path);
		if (file.open(QFile::ReadOnly | QIODevice::Text)) {
			QTextStream stream(&file);
			stream.setCodec("UTF-8");
			while (!stream.atEnd()) {
				QStringList line = stream.readLine().split(',', QString::SkipEmptyParts);
				if (line.count() == 6) {
					dice.append(line);
				}
			}
			file.close();
		}

		if (dice.count() == 41) {
			m_dice_path = dice_path;
			m_dice = dice.mid(0, 16);
			m_dice_large = dice.mid(16);
		} else {
			m_dice = m_dice_large = QList<QStringList>() << QStringList("?");
			return setError(tr("Unable to read dice from file."));
		}
	}

	// Load words
	QString words_path = settings.words();
	if (words_path != m_words_path) {
		m_words_path.clear();
		m_words.clear();
		int count = 0;

		// Load cached words
		QString cache_dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/cache";
		QString cache_file = QCryptographicHash::hash(words_path.toUtf8(), QCryptographicHash::Sha1).toHex();
		QFileInfo cache_info(cache_dir + "/" + cache_file);
		if (cache_info.exists() && (cache_info.lastModified() > QFileInfo(words_path).lastModified())) {
			QFile file(cache_info.absoluteFilePath());
			if (file.open(QFile::ReadOnly)) {
				QDataStream stream(&file);
				quint32 magic, version;
				stream >> magic >> version;
				if ((magic == 0x54524945) && (version == 1)) {
					stream.setVersion(QDataStream::Qt_4_6);
					stream >> m_words;
					count = !m_words.isEmpty() * -1;
				}
开发者ID:gottcode,项目名称:tanglet,代码行数:60,代码来源:generator.cpp

示例4: Simplified

static TemplateList Simplified(const TemplateList &templates)
{
    TemplateList simplified;
    foreach (const Template &t, templates) {
        if (t.isEmpty()) {
            if (!t.file.getBool("enrollAll"))
                simplified.append(t);
            continue;
        }

        const bool fte = t.file.getBool("FTE");
        QList<QPointF> landmarks = t.file.landmarks();
        QList<QRectF> ROIs = t.file.ROIs();
        if (landmarks.size() % t.size() != 0) qFatal("TemplateList::simplified uneven landmark count.");
        if (ROIs.size() % t.size() != 0) qFatal("TemplateList::simplified uneven ROI count.");
        const int landmarkStep = landmarks.size() / t.size();
        const int ROIStep = ROIs.size() / t.size();

        for (int i=0; i<t.size(); i++) {
            if (!fte || !t.file.getBool("enrollAll")) {
                simplified.append(Template(t.file, t[i]));
                simplified.last().file.setROIs(ROIs.mid(i*ROIStep, ROIStep));
                simplified.last().file.setLandmarks(landmarks.mid(i*landmarkStep, landmarkStep));
            }
        }
    }
    return simplified;
}
开发者ID:caotto,项目名称:openbr,代码行数:28,代码来源:meta.cpp

示例5: updataData

void widgetTest::updataData(QList<qint16> listData)
{
    //0-400 X
    XWidget->updateDate(listData.mid(0,WAVE_LENGHT_VALUE));
    //400-800 Y
    YWidget->updateDate(listData.mid(WAVE_LENGHT_VALUE-1,WAVE_LENGHT_VALUE));
    //800-1200 X'
    XxWidget->updateDate(listData.mid(2*WAVE_LENGHT_VALUE-1,WAVE_LENGHT_VALUE));
    //1200-1600 Y'
    YyWidget->updateDate(listData.mid(3*WAVE_LENGHT_VALUE-1,WAVE_LENGHT_VALUE));
}
开发者ID:helloqt,项目名称:xiong_and_wang,代码行数:11,代码来源:widgettest.cpp

示例6: onSearchMovieFinished

/**
 * @brief Called when the search result was downloaded
 *        Emits "sigSearchDone" if there are no more pages in the result set
 * @param results List of results from scraper
 * @see TMDb::parseSearch
 */
void FanartTv::onSearchMovieFinished(QList<ScraperSearchResult> results)
{
    if (m_searchResultLimit == 0)
        emit sigSearchDone(results);
    else
        emit sigSearchDone(results.mid(0, m_searchResultLimit));
}
开发者ID:hathagat,项目名称:MediaElch,代码行数:13,代码来源:FanartTv.cpp

示例7: Match

QList<Team> FourMatchesContest::teamsAvailableToPlayAgainst(const Team& team, const QList<Team> &teamsToPlayAgainst )
{
  QList<Team> ret = teamsToPlayAgainst.mid( 1 );

    for( int i = 0; i < ret.size(); ++i ) {
        Team currentTeam = ret.at( i );
        if( currentTeam == team ) continue;

        bool alreadyExists = false;
        if ( mFirstPhase != NULL ) {
          alreadyExists |= mFirstPhase->exists( Match( team, currentTeam ) )
                          || mFirstPhase->exists( Match( currentTeam, team ) );
        }
        if ( mSecondPhase != NULL ) {
          alreadyExists |= mSecondPhase->exists( Match( team, currentTeam ) )
                          || mSecondPhase->exists( Match( currentTeam, team ) );
        }
        if ( mThirdPhase != NULL ) {
          alreadyExists |= mThirdPhase->exists( Match( team, currentTeam ) )
                          || mThirdPhase->exists( Match( currentTeam, team ) );
        }
        if ( mFourthPhase != NULL ) {
          alreadyExists |= mFourthPhase->exists( Match( team, currentTeam ) )
                          || mFourthPhase->exists( Match( currentTeam, team ) );
        }

        if ( alreadyExists ) {
          ret.removeAt( i );
          --i;
        }
    }
    return ret;
}
开发者ID:Mathsoum,项目名称:Petanque,代码行数:33,代码来源:fourmatchescontest.cpp

示例8: onSearchTvShowFinished

/**
 * @brief TheTvDbImages::onSearchTvShowFinished
 * @param results Result list
 */
void TheTvDbImages::onSearchTvShowFinished(QList<ScraperSearchResult> results)
{
    if (m_searchResultLimit == 0)
        emit sigSearchDone(results);
    else
        emit sigSearchDone(results.mid(0, m_searchResultLimit));
}
开发者ID:dhead666,项目名称:MediaElch,代码行数:11,代码来源:TheTvDbImages.cpp

示例9: insertGap

bool QToolBarAreaLayout::insertGap(const QList<int> &path, QLayoutItem *item)
{
    Q_ASSERT(path.count() == 3);
    const int i = path.first();
    Q_ASSERT(i >= 0 && i < QInternal::DockCount);
    return docks[i].insertGap(path.mid(1), item);
}
开发者ID:2011fuzhou,项目名称:vlc-2.1.0.subproject-2010,代码行数:7,代码来源:qtoolbararealayout.cpp

示例10: resultsAction

void SearchController::resultsAction()
{
    checkParams({"id"});

    const int id = params()["id"].toInt();
    int limit = params()["limit"].toInt();
    int offset = params()["offset"].toInt();

    const auto searchHandlers = sessionManager()->session()->getData<SearchHandlerDict>(SEARCH_HANDLERS);
    if (!searchHandlers.contains(id))
        throw APIError(APIErrorType::NotFound);

    const SearchHandlerPtr searchHandler = searchHandlers[id];
    const QList<SearchResult> searchResults = searchHandler->results();
    const int size = searchResults.size();

    if (offset > size)
        throw APIError(APIErrorType::Conflict, tr("Offset is out of range"));

    // normalize values
    if (offset < 0)
        offset = size + offset;
    if (offset < 0)  // check again
        throw APIError(APIErrorType::Conflict, tr("Offset is out of range"));
    if (limit <= 0)
        limit = -1;

    if ((limit > 0) || (offset > 0))
        setResult(getResults(searchResults.mid(offset, limit), searchHandler->isActive(), size));
    else
        setResult(getResults(searchResults, searchHandler->isActive(), size));
}
开发者ID:elFarto,项目名称:qBittorrent,代码行数:32,代码来源:searchcontroller.cpp

示例11: onSearchMovieFinished

void MediaPassionImages::onSearchMovieFinished(QList<ScraperSearchResult> results)
{
    if (m_searchResultLimit == 0)
        emit sigSearchDone(results);
    else
        emit sigSearchDone(results.mid(0, m_searchResultLimit));
}
开发者ID:BlitzGLEP1326,项目名称:MediaElch,代码行数:7,代码来源:MediaPassionImages.cpp

示例12: ensureChachePopulated

QList<NoteListItem> FileStorage::noteList(int limit)
{
    ensureChachePopulated();
    QList<NoteListItem> ret = cache.values();
    qSort(ret.begin(), ret.end(), noteListItemModifyComparer);
    // probably sort is unnecesary here if the only accessor is notemanager which also does sorting.
    return limit ? ret.mid(0, limit) : ret;
}
开发者ID:Vitozz,项目名称:QtNote,代码行数:8,代码来源:filestorage.cpp

示例13: mid

void tst_QList::mid() const
{
    QList<QString> list;
    list << "foo" << "bar" << "baz" << "bak" << "buck" << "hello" << "kitty";

    QCOMPARE(list.mid(3, 3),
             QList<QString>() << "bak" << "buck" << "hello");
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:8,代码来源:tst_qlist.cpp

示例14: onSearchMovieFinished

/**
 * @brief Called when the search result was downloaded
 *        Emits "sigSearchDone" if there are no more pages in the result set
 * @param results List of results from scraper
 * @see TMDb::parseSearch
 */
void TMDbImages::onSearchMovieFinished(QList<ScraperSearchResult> results)
{
    qDebug() << "Entered";
    if (m_searchResultLimit == 0)
        emit sigSearchDone(results);
    else
        emit sigSearchDone(results.mid(0, m_searchResultLimit));
}
开发者ID:boccman,项目名称:MediaElch,代码行数:14,代码来源:TMDbImages.cpp

示例15:

void
ArtistInfoWidget::onTracksFound( const QList<Tomahawk::query_ptr>& queries, ModelMode mode )
{
    Q_UNUSED( mode );

    m_topHitsModel->finishLoading();
    m_topHitsModel->appendQueries( queries.mid( 0, 20 ) );
}
开发者ID:AltarBeastiful,项目名称:tomahawk,代码行数:8,代码来源:ArtistInfoWidget.cpp


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