• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ createIndex函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createIndex

QModelIndex DiscoItemsModel::modelIndex(DiscoItemIndex *AIndex, int AColumn) const
{
	return AIndex!=NULL && AIndex!=FRootIndex ? createIndex(AIndex->parent->childs.indexOf(AIndex),AColumn,AIndex) : QModelIndex();
}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:4,代码来源:discoitemsmodel.cpp


示例2: dataChanged

void DivePlannerPointsModel::emitDataChanged()
{
	emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
开发者ID:ro-ot,项目名称:subsurface,代码行数:4,代码来源:diveplannermodel.cpp


示例3: switch

//! [2]
QXmlNodeModelIndex QObjectXmlModel::nextFromSimpleAxis(SimpleAxis axis, const QXmlNodeModelIndex &n) const
{
    switch (toNodeType(n))
    {
        case IsQObject:
        {
            switch (axis)
            {
                case Parent:
                    return createIndex(asQObject(n)->parent());

                case FirstChild:
                {
                    if (!asQObject(n) || asQObject(n)->children().isEmpty())
                        return QXmlNodeModelIndex();
                    else
                        return createIndex(asQObject(n)->children().first());
                }
                
                case NextSibling:
                    return qObjectSibling(1, n);

//! [10]                    
                case PreviousSibling:
                {
                    if (asQObject(n) == m_root)
                        return createIndex(qint64(0), MetaObjects);
                    else
                        return qObjectSibling(-1, n);
                }
//! [10]                    
            }
            Q_ASSERT(false);
        }

//! [7]
        case QObjectClassName:
        case QObjectProperty:
        {
            Q_ASSERT(axis == Parent);
            return createIndex(asQObject(n));
        }
//! [7]
//! [2]
//! [3]

//! [11]        
        case MetaObjects:
        {
            switch (axis)
            {
                case Parent:
                    return QXmlNodeModelIndex();
                case PreviousSibling:
                    return QXmlNodeModelIndex();
                case NextSibling:
                    return root();
                case FirstChild:
                {
                    return createIndex(const_cast<QMetaObject*>(m_allMetaObjects.first()),MetaObject);
                }
            }
            Q_ASSERT(false);
        }
//! [11]        

        case MetaObject:
        {
            switch (axis)
            {
                case FirstChild:
                    return QXmlNodeModelIndex();
                case Parent:
                    return createIndex(qint64(0), MetaObjects);
                case PreviousSibling:
                    return metaObjectSibling(-1, n);
                case NextSibling:
                    return metaObjectSibling(1, n);
            }
        }

        case MetaObjectClassName:
        case MetaObjectSuperClass:
        {
            Q_ASSERT(axis == Parent);
            return createIndex(asQObject(n), MetaObject);
        }
//! [3]
//! [4]
    }

    Q_ASSERT(false);
    return QXmlNodeModelIndex();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:95,代码来源:qobjectxmlmodel.cpp


示例4: hasIndex

QModelIndex CompleterTestModel::index(int row, int column, const QModelIndex &parent) const
{
    return hasIndex(row, column, parent) ? createIndex(row, column, 0) : QModelIndex();
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:4,代码来源:ut_mcompleter.cpp


示例5: createIndex

	QModelIndex PluginManager::index (int row, int column, const QModelIndex&) const
	{
		return createIndex (row, column);
	}
开发者ID:Zereal,项目名称:leechcraft,代码行数:4,代码来源:pluginmanager.cpp


示例6: data

bool ParamModelBase::IsFreeze(size_t idx) const
{
    return data(createIndex((int)idx,FREEZE),Qt::CheckStateRole).toBool();
}
开发者ID:mattphillipsphd,项目名称:DynaSys,代码行数:4,代码来源:parammodelbase.cpp


示例7: select

/*!
    \since 5.0

    Refreshes \a row in the model with values from the database table row matching
    on primary key values. Without a primary key, all column values must match. If
    no matching row is found, the model will show an empty row.

    Returns \c true if successful; otherwise returns \c false.

    \sa select()
*/
bool QSqlTableModel::selectRow(int row)
{
    Q_D(QSqlTableModel);

    if (row < 0 || row >= rowCount())
        return false;

    const int table_sort_col = d->sortColumn;
    d->sortColumn = -1;
    const QString table_filter = d->filter;
    d->filter = d->db.driver()->sqlStatement(QSqlDriver::WhereStatement,
                                              d->tableName,
                                              primaryValues(row),
                                              false);
    static const QString wh = Sql::where() + Sql::sp();
    if (d->filter.startsWith(wh, Qt::CaseInsensitive))
        d->filter.remove(0, wh.length());

    QString stmt;

    if (!d->filter.isEmpty())
        stmt = selectStatement();

    d->sortColumn = table_sort_col;
    d->filter = table_filter;

    if (stmt.isEmpty())
        return false;

    bool exists;
    QSqlRecord newValues;

    {
        QSqlQuery q(d->db);
        q.setForwardOnly(true);
        if (!q.exec(stmt))
            return false;

        exists = q.next();
        newValues = q.record();
    }

    bool needsAddingToCache = !exists || d->cache.contains(row);

    if (!needsAddingToCache) {
        const QSqlRecord curValues = record(row);
        needsAddingToCache = curValues.count() != newValues.count();
        if (!needsAddingToCache) {
            // Look for changed values. Primary key fields are customarily first
            // and probably change less often than other fields, so start at the end.
            for (int f = curValues.count() - 1; f >= 0; --f) {
                if (curValues.value(f) != newValues.value(f)) {
                    needsAddingToCache = true;
                    break;
                }
            }
        }
    }

    if (needsAddingToCache) {
        d->cache[row].refresh(exists, newValues);
        emit headerDataChanged(Qt::Vertical, row, row);
        emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
    }

    return true;
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:78,代码来源:qsqltablemodel.cpp


示例8: CHECK

QModelIndex PrimerLibraryModel::index(int row, int column, const QModelIndex & /*parent*/) const {
    CHECK(row < primers.size(), QModelIndex());
    return createIndex(row, column);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:4,代码来源:PrimerLibraryTable.cpp


示例9: createIndex

QVariant DeviceExplorerModel::getData(Device::NodePath node, Column column, int role)
{
    QModelIndex index = createIndex(convertPathToIndex(node).row(), (int)column, node.toNode(&rootNode())->parent());
    return data(index, role);
}
开发者ID:rperrot,项目名称:i-score,代码行数:5,代码来源:DeviceExplorerModel.cpp


示例10: createIndex

QModelIndex DhQDirModel::DvhcreateIndex(int x1, int x2) const {
  return createIndex(x1, x2);
}
开发者ID:bennofs,项目名称:hsQt,代码行数:3,代码来源:QDirModel_DhClass.cpp


示例11: createIndex

void NewsFeedModel::replaceNews(int i, const Vreen::NewsItem &news)
{
    auto index = createIndex(i, 0);
    m_newsList[i] = news;
    emit dataChanged(index, index);
}
开发者ID:Krasnogorov,项目名称:vreen,代码行数:6,代码来源:newsfeedmodel.cpp


示例12: fromUtf8

QModelIndex MtpObjectsModel::findObject(const QString &filename) const
{
	auto idx = std::find_if(_rows.begin(), _rows.end(), [filename, this](Row & row) { return fromUtf8(row.GetInfo(_session)->Filename) == filename; } );
	return idx != _rows.end()? createIndex(std::distance(_rows.begin(), idx), 0): QModelIndex();
}
开发者ID:Ilya87,项目名称:android-file-transfer-linux,代码行数:5,代码来源:mtpobjectsmodel.cpp


示例13: createIndex

QModelIndex MtpObjectsModel::findObject(mtp::u32 objectId) const
{
	auto idx = std::find_if(_rows.begin(), _rows.end(), [objectId](const Row & row) { return row.ObjectId == objectId; } );
	return idx != _rows.end()? createIndex(std::distance(_rows.begin(), idx), 0): QModelIndex();
}
开发者ID:Ilya87,项目名称:android-file-transfer-linux,代码行数:5,代码来源:mtpobjectsmodel.cpp


示例14: setData

void ParamModelBase::SetFreeze(int i, bool is_freeze)
{
    setData( createIndex(i,FREEZE), is_freeze, Qt::CheckStateRole );
}
开发者ID:mattphillipsphd,项目名称:DynaSys,代码行数:4,代码来源:parammodelbase.cpp


示例15: createIndex

void ApiTraceModel::beginLoadingFrame(ApiTraceFrame *frame, int numAdded)
{
    QModelIndex index = createIndex(frame->number, 0, frame);
    beginInsertRows(index, 0, numAdded - 1);
}
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:5,代码来源:apitracemodel.cpp


示例16: createIndex

QModelIndex ParameterListModel::index(int row, int column, const QModelIndex &) const {
  return createIndex(row, column);
}
开发者ID:tulip5,项目名称:tulip,代码行数:3,代码来源:ParameterListModel.cpp


示例17: createIndex

QModelIndex cceMaterialShaderBindingTreeModel::index (int row, int column, const QModelIndex &parent) const
{
  if (parent.isValid()) return QModelIndex ();

  return createIndex(row, column, 0);
}
开发者ID:BtbN,项目名称:crimson-core,代码行数:6,代码来源:shadereditordialog.cpp


示例18: createIndex

WModelIndex WAbstractTableModel::index(int row, int column,
				       const WModelIndex& parent) const
{
  return createIndex(row, column, nullptr);
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:5,代码来源:WAbstractTableModel.C


示例19: createIndex

/*! \internal */
QModelIndex KDPropertyModel::buddy(const QModelIndex& index) const
{
  if (index.column() == 0 && privateData(index) && !privateData(index)->isCategory() )
    return createIndex(index.row(), 1, index.internalPointer());
  return index;
}
开发者ID:KDAB,项目名称:KDTools,代码行数:7,代码来源:kdpropertymodel.cpp


示例20: dataChanged

void QgsGraduatedSymbolRendererV2Model::updateLabels()
{
  emit dataChanged( createIndex( 0, 2 ), createIndex( mRenderer->ranges().size(), 2 ) );
}
开发者ID:nicanor-b,项目名称:QGIS,代码行数:4,代码来源:qgsgraduatedsymbolrendererv2widget.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ createItem函数代码示例发布时间:2022-05-30
下一篇:
C++ createIFile函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap