本文整理汇总了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;
}
示例2: beginResetModel
void DatasetItemModel::loadDatasets(const QList<Dataset> &datasetList)
{
beginResetModel();
m_datasets_reference = datasetList;
endResetModel();
}
示例3: beginResetModel
/* Brief: Force the model to update
*/
void CDailyWeatherModel::update()
{
beginResetModel();
endResetModel();
}
示例4: beginResetModel
void TablePrintModel::callReset()
{
beginResetModel();
endResetModel();
}
示例5: beginResetModel
void HistoryQueryResultsModel::setResults(const QVector<HistoryQueryResult> &results)
{
beginResetModel();
Results = results;
endResetModel();
}
示例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();
}
示例7: beginResetModel
void TaskModelAdapter::resetTasks()
{
beginResetModel();
endResetModel();
}
示例8: beginResetModel
int AbstractListModel::setItems(const QVector<Item>& items)
{
emit beginResetModel();
this->Items = items;
emit endResetModel();
}
示例9: beginResetModel
void ItemLibrarySectionModel::resetModel()
{
beginResetModel();
endResetModel();
}
示例10: beginResetModel
void RouteModel::refresh()
{
beginResetModel();
endResetModel();
}
示例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() );
}
示例12: beginResetModel
//------------------------------------------------------------------------------
// Name: update
// Desc:
//------------------------------------------------------------------------------
void ResultViewModel::update() {
if(updates_enabled_) {
beginResetModel();
endResetModel();
}
}
示例13: beginResetModel
void QgsWelcomePageItemsModel::setRecentProjects( const QList<RecentProjectData>& recentProjects )
{
beginResetModel();
mRecentProjects = recentProjects;
endResetModel();
}
示例14: beginResetModel
void View::Management::CategoryModel::setCategories(QList<Model::Domain::Category *> *categories)
{
beginResetModel();
_categories = categories;
endResetModel();
}
示例15: setColorSchemes
void setColorSchemes(const QList<ColorSchemeEntry> &colorSchemes)
{
beginResetModel();
m_colorSchemes = colorSchemes;
endResetModel();
}