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

C++ removeRows函数代码示例

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

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



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

示例1: findElement

// The actual magic shouldn't be hard. Once we trap the signal, find the
// recipe, remove it from the parent and add it to the target folder.
// It is not easy. Indexes are ephemeral things. We MUST calculate the insert
// index after we have removed the recipe. BAD THINGS happen otherwise.
// 
void BtTreeModel::folderChanged(QString name)
{
   BeerXMLElement* test = qobject_cast<BeerXMLElement*>(sender());
   QModelIndex ndx, pIndex;
   bool expand = true;

   if ( ! test )
      return;

   // Find it.
   ndx = findElement(test);
   if ( ! ndx.isValid() )
   {
      Brewtarget::logW("folderChanged:: could not find element");
      return;
   }

   pIndex = parent(ndx); // Get the parent
   // If the parent isn't valid, its the root
   if ( ! pIndex.isValid() )
      pIndex = createIndex(0,0,rootItem->child(0));
   
   int i = item(ndx)->childNumber();

   // Remove it
   if ( ! removeRows(i, 1, pIndex) )
   {
      Brewtarget::logW("folderChanged:: could not remove row");
      return;
   }

   // Find the new parent
   // That's awkward, but dropping a folder prolly does need a the folder
   // created.
   QModelIndex newNdx = findFolder(test->folder(), rootItem->child(0), true);
   if ( ! newNdx.isValid() )
   {
      newNdx = createIndex(0,0,rootItem->child(0));
      expand = false;
   }
   
   BtTreeItem* local = item(newNdx);
   int j = local->childCount();

   if ( !  insertRow(j,newNdx,test,_type) )
   {
      Brewtarget::logW("folderChanged:: could not insert row");
      return;
   }
   // If we have brewnotes, set them up here.
   if ( treeMask & RECIPEMASK )
      addBrewNoteSubTree(qobject_cast<Recipe*>(test),j,local);

   if ( expand )
      emit expandFolder(treeMask,newNdx);
   return;
}
开发者ID:EvansMike,项目名称:brewtarget,代码行数:62,代码来源:BtTreeModel.cpp


示例2: beginInsertRows

void pgpid_item_model::data_updated(std::list<RsPgpId> &new_neighs)
{

    //shit code follow (rewrite this please)
    size_t old_size = neighs.size(), new_size = 0;
    std::list<RsPgpId> old_neighs = neighs;

    new_size = new_neighs.size();
    //set model data to new cleaned up data
    neighs = new_neighs;
    neighs.sort();
    neighs.unique(); //remove possible dups

    //reflect actual row count in model
    if(old_size < new_size)
    {
        beginInsertRows(QModelIndex(), old_size, new_size);
        insertRows(old_size, new_size - old_size);
        endInsertRows();
    }
    else if(new_size < old_size)
    {
        beginRemoveRows(QModelIndex(), new_size, old_size);
        removeRows(old_size, old_size - new_size);
        endRemoveRows();
    }
    //update data in ui, to avoid unnecessary redraw and ui updates, updating only changed elements
    //TODO: libretroshare should implement a way to obtain only changed elements via some signalling non-blocking api.
    {
        size_t ii1 = 0;
        for(auto i1 = neighs.begin(), end1 = neighs.end(), i2 = old_neighs.begin(), end2 = old_neighs.end(); i1 != end1; ++i1, ++i2, ii1++)
        {
            if(i2 == end2)
                break;
            if(*i1 != *i2)
            {
                QModelIndex topLeft = createIndex(ii1,0), bottomRight = createIndex(ii1, COLUMN_COUNT-1);
                emit dataChanged(topLeft, bottomRight);
            }
        }
    }
    if(new_size > old_size)
    {
        QModelIndex topLeft = createIndex(old_size ? old_size -1 : 0 ,0), bottomRight = createIndex(new_size -1, COLUMN_COUNT-1);
        emit dataChanged(topLeft, bottomRight);
    }
    //dirty solution for initial data fetch
    //TODO: do it properly!
    if(!old_size)
    {
        beginResetModel();
        endResetModel();
    }

    //shit code end
}
开发者ID:ShadowMyst,项目名称:RetroShare,代码行数:56,代码来源:pgpid_item_model.cpp


示例3: while

//SLOT:setVar : changement de l'id de la variable et traçage du Tri à plat
void TaP::setVar(QIntList id)
{
    //On prend la première variable si plusieurs sont sélectionnées
    var_courante=this->population->pVar(id.at(0));
    this->setNom(var_courante->Nom());
    this->typeVar=var_courante->Type();

        while(columnCount()>3)
        {removeColumn(columnCount()-1);}

        if(rowCount()>0)
        {
            removeRows(0,rowCount());
        }
        setNomVar(0, "Modalités");
        setNomVar(1, "Effectifs");
        setNomVar(2, "Fréquences");

        TAP_DONNEES donnees;
        donnees.Charger(var_courante);

        switch(typeVar)
        {
            case TYPES::QUALITATIF_ORDINAL:
                addColumn();
                setNomVar(3, "Fréquences Cumulées");
                setTypeVar(3, TYPES::QUALITATIF_PURE);
                break;
            case TYPES::QUANTITATIF_DISCRET:
                addColumn();
                setNomVar(3, "Fréquences Cumulées");
                setTypeVar(3, TYPES::QUALITATIF_PURE);
                break;
            case TYPES::QUANTITATIF_CONTINU_PURE:
                addColumn();
                setNomVar(3, "Fréquences Cumulées");
                setTypeVar(3, TYPES::QUALITATIF_PURE);
                break;
        }
        for(int i=0; i<donnees.Modalites().size();i++)
        {
            if(i==rowCount())
            {
                addRows();
            }
            setData(0, i, donnees.Modalites().at(i));
            setData(1, i, donnees.Effectifs().at(i));
            setData(2, i, donnees.Frequences().at(i));
            if(donnees.FrequencesCumulees().size())
            {setData(3,i, donnees.FrequencesCumulees().at(i));}
        }
        addRows();
        setData(0,rowCount()-1,"TOTAL");
        setData(1,rowCount()-1,population->NbValideString(id.at(0)));
        setData(2,rowCount()-1,"1,00");
}
开发者ID:empire1601,项目名称:STATS,代码行数:57,代码来源:TAP.cpp


示例4: searchId

    void IdCollection<ESXRecordT>::load (ESM::ESMReader& reader, bool base)
    {
        std::string id = reader.getHNOString ("NAME");

        if (reader.isNextSub ("DELE"))
        {
            int index = searchId (id);

            reader.skipRecord();

            if (index==-1)
            {
                // deleting a record that does not exist

                // ignore it for now

                /// \todo report the problem to the user
            }
            else if (base)
            {
                removeRows (index, 1);
            }
            else
            {
                mRecords[index].mState = RecordBase::State_Deleted;
            }
        }
        else
        {
            ESXRecordT record;
            record.mId = id;
            record.load (reader);

            int index = searchId (record.mId);

            if (index==-1)
            {
                // new record
                Record<ESXRecordT> record2;
                record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
                (base ? record2.mBase : record2.mModified) = record;

                appendRecord (record2);
            }
            else
            {
                // old record
                Record<ESXRecordT>& record2 = mRecords[index];

                if (base)
                    record2.mBase = record;
                else
                    record2.setModified (record);
            }
        }
    }
开发者ID:4DA,项目名称:openmw,代码行数:56,代码来源:idcollection.hpp


示例5: rowCount

bool NotifyTableModel::dropMimeData( const QMimeData * data, Qt::DropAction action, int row,
                   int column, const QModelIndex& parent)
{
    if (action == Qt::IgnoreAction)
        return true;

    if (!data->hasFormat(mime_type_notify_table))
        return false;

    int beginRow = -1;

    if (row != -1)
        beginRow = row;
    else {
        if (parent.isValid())
            beginRow = parent.row();
        else
            beginRow = rowCount(QModelIndex());
    }

    if (-1 == beginRow)
        return false;

    QByteArray encodedData = data->data(mime_type_notify_table);
    QDataStream stream(&encodedData, QIODevice::ReadOnly);
    int rows = beginRow;
    // read next item from input MIME and drop into the table line by line
    while(!stream.atEnd()) {
        quintptr ptr;
        stream >> ptr;
        NotificationItem* item = reinterpret_cast<NotificationItem*>(ptr);
        int dragged = _list.indexOf(item);
        // we can drag item from top rows to bottom (DOWN_DIRECTION),
        // or from bottom rows to top rows (UP_DIRECTION)
        enum { UP_DIRECTION, DOWN_DIRECTION };
        int direction = (dragged < rows) ? DOWN_DIRECTION : (dragged += 1, UP_DIRECTION);
        // check drop bounds
        if (dragged < 0 || ((dragged + 1) >= _list.size() && direction == DOWN_DIRECTION)  || dragged == rows) {
            qNotifyDebug() << "no such item";
            continue;
        }
        // addiional check in case dropping of multiple rows
        if(rows + direction > _list.size()) continue;

        Q_ASSERT(insertRows(rows + direction, 1, QModelIndex()));
        _list.replace(rows + direction, item);
        Q_ASSERT(removeRows(dragged, 1, QModelIndex()));
        if (direction == UP_DIRECTION)
            ++rows;
    };

    QModelIndex idxTopLeft = index(beginRow, 0, QModelIndex());
    QModelIndex idxBotRight = index(beginRow, columnCount(QModelIndex()), QModelIndex());
    emit dataChanged(idxTopLeft, idxBotRight);
    return true;
}
开发者ID:BangBo,项目名称:OpenPilot,代码行数:56,代码来源:notifytablemodel.cpp


示例6: removeRows

void LibrarySourcesTableModel::set(const QList<LibrarySource>& sources)
{
    if (!this->sources.empty())
        removeRows(0, this->sources.size(), QModelIndex());
    if (sources.empty())
        return;
    beginInsertRows(QModelIndex(), 0, sources.size() - 1);
    this->sources = sources;
    endInsertRows();
}
开发者ID:TheMrButcher,项目名称:gamebase_manager,代码行数:10,代码来源:librarysourcestablemodel.cpp


示例7: insertRows

void ConfMat::setRowCount(int newRowCount)
{
    int curRowCount = this->getRowCount();
    if (curRowCount == newRowCount)
        return;
    if (curRowCount < newRowCount)
        insertRows(qMax(curRowCount, 0), newRowCount - curRowCount);
    else
        removeRows(qMax(newRowCount, 0), curRowCount - newRowCount);
}
开发者ID:gyoerkaa,项目名称:confuser,代码行数:10,代码来源:confmat.cpp


示例8: qDebug

void ObjectModel::removeItem(QModelIndex &index)
{
    if (!index.isValid())
    {
        return;
    }

    qDebug() << "removeItem row:" << index.row() << "p:" << index.internalPointer();
    removeRows(index.row(), 1, index.parent());
}
开发者ID:chocoball,项目名称:AnimationCreator,代码行数:10,代码来源:objectmodel.cpp


示例9: removeRows

void DbGpfsInfo::upsertInfo(SQLHSTMT sqlStmt)
{
    removeRows(sqlStmt,tmptableName);     //clear all related temp tables at first
    fillTable(sqlStmt,tmptableName); //fill temp table
    
    queryTable(sqlStmt,tmptableName,&tempInfo);//query temp table
    queryTable(sqlStmt,tableName,&lastInfo); //query regular table

    updateRegularTable(sqlStmt,tableName, tempInfo, lastInfo); //update regular table
    
}
开发者ID:ppjsand,项目名称:pyteal,代码行数:11,代码来源:DbGpfsInfo.cpp


示例10: insertRows

    void MagnetModel::onUpdateQueue(bt::Uint32 idx, bt::Uint32 count)
    {
        int rows = mman->count();
        if (currentRows < rows)  // add new rows
            insertRows(idx, rows - currentRows, QModelIndex());
        else if (currentRows > rows) // delete rows
            removeRows(idx, currentRows - rows, QModelIndex());

        currentRows = rows;
        emit dataChanged(index(idx, 0), index(count, columnCount(QModelIndex())));
    }
开发者ID:dreamsxin,项目名称:ktorrent,代码行数:11,代码来源:magnetmodel.cpp


示例11: QAbstractItemModel_removeRows

int QAbstractItemModel_removeRows(lua_State* const state)
{
    auto self = lua::get<QAbstractItemModel*>(state, 1);

    // virtual bool     removeRows(int row, int count, const QModelIndex & parent = QModelIndex())
    if (lua_gettop(state) == 3) {
        lua::push(state, self->removeRows(
            lua::get<int>(state, 2),
            lua::get<int>(state, 3)
        ));
    } else {
        lua::push(state, self->removeRows(
            lua::get<int>(state, 2),
            lua::get<int>(state, 3),
            lua::get<const QModelIndex&>(state, 4)
        ));
    }

    return 1;
}
开发者ID:dafrito,项目名称:luacxx,代码行数:20,代码来源:QAbstractItemModel.cpp


示例12: removeRows

bool CQCompartmentDM::clear()
{
  QModelIndexList rows;

  for (int i = 0; i < mpCompartments->size(); i++)
    {
      rows.append(index(i, 0));
    }

  return removeRows(rows);
}
开发者ID:copasi,项目名称:COPASI,代码行数:11,代码来源:CQCompartmentDM.cpp


示例13: removeRows

void QgsAttributeTableModel::layerDeleted()
{
  mLayerCache = nullptr;
  removeRows( 0, rowCount() );

  mAttributeWidgetCaches.clear();
  mAttributes.clear();
  mWidgetFactories.clear();
  mWidgetConfigs.clear();
  mFieldFormatters.clear();
}
开发者ID:alexbruy,项目名称:QGIS,代码行数:11,代码来源:qgsattributetablemodel.cpp


示例14: printf

void FXTabSim::sacarCTRL(void) {

	printf("indexCtrl: %d tope: %d\n", indexCtrl, tope);

	// removeRows(indexCtrl, tope-indexCtrl+1);
	removeRows(indexCtrl);

	tope = indexCtrl-1;

	printf("Nuevo tope: %d\n", tope);
	}
开发者ID:asolisi,项目名称:PL,代码行数:11,代码来源:claseTS.cpp


示例15: createIndex

/**
 * Removes the TreeItem with the given name including all its children
 */
void GeoTreeModel::removeGeoList(const std::string &name, GeoLib::GEOTYPE type)
{
	for (size_t i = 0; i < _lists.size(); i++)
		if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 )
		{
			for (int j = 0; j < _lists[i]->childCount(); j++)
				if (type ==
				    static_cast<GeoObjectListItem*>(_lists[i]->child(j))->getType())
				{
					QModelIndex index = createIndex(j, 0, _lists[i]->child(j));
					removeRows(0, _lists[i]->child(j)->childCount(), index);
					removeRows(j, 1, parent(index));
					break;
				}
			if (_lists[i]->childCount() == 0)
			{
				_lists.erase(_lists.begin() + i);
				removeRows(i, 1, QModelIndex());
			}
		}
}
开发者ID:envinf,项目名称:ogs,代码行数:24,代码来源:GeoTreeModel.cpp


示例16: beginRemoveColumns

bool TreeModel::removeColumns(int position, int columns, const QModelIndex &parent)
{
    bool success;

    beginRemoveColumns(parent, position, position + columns - 1);
    success = rootItem->removeColumns(position, columns);
    endRemoveColumns();

    if (rootItem->columnCount() == 0)    removeRows(0, rowCount());

    return success;
}
开发者ID:ArashAll,项目名称:FuzzWin,代码行数:12,代码来源:fuzzwin_modelview.cpp


示例17: insertRows

void
TableModel::setRowCount(int rows)
{
    if ( (rows < 0) || (_imp->rowCount == rows) ) {
        return;
    }
    if (_imp->rowCount < rows) {
        insertRows(std::max(_imp->rowCount, 0), rows - _imp->rowCount);
    } else {
        removeRows(std::max(rows, 0), _imp->rowCount - rows);
    }
}
开发者ID:jessezwd,项目名称:Natron,代码行数:12,代码来源:TableModelView.cpp


示例18: while

    void  Collection<ESXRecordT, IdAccessorT>::purge()
    {
        int i = 0;

        while (i<static_cast<int> (mRecords.size()))
        {
            if (mRecords[i].isErased())
                removeRows (i, 1);
            else
                ++i;
        }
    }
开发者ID:Riverwolf,项目名称:openmw,代码行数:12,代码来源:collection.hpp


示例19: model

void LabelView::Refresh(void)
{
  _mutex.lock();
  auto pModel = model();
  pModel->removeRows(0, pModel->rowCount());
  _mutex.unlock();

  m_rDoc.ForEachLabel([&](medusa::Address const& rAddr, medusa::Label const& rLbl)
  {
    emit labelAdded(rAddr, rLbl);
  });
}
开发者ID:GrimDerp,项目名称:medusa,代码行数:12,代码来源:LabelView.cpp


示例20: insertRows

void MatrixModel::setRowCount(int rows) {
  if (d_rows == rows)
    return;

  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

  if (rows > d_rows)
    insertRows(d_rows, rows - d_rows);
  else if (rows < d_rows)
    removeRows(rows, d_rows - rows);

  QApplication::restoreOverrideCursor();
}
开发者ID:rosswhitfield,项目名称:mantid,代码行数:13,代码来源:MatrixModel.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ removeTab函数代码示例发布时间:2022-05-30
下一篇:
C++ removeRow函数代码示例发布时间: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