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


C++ rowCount函数代码示例

本文整理汇总了C++中rowCount函数的典型用法代码示例。如果您正苦于以下问题:C++ rowCount函数的具体用法?C++ rowCount怎么用?C++ rowCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: insertRow

bool SignalListAdapter<QString>::pushRow()
{
    return insertRow(rowCount());
}
开发者ID:rom1504,项目名称:SignalList,代码行数:4,代码来源:qstringsignallistadapter.cpp

示例2: removeRows

void ColumnEditorModel::clear(void)
{
	removeRows(0, rowCount());
}
开发者ID:skeetor,项目名称:datinator,代码行数:4,代码来源:column_editor_model.cpp

示例3: dataChanged

void RowToListProxyModel::setRow(int i) {
	_row = i;
	emit dataChanged(index(0,0), index(rowCount() -1, 0));
}
开发者ID:DrKylstein,项目名称:Tileset-Tool,代码行数:4,代码来源:RowToListProxyModel.cpp

示例4: extraData

QVariant SubmitFileModel::extraData(int row) const
{
    if (row < 0 || row >= rowCount())
        return false;
    return item(row)->data();
}
开发者ID:ntrincano,项目名称:qt-creator,代码行数:6,代码来源:submitfilemodel.cpp

示例5: beginInsertRows

void WordRibbon::appendCandidate(const WordCandidate &candidate)
{
    beginInsertRows(QModelIndex(), rowCount(), rowCount());
    m_candidates.append(candidate);
    endInsertRows(); // fires signal rowsInserted()
}
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:6,代码来源:wordribbon.cpp

示例6: isCheckable

bool SubmitFileModel::isCheckable(int row) const
{
    if (row < 0 || row >= rowCount())
        return false;
    return item(row)->isCheckable();
}
开发者ID:ntrincano,项目名称:qt-creator,代码行数:6,代码来源:submitfilemodel.cpp

示例7: setChecked

void SubmitFileModel::setChecked(int row, bool check)
{
    if (row >= 0 || row < rowCount())
        item(row)->setCheckState(check ? Qt::Checked : Qt::Unchecked);
}
开发者ID:ntrincano,项目名称:qt-creator,代码行数:5,代码来源:submitfilemodel.cpp

示例8: rowCount

QVariant KPrShapeAnimations::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || index.column() < 0 ||
            index.column() >= COLUMN_COUNT || index.row() < 0
            || index.row() >= rowCount(QModelIndex())) {
        return QVariant();
    }

    // Read Data
    KPrShapeAnimation::NodeType nodeType;
    int currentGroup = -1;
    KPrShapeAnimation *thisAnimation = animationByRow(index.row(), &currentGroup, &nodeType);
    if (!thisAnimation) {
        return QVariant();
    }

    if (role == Qt::DisplayRole || role == Qt::EditRole) {
        switch (index.column()) {
            case Group: return currentGroup;
            case StepCount:
                if (nodeType == KPrShapeAnimation::OnClick) {
                    return currentGroup;
                }
                else {
                    return QVariant();
                }
            case TriggerEvent: return QVariant();
            case Name: return getAnimationName(thisAnimation);
            case ShapeThumbnail: return QVariant();
            case AnimationIcon: return QVariant();
            case StartTime: return thisAnimation->timeRange().first;
            case Duration: return thisAnimation->globalDuration();
            case AnimationClass: return thisAnimation->presetClass();
            case NodeType: return nodeType;
            default: Q_ASSERT(false);
        }
    }
    if (role == Qt::TextAlignmentRole) {
        if (index.column() == Name) {
            return static_cast<int>(Qt::AlignLeft|Qt::AlignVCenter);
        }
        return static_cast<int>(Qt::AlignCenter);
    }
    if (role == Qt::DecorationRole) {
        switch (index.column()) {
            case Group: return QVariant();
            case StepCount: return QVariant();
            case TriggerEvent:
                if (nodeType == KPrShapeAnimation::OnClick)
                    return koIcon("onclick");
                if (nodeType == KPrShapeAnimation::AfterPrevious)
                    return koIcon("after_previous");
                if (nodeType == KPrShapeAnimation::WithPrevious)
                    return koIcon("with_previous");
            case Name: return QVariant();
            case ShapeThumbnail: return getAnimationShapeThumbnail(thisAnimation);
            case AnimationIcon:  return getAnimationIcon(thisAnimation);
            case StartTime: return QVariant();
            case Duration: return QVariant();
            case AnimationClass: return QVariant();
            case NodeType: return QVariant();
            default: Q_ASSERT(false);
        }
    }
    if (role == Qt::SizeHintRole) {
        switch (index.column()) {
            case Group:
            case StepCount: return QVariant();
            case TriggerEvent: return QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
            case Name: return QVariant();
            case ShapeThumbnail: return QSize(KIconLoader::SizeMedium, KIconLoader::SizeMedium);
            case AnimationIcon:
            case StartTime:
            case Duration:
            case AnimationClass: return QVariant();
            case NodeType: return QVariant();
            default: Q_ASSERT(false);
        }
    }
    if (role == Qt::ToolTipRole) {
            switch (index.column()) {
            case Group:
            case StepCount: return QVariant();
            case TriggerEvent:/// emitted if an item time range has changed (return the index of the item changed)
                if (nodeType == KPrShapeAnimation::OnClick)
                    return i18n("start on mouse click");
                if (nodeType == KPrShapeAnimation::AfterPrevious)
                    return i18n("start after previous animation");
                if (nodeType == KPrShapeAnimation::WithPrevious)
                    return i18n("start with previous animation");
            case Name: return QVariant();
            case ShapeThumbnail: return thisAnimation->shape()->name();
            case AnimationIcon: return getAnimationName(thisAnimation);
            case StartTime: {
                const float startDelay = thisAnimation->timeRange().first / 1000.0;
                const float duration = thisAnimation->globalDuration() / 1000.0;
                return i18n("Start after %1 seconds. Duration of %2 seconds.", startDelay, duration);
            }
            case Duration: return QVariant();
            case AnimationClass: return thisAnimation->presetClassText();
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:calligra,代码行数:101,代码来源:KPrShapeAnimations.cpp

示例9: data

QVariant EmailMessageListModel::data(const QModelIndex & index, int role) const {
    if (!index.isValid() || index.row() > rowCount(parent(index))) {
        qWarning() << Q_FUNC_INFO << "Invalid Index";
        return QVariant();
    }

    if (role == MessageSortByRole) {
        return m_sortBy;
    }

    QMailMessageId msgId = idFromIndex(index);

    if (role == QMailMessageModelBase::MessageBodyTextRole) {
        QMailMessage message (msgId);
        return EmailAgent::instance()->bodyPlainText(message);
    }
    else if (role == MessageHtmlBodyRole) {
        QMailMessage message (msgId);
        return bodyHtmlText(message);
    }
    else if (role == MessageQuotedBodyRole) {
        QMailMessage message (msgId);
        QString body = EmailAgent::instance()->bodyPlainText(message);
        body.prepend('\n');
        body.replace('\n', "\n>");
        body.truncate(body.size() - 1);  // remove the extra ">" put there by QString.replace
        return body;
    }
    else if (role == MessageIdRole) {
        return msgId.toULongLong();
    }
    else if (role == MessageToRole) {
        QMailMessage message (msgId);
        return QMailAddress::toStringList(message.to());
    }
    else if (role == MessageCcRole) {
        QMailMessage message (msgId);
        return QMailAddress::toStringList(message.cc());
    }
    else if (role == MessageBccRole) {
        QMailMessage message (msgId);
        return QMailAddress::toStringList(message.bcc());
    }
    else if (role == MessageSelectModeRole) {
       int selected = 0;
       if (m_selectedMsgIds.contains(msgId) == true)
           selected = 1;
        return (selected);
    }

    QMailMessageMetaData messageMetaData(msgId);

    if (role == QMailMessageModelBase::MessageTimeStampTextRole) {
        QDateTime timeStamp = messageMetaData.date().toLocalTime();
        return (timeStamp.toString("hh:mm MM/dd/yyyy"));
    }
    else if (role == MessageAttachmentCountRole) {
        // return number of attachments
        if (!messageMetaData.status() & QMailMessageMetaData::HasAttachments)
            return 0;

        QMailMessage message(msgId);
        const QList<QMailMessagePart::Location> &attachmentLocations = message.findAttachmentLocations();
        return attachmentLocations.count();
    }
    else if (role == MessageAttachmentsRole) {
        // return a stringlist of attachments
        if (!messageMetaData.status() & QMailMessageMetaData::HasAttachments)
            return QStringList();

        QMailMessage message(msgId);
        QStringList attachments;
        foreach (const QMailMessagePart::Location &location, message.findAttachmentLocations()) {
            const QMailMessagePart &attachmentPart = message.partAt(location);
            attachments << attachmentPart.displayName();
        }
        return attachments;
    }
    else if (role == MessageRecipientsRole) {
开发者ID:kananoja,项目名称:nemo-qml-plugin-email,代码行数:79,代码来源:emailmessagelistmodel.cpp

示例10: dataChanged

void ConnectionModel::updateAll()
{
    emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:4,代码来源:signalsloteditorwindow.cpp

示例11: rowCount

int TestList::count() const {
    return rowCount(QModelIndex());
}
开发者ID:Geymerson,项目名称:studyAssistant,代码行数:3,代码来源:testlist.cpp

示例12: Q_UNUSED

int QtRegistersModel::rowCount(const QModelIndex& aParent) const
 {
     Q_UNUSED(aParent);
     return rowCount();
 }
开发者ID:BigEd,项目名称:wp34s,代码行数:5,代码来源:QtRegistersModel.cpp

示例13: switch

int EntryModel::createItems(int offset, int limit)
{
    QList<DatabaseManager::Entry> list;

    Settings *s = Settings::instance();

    bool ascOrder = s->getShowOldestFirst();

    // Counting 'last' & 'daterow' rows
    if (offset > 0) {
        int dummyRowsCount = 0;
        int l = this->rowCount();
        //qDebug() << "this->rowCount():" << l;
        for (int i = 0; i < l; ++i) {
            EntryItem* item = static_cast<EntryItem*>(readRow(i));
            //qDebug() << item->id();
            if (item->id()=="last" || item->id()=="daterow") {
                ++dummyRowsCount;
            }
        }
        //qDebug() << "dummyRowsCount:" << dummyRowsCount << "orig offset:" << offset;
        if (offset > dummyRowsCount)
            offset = offset - dummyRowsCount;
    }

    int mode = s->getViewMode();
    switch (mode) {
    case 0:
        // View mode: Tabs->Feeds->Entries
        if (s->getShowOnlyUnread())
            list = _db->readEntriesUnreadByStream(_feedId,offset,limit,ascOrder);
        else
            list = _db->readEntriesByStream(_feedId,offset,limit,ascOrder);
        break;
    case 1:
        // View mode: Tabs->Entries
        if (s->getShowOnlyUnread())
            list = _db->readEntriesUnreadByTab(_feedId,offset,limit,ascOrder);
        else
            list = _db->readEntriesByTab(_feedId,offset,limit,ascOrder);
        break;
    case 2:
        // View mode: Feeds->Entries
        if (s->getShowOnlyUnread())
            list = _db->readEntriesUnreadByStream(_feedId,offset,limit,ascOrder);
        else
            list = _db->readEntriesByStream(_feedId,offset,limit,ascOrder);
        break;
    case 3:
        // View mode: Entries
        if (s->getShowOnlyUnread())
            list = _db->readEntriesUnreadByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        else
            list = _db->readEntriesByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        break;
    case 4:
        // View mode: Saved
        list = _db->readEntriesSavedByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        break;
    case 5:
        // View mode: Slow
        if (s->getShowOnlyUnread())
            list = _db->readEntriesSlowUnreadByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        else
            list = _db->readEntriesSlowByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        break;
    case 6:
        // View mode: Liked
        list = _db->readEntriesLikedByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        break;
    case 7:
        // View mode: Broadcast
        list = _db->readEntriesBroadcastByDashboard(s->getDashboardInUse(),offset,limit,ascOrder);
        break;
    }

    //qDebug() << "limit:" << limit << "Row count:" << list.count() << "new offset:" << offset;

    // Remove dummy row
    if (list.count()>0) {
        int l = rowCount();
        if (l>0) {
            EntryItem* item = dynamic_cast<EntryItem*>(readRow(l-1));
            //qDebug() << "item->id()" << item->id() << "l" << l;
            if (item->id()=="last")
                removeRow(l-1);
        }
    }

    QList<DatabaseManager::Entry>::iterator i = list.begin();

    int prevDateRow = 0;
    if (rowCount()>0) {
        EntryItem* item = dynamic_cast<EntryItem*>(readRow(rowCount()-1));
        prevDateRow = getDateRowId(item->date());
        //qDebug() << "prevDateRow UID:" << item->uid();
    }

    QRegExp re("<[^>]*>");
    while( i != list.end() ) {
//.........这里部分代码省略.........
开发者ID:icaruseffect,项目名称:kaktus,代码行数:101,代码来源:entrymodel.cpp

示例14: data

	QVariant ItemsListModel::data (const QModelIndex& index, int role) const
	{
		if (!index.isValid () || index.row () >= rowCount ())
			return QVariant ();

		if (role == Qt::DisplayRole)
		{
			switch (index.column ())
			{
				case 0:
					{
						auto title = CurrentItems_ [index.row ()].Title_;
						auto pos = 0;
						while ((pos = title.indexOf ('<', pos)) != -1)
						{
							auto end = title.indexOf ('>', pos);
							if (end > 0)
								title.remove (pos, end - pos + 1);
							else
								break;
						}

						title.replace ("&laquo;", QString::fromUtf8 ("«"));
						title.replace ("&raquo;", QString::fromUtf8 ("»"));
						title.replace ("&quot;", "\"");
						title.replace ("&ndash;", "-");
						title.replace ("&mdash;", QString::fromUtf8 ("—"));

						return title;
					}
				case 1:
					return CurrentItems_ [index.row ()].PubDate_;
				default:
					return QVariant ();
			}
		}
		//Color mark an items as read/unread
		else if (role == Qt::ForegroundRole)
		{
			bool palette = XmlSettingsManager::Instance ()->
					property ("UsePaletteColors").toBool ();
			if (CurrentItems_ [index.row ()].Unread_)
			{
				if (XmlSettingsManager::Instance ()->
						property ("UnreadCustomColor").toBool ())
					return XmlSettingsManager::Instance ()->
							property ("UnreadItemsColor").value<QColor> ();
				else
					return palette ?
						QApplication::palette ().link ().color () :
						QVariant ();
			}
			else
				return palette ?
					QApplication::palette ().linkVisited ().color () :
					QVariant ();
		}
		else if (role == Qt::FontRole &&
				CurrentItems_ [index.row ()].Unread_)
			return XmlSettingsManager::Instance ()->
				property ("UnreadItemsFont");
		else if (role == Qt::ToolTipRole &&
				XmlSettingsManager::Instance ()->property ("ShowItemsTooltips").toBool ())
		{
			IDType_t id = CurrentItems_ [index.row ()].ItemID_;
			Item_ptr item = Core::Instance ()
					.GetStorageBackend ()->GetItem (id);
			QString result = QString ("<qt><strong>%1</strong><br />").arg (item->Title_);
			if (item->Author_.size ())
			{
				result += tr ("<b>Author</b>: %1").arg (item->Author_);
				result += "<br />";
			}
			if (item->Categories_.size ())
			{
				result += tr ("<b>Categories</b>: %1").arg (item->Categories_.join ("; "));
				result += "<br />";
			}
			if (item->NumComments_ > 0)
			{
				result += tr ("%n comment(s)", "", item->NumComments_);
				result += "<br />";
			}
			if (item->Enclosures_.size () > 0)
			{
				result += tr ("%n enclosure(s)", "", item->Enclosures_.size ());
				result += "<br />";
			}
			if (item->MRSSEntries_.size () > 0)
			{
				result += tr ("%n MediaRSS entry(s)", "", item->MRSSEntries_.size ());
				result += "<br />";
			}
			if (item->CommentsLink_.size ())
			{
				result += tr ("RSS with comments is available");
				result += "<br />";
			}
			result += "<br />";

//.........这里部分代码省略.........
开发者ID:ttldtor,项目名称:leechcraft,代码行数:101,代码来源:itemslistmodel.cpp

示例15: removeRow

        if (!filter.contains(file(r))) {
            removeRow(r);
            rc++;
        }
    return rc;
}

/*! Updates user selections from \a source model.
 *
 *  Assumes that both models are sorted with the same order, and there
 *              are no duplicate entries.
 */
void SubmitFileModel::updateSelections(SubmitFileModel *source)
{
    QTC_ASSERT(source, return);
    int rows = rowCount();
    int sourceRows = source->rowCount();
    int lastMatched = 0;
    for (int i = 0; i < rows; ++i) {
        // Since both models are sorted with the same order, there is no need
        // to test rows earlier than latest match found
        for (int j = lastMatched; j < sourceRows; ++j) {
            if (file(i) == source->file(j) && state(i) == source->state(j)) {
                if (isCheckable(i) && source->isCheckable(j))
                    setChecked(i, source->checked(j));
                lastMatched = j + 1; // No duplicates, start on next entry
                break;
            }
        }
    }
}
开发者ID:ntrincano,项目名称:qt-creator,代码行数:31,代码来源:submitfilemodel.cpp


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