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


C++ endResetModel函数代码示例

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


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

示例1: file

bool Scene::load(const QString& fn) {
    QFile file(fn);
     if (!file.open(QIODevice::ReadOnly)) {
         return false;
     }

     QByteArray data = file.readAll();
     QDomDocument doc;
     if (!doc.setContent(data)) {
         return false;
     }

     clearSelection();
     beginResetModel();
     m_history->clear();
     if (m_static_body)
         delete m_static_body;
     m_static_body = 0;
     foreach( Body* b, m_bodys ) {
         delete b;
     }
     m_bodys.clear();

    QDomElement root = doc.documentElement();
    m_worldSize.setWidth(root.attribute("width").toInt());
    m_worldSize.setHeight(root.attribute("height").toInt());
    QDomElement node = root.firstChildElement("body");
    while (node.isElement()) {
        QString type = node.attribute("type");
        Body* b = 0;
        if (type=="StaticBody") {
            b = new StaticBody(this,"body",this);
            ReadAttributes(b,node);
            if (!m_static_body)
                m_static_body = b;
            else {
                m_bodys.push_back( b );
            }
        } else if (type=="DynamicBody") {
            b = new DynamicBody(this,"body",this);
            ReadAttributes(b,node);
            m_bodys.push_back( b );
        }
        if (b) {
            QDomElement primNode = node.firstChildElement("primitive");
            while (primNode.isElement()) {
                Primitive* p = 0;
                QString type = primNode.attribute("type");
                p = Primitive::create(type,b,this);
                if (p) {
                    ReadAttributes(p,primNode);
                    b->addPrimitive(p);
                }
                primNode = primNode.nextSiblingElement("primitive");
            }
            connect( b,SIGNAL(changed()),this,SLOT(bodyChanged()));
        }
        node = node.nextSiblingElement("body");
    }
    endResetModel();
    m_filename = fn;
    emit changed();
    return true;
}
开发者ID:chapayGhub,项目名称:Chipmunk-Sandbox,代码行数:64,代码来源:scene.cpp

示例2: beginResetModel

void DatasetItemModel::loadDatasets(const QList<Dataset> &datasetList)
{
    beginResetModel();
    m_datasets_reference = datasetList;
    endResetModel();
}
开发者ID:SpatialTranscriptomicsResearch,项目名称:st_viewer,代码行数:6,代码来源:DatasetItemModel.cpp

示例3: beginResetModel

/* Brief: Force the model to update
 */
void CDailyWeatherModel::update()
{
    beginResetModel();
    endResetModel();
}
开发者ID:westjour,项目名称:GUI_Repo,代码行数:7,代码来源:CDailyWeatherModel.cpp

示例4: beginResetModel

void TablePrintModel::callReset()
{
	beginResetModel();
	endResetModel();
}
开发者ID:ryanlerch,项目名称:subsurface,代码行数:5,代码来源:models.cpp

示例5: beginResetModel

void HistoryQueryResultsModel::setResults(const QVector<HistoryQueryResult> &results)
{
	beginResetModel();
	Results = results;
	endResetModel();
}
开发者ID:leewood,项目名称:kadu,代码行数:6,代码来源:history-query-results-model.cpp

示例6: beginResetModel

    void ScreenModel::initScreens(bool first) {
        // Clear
        beginResetModel();
        d->geometry = QRect();
        d->primary = 0;
        d->screens.clear();

#ifndef USE_QT5
        // set role names
        QHash<int, QByteArray> roleNames;
        roleNames[NameRole] = "name";
        roleNames[GeometryRole] = "geometry";
        // set role names
        setRoleNames(roleNames);
#endif

#if 0
        // fake model for testing
        d->geometry = QRect(0, 0, 1920, 1080);
        d->primary = 1;
        d->screens << ScreenPtr { new Screen { "First", QRect(0, 0, 300, 300) } }
                   << ScreenPtr { new Screen { "Second", QRect(300, 0, 1320, 742) } }
                   << ScreenPtr { new Screen { "Third", QRect(1620, 0, 300, 300) } };
        return;
#endif

#ifdef USE_QT5
        QList<QScreen *> screens = QGuiApplication::screens();
        for (int i = 0; i < screens.size(); ++i) {
            QScreen *screen = screens.at(i);
            // add to the screens list
            d->screens << ScreenPtr { new Screen { QString("Screen %1").arg(i + 1), screen->geometry() } };
            // extend available geometry
            d->geometry = d->geometry.united(screen->geometry());
            // check if primary
            if (screen == QGuiApplication::primaryScreen())
                d->primary = i;

            if (first) {
                // Recive screen updates
                connect(screen, SIGNAL(geometryChanged(const QRect &)), this, SLOT(onScreenChanged()));
            }
        }
#else
        // set primary screen
        d->primary = QApplication::desktop()->primaryScreen();
        // get screen count
        int screenCount = QApplication::desktop()->screenCount();

        for (int i = 0; i < screenCount; ++i) {
            QRect geometry = QApplication::desktop()->screenGeometry(i);
            // add to the screens list
            d->screens << ScreenPtr { new Screen { QString("Screen %1").arg(i + 1), geometry } };
            // extend available geometry
            d->geometry = d->geometry.united(geometry);
        }
#endif
        endResetModel();

        emit primaryChanged();
    }
开发者ID:Acidburn0zzz,项目名称:sddm,代码行数:61,代码来源:ScreenModel.cpp

示例7: beginResetModel

void TaskModelAdapter::resetTasks()
{
    beginResetModel();
    endResetModel();
}
开发者ID:netrunner-debian-kde-extras,项目名称:charmtimetracker,代码行数:5,代码来源:TaskModelAdapter.cpp

示例8: beginResetModel

int AbstractListModel::setItems(const QVector<Item>& items)
{
  emit beginResetModel();
  this->Items = items;
  emit endResetModel();
}
开发者ID:NahomKidane,项目名称:QtExamples,代码行数:6,代码来源:AbstractListModelFileDialog.cpp

示例9: beginResetModel

void ItemLibrarySectionModel::resetModel()
{
    beginResetModel();
    endResetModel();
}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:5,代码来源:itemlibrarysectionmodel.cpp

示例10: beginResetModel

void RouteModel::refresh()
{
  beginResetModel();
  endResetModel();
}
开发者ID:bolidehi,项目名称:libosmscout,代码行数:5,代码来源:RoutingDialog.cpp

示例11: layer

void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTableConfig& config )
{
  mConfig = config;
  mConfig.update( layer()->fields() );

  QVector<int> newColumnMapping;

  Q_FOREACH ( const QgsAttributeTableConfig::ColumnConfig& columnConfig, mConfig.columns() )
  {
    // Hidden? Forget about this column
    if ( columnConfig.hidden )
      continue;

    // The new value for the mapping (field index or -1 for action column)
    int newValue = ( columnConfig.type == QgsAttributeTableConfig::Action ) ? -1 : layer()->fields().lookupField( columnConfig.name );
    newColumnMapping << newValue;
  }

  if ( newColumnMapping != mColumnMapping )
  {
    bool requiresReset = false;
    int firstRemovedColumn = -1;
    int removedColumnCount = 0;

    // Check if there have a contiguous set of columns have been removed or if we require a full reset
    for ( int i = 0; i < qMin( newColumnMapping.size(), mColumnMapping.size() - removedColumnCount ); ++i )
    {
      if ( newColumnMapping.at( i ) == mColumnMapping.at( i + removedColumnCount ) )
        continue;

      if ( firstRemovedColumn == -1 )
      {
        firstRemovedColumn = i;

        while ( i < mColumnMapping.size() - removedColumnCount && mColumnMapping.at( i + removedColumnCount ) != newColumnMapping.at( i ) )
        {
          ++removedColumnCount;
        }
      }
      else
      {
        requiresReset = true;
        break;
      }
    }

    // No difference found so far
    if ( firstRemovedColumn == -1 )
    {
      if ( newColumnMapping.size() > mColumnMapping.size() )
      {
        // More columns: appended to the end
        beginInsertColumns( QModelIndex(), mColumnMapping.size(), newColumnMapping.size() - 1 );
        mColumnMapping = newColumnMapping;
        endInsertColumns();
      }
      else
      {
        // Less columns: removed from the end
        beginRemoveColumns( QModelIndex(), newColumnMapping.size(), mColumnMapping.size() - 1 );
        mColumnMapping = newColumnMapping;
        endRemoveColumns();
      }
    }
    else
    {
      if ( newColumnMapping.size() == mColumnMapping.size() - removedColumnCount )
      {
        beginRemoveColumns( QModelIndex(), firstRemovedColumn, firstRemovedColumn );
        mColumnMapping = newColumnMapping;
        endRemoveColumns();
      }
      else
      {
        requiresReset = true;
      }
    }

    if ( requiresReset )
    {
      beginResetModel();
      mColumnMapping = newColumnMapping;
      endResetModel();
    }
  }

  sort( config.sortExpression(), config.sortOrder() );
}
开发者ID:drnextgis,项目名称:QGIS,代码行数:88,代码来源:qgsattributetablefiltermodel.cpp

示例12: beginResetModel

//------------------------------------------------------------------------------
// Name: update
// Desc:
//------------------------------------------------------------------------------
void ResultViewModel::update() {
	if(updates_enabled_) {
		beginResetModel();
		endResetModel();
	}
}
开发者ID:beans365,项目名称:edb-debugger,代码行数:10,代码来源:ResultViewModel.cpp

示例13: beginResetModel

void QgsWelcomePageItemsModel::setRecentProjects( const QList<RecentProjectData>& recentProjects )
{
  beginResetModel();
  mRecentProjects = recentProjects;
  endResetModel();
}
开发者ID:chhao91,项目名称:QGIS,代码行数:6,代码来源:qgswelcomepageitemsmodel.cpp

示例14: beginResetModel

void View::Management::CategoryModel::setCategories(QList<Model::Domain::Category *> *categories)
{
    beginResetModel();
    _categories = categories;
    endResetModel();
}
开发者ID:j2sg,项目名称:JIM,代码行数:6,代码来源:categorymodel.cpp

示例15: setColorSchemes

 void setColorSchemes(const QList<ColorSchemeEntry> &colorSchemes)
 {
     beginResetModel();
     m_colorSchemes = colorSchemes;
     endResetModel();
 }
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:6,代码来源:fontsettingspage.cpp


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