void ReportSectionDetailGroup::initFromXML( const QDomElement &element ) { if ( element.hasAttribute( "report:group-column" ) ) { setColumn( element.attribute( "report:group-column" ) ); } if ( element.hasAttribute( "report:group-page-break" ) ) { QString s = element.attribute( "report:group-page-break" ); if ( s == "after-footer" ) { setPageBreak( ReportSectionDetailGroup::BreakAfterGroupFooter ); } else if ( s == "before-header" ) { setPageBreak( ReportSectionDetailGroup::BreakBeforeGroupHeader ); } } if (element.attribute("report:group-sort", "ascending") == "ascending") { setSort(Qt::AscendingOrder); } else { setSort(Qt::DescendingOrder); } for ( QDomElement e = element.firstChildElement( "report:section" ); ! e.isNull(); e = e.nextSiblingElement( "report:section" ) ) { QString s = e.attribute( "report:section-type" ); if ( s == "group-header" ) { setGroupHeaderVisible( true ); m_groupHeader->initFromXML( e ); } else if ( s == "group-footer" ) { setGroupFooterVisible( true ); m_groupFooter->initFromXML( e ); } } }
void BaseSqlTableModel::sort(int column, Qt::SortOrder order) { if (sDebug) { qDebug() << this << "sort()" << column << order; } setSort(column, order); select(); }
Status ParsedDelete::parseQueryToCQ() { dassert(!_canonicalQuery.get()); const ExtensionsCallbackReal extensionsCallback(_txn, &_request->getNamespaceString()); // The projection needs to be applied after the delete operation, so we do not specify a // projection during canonicalization. auto lpq = stdx::make_unique<LiteParsedQuery>(_request->getNamespaceString()); lpq->setFilter(_request->getQuery()); lpq->setSort(_request->getSort()); lpq->setCollation(_request->getCollation()); lpq->setExplain(_request->isExplain()); // Limit should only used for the findAndModify command when a sort is specified. If a sort // is requested, we want to use a top-k sort for efficiency reasons, so should pass the // limit through. Generally, a delete stage expects to be able to skip documents that were // deleted out from under it, but a limit could inhibit that and give an EOF when the delete // has not actually deleted a document. This behavior is fine for findAndModify, but should // not apply to deletes in general. if (!_request->isMulti() && !_request->getSort().isEmpty()) { lpq->setLimit(1); } auto statusWithCQ = CanonicalQuery::canonicalize(_txn, std::move(lpq), extensionsCallback); if (statusWithCQ.isOK()) { _canonicalQuery = std::move(statusWithCQ.getValue()); } return statusWithCQ.getStatus(); }
// static StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize( OperationContext* opCtx, const CanonicalQuery& baseQuery, MatchExpression* root) { auto qr = stdx::make_unique<QueryRequest>(baseQuery.nss()); BSONObjBuilder builder; root->serialize(&builder); qr->setFilter(builder.obj()); qr->setProj(baseQuery.getQueryRequest().getProj()); qr->setSort(baseQuery.getQueryRequest().getSort()); qr->setCollation(baseQuery.getQueryRequest().getCollation()); qr->setExplain(baseQuery.getQueryRequest().isExplain()); auto qrStatus = qr->validate(); if (!qrStatus.isOK()) { return qrStatus; } std::unique_ptr<CollatorInterface> collator; if (baseQuery.getCollator()) { collator = baseQuery.getCollator()->clone(); } // Make the CQ we'll hopefully return. std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery()); Status initStatus = cq->init(opCtx, std::move(qr), baseQuery.canHaveNoopMatchNodes(), root->shallowClone(), std::move(collator)); if (!initStatus.isOK()) { return initStatus; } return std::move(cq); }
// static StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize( OperationContext* opCtx, const CanonicalQuery& baseQuery, MatchExpression* root, const ExtensionsCallback& extensionsCallback) { // TODO: we should be passing the filter corresponding to 'root' to the QR rather than the base // query's filter, baseQuery.getQueryRequest().getFilter(). auto qr = stdx::make_unique<QueryRequest>(baseQuery.nss()); qr->setFilter(baseQuery.getQueryRequest().getFilter()); qr->setProj(baseQuery.getQueryRequest().getProj()); qr->setSort(baseQuery.getQueryRequest().getSort()); qr->setCollation(baseQuery.getQueryRequest().getCollation()); qr->setExplain(baseQuery.getQueryRequest().isExplain()); auto qrStatus = qr->validate(); if (!qrStatus.isOK()) { return qrStatus; } std::unique_ptr<CollatorInterface> collator; if (baseQuery.getCollator()) { collator = baseQuery.getCollator()->clone(); } // Make the CQ we'll hopefully return. std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery()); Status initStatus = cq->init( std::move(qr), extensionsCallback, root->shallowClone().release(), std::move(collator)); if (!initStatus.isOK()) { return initStatus; } return std::move(cq); }
void FolderModel::generateQueries( bool resort ) { QueryGenerator generator; if ( m_folderId != 0 ) generator.initializeFolder( m_folderId, m_viewId ); else generator.initializeGlobalList( m_typeId, m_viewId ); if ( !m_searchText.isEmpty() ) generator.setSearchText( m_searchColumn, m_searchText ); if ( m_forceColumns ) generator.setColumns( m_columns ); m_typeId = generator.typeId(); m_query = generator.query( true ); m_arguments = generator.arguments(); m_columns = generator.columns(); m_sortColumns = generator.sortColumns(); ViewSettingsHelper helper( m_typeId ); for ( int i = 0; i < m_columns.count(); i++ ) setHeaderData( i, Qt::Horizontal, helper.columnName( m_columns.at( i ) ) ); setColumnMapping( 0, generator.columnMapping() ); if ( resort ) setSort( generator.sortColumn(), generator.sortOrder() ); updateQueries(); }
void SqlQueryModelOptimized::sort(int column, Qt::SortOrder order) { if ((sortKeyColumn != column) || (sortOrder != order)) { setSort(column, order); select(); } }
//--------------------------------------------------------------------------------------- Sort::Sort(QWidget *parent) : QWidget(parent), ui(new Ui::Sort) { ui->setupUi(this); QObject::connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(setSort())); //слот при нажатии на ок }
ContextModel::ContextModel(QObject *parent) : QSqlTableModel(parent) { setTable("context"); setSort(fieldIndex("shortdescr"), Qt::AscendingOrder); select(); }
Sort::Sort() { fields=NULL; SortField** fields=_CL_NEWARRAY(SortField*,3); fields[0]=SortField::FIELD_SCORE; fields[1]=SortField::FIELD_DOC; fields[2]=NULL; setSort (fields); _CLDELETE_ARRAY(fields); }
int Q3DataBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 24) qt_static_metacall(this, _c, _id, _a); _id -= 24; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = boundaryChecking(); break; case 1: *reinterpret_cast< QString*>(_v) = filter(); break; case 2: *reinterpret_cast< QStringList*>(_v) = sort(); break; case 3: *reinterpret_cast< bool*>(_v) = confirmEdits(); break; case 4: *reinterpret_cast< bool*>(_v) = confirmInsert(); break; case 5: *reinterpret_cast< bool*>(_v) = confirmUpdate(); break; case 6: *reinterpret_cast< bool*>(_v) = confirmDelete(); break; case 7: *reinterpret_cast< bool*>(_v) = confirmCancels(); break; case 8: *reinterpret_cast< bool*>(_v) = isReadOnly(); break; case 9: *reinterpret_cast< bool*>(_v) = autoEdit(); break; } _id -= 10; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBoundaryChecking(*reinterpret_cast< bool*>(_v)); break; case 1: setFilter(*reinterpret_cast< QString*>(_v)); break; case 2: setSort(*reinterpret_cast< QStringList*>(_v)); break; case 3: setConfirmEdits(*reinterpret_cast< bool*>(_v)); break; case 4: setConfirmInsert(*reinterpret_cast< bool*>(_v)); break; case 5: setConfirmUpdate(*reinterpret_cast< bool*>(_v)); break; case 6: setConfirmDelete(*reinterpret_cast< bool*>(_v)); break; case 7: setConfirmCancels(*reinterpret_cast< bool*>(_v)); break; case 8: setReadOnly(*reinterpret_cast< bool*>(_v)); break; case 9: setAutoEdit(*reinterpret_cast< bool*>(_v)); break; } _id -= 10; } else if (_c == QMetaObject::ResetProperty) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 10; } #endif // QT_NO_PROPERTIES return _id; }
ReferTableModel::ReferTableModel(QObject *parent) { setTable("referNode"); setSort(1, Qt::AscendingOrder); setHeaderData(1, Qt::Horizontal, tr("NetID")); setHeaderData(2, Qt::Horizontal, tr("Floor")); setHeaderData(3, Qt::Horizontal, tr("Number")); setHeaderData(4, Qt::Horizontal, tr("TMP_Period")); select(); }
PoitemTableModel::PoitemTableModel(QObject * parent, QSqlDatabase db) : QSqlRelationalTableModel(parent, db) { setTable("poitem"); // select statement on which everything else is based _selectStatement = QString("SELECT pohead_number, " " item_id, item_number," " warehous_id, warehous_code," " poitem_unitprice * poitem_qty_ordered AS extprice," " prj_number," " expcat_code," " 0 AS itemsrc_minordqty, 0 AS itemsrc_multordqty, " " 1 AS itemsrc_invvendoruomratio," " CURRENT_DATE AS earliestdate, " " poitem.* " "FROM pohead" " JOIN poitem ON (poitem_pohead_id=pohead_id)" " LEFT OUTER JOIN itemsite ON (poitem_itemsite_id=itemsite_id)" " LEFT OUTER JOIN item ON (itemsite_item_id=item_id)" " LEFT OUTER JOIN whsinfo ON (itemsite_warehous_id=warehous_id)" " LEFT OUTER JOIN prj ON (poitem_prj_id=prj_id)" " LEFT OUTER JOIN expcat ON (poitem_expcat_id=expcat_id)" ); setEditStrategy(QSqlTableModel::OnManualSubmit); // OnRow? setSort(POITEM_LINENUMBER_COL, Qt::AscendingOrder); // insert only those columns not directly part of the poitem table insertColumns(0, 7); setHeaderData(POITEM_LINENUMBER_COL, Qt::Horizontal, tr("#")); setHeaderData(ITEM_NUMBER_COL, Qt::Horizontal, tr("Item")); setHeaderData(WAREHOUS_CODE_COL, Qt::Horizontal, tr("Supplying Site")); setHeaderData(POITEM_VEND_ITEM_NUMBER_COL, Qt::Horizontal, tr("Vend Item #")); setHeaderData(POITEM_VEND_ITEM_DESCRIP_COL,Qt::Horizontal, tr("Vend Description")); setHeaderData(POITEM_VEND_UOM_COL, Qt::Horizontal, tr("Vend UOM")); setHeaderData(POITEM_QTY_ORDERED_COL, Qt::Horizontal, tr("Qty.")); setHeaderData(POITEM_UNITPRICE_COL, Qt::Horizontal, tr("Unit Price")); setHeaderData(EXTPRICE_COL, Qt::Horizontal, tr("Ext. Price")); setHeaderData(POITEM_FREIGHT_COL, Qt::Horizontal, tr("Freight")); setHeaderData(POITEM_DUEDATE_COL, Qt::Horizontal, tr("Due Date")); setHeaderData(PRJ_NUMBER_COL, Qt::Horizontal, tr("Project #")); setHeaderData(EXPCAT_CODE_COL, Qt::Horizontal, tr("Expense Cat.")); _poheadid = -1; _poitemid = -1; findHeadData(); _dirty = false; select(); connect(this, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(markDirty(QModelIndex, QModelIndex))); }
QueueModel::QueueModel(QObject *parent, QSqlDatabase db) : QSqlRelationalTableModel(parent, db) { setTable("queuesongs"); setSinger(-1); setRelation(3, QSqlRelation("dbsongs", "songid", "artist")); setRelation(4, QSqlRelation("dbsongs", "songid", "title")); setRelation(5, QSqlRelation("dbsongs", "songid", "discid")); setRelation(6, QSqlRelation("dbsongs", "songid", "path")); setSort(9, Qt::AscendingOrder); }
MobileTableModel::MobileTableModel(QObject *parent) { setTable("mobileConfig"); setSort(1, Qt::AscendingOrder); setHeaderData(1, Qt::Horizontal, tr("FixID")); setHeaderData(2, Qt::Horizontal, tr("Mode")); setHeaderData(3, Qt::Horizontal, tr("DST Address")); setHeaderData(4, Qt::Horizontal, tr("Period")); setHeaderData(5, Qt::Horizontal, tr("Self Address")); select(); }
void PlaylistTableModel::setTableModel(int playlistId) { //qDebug() << "PlaylistTableModel::setTableModel" << playlistId; if (m_iPlaylistId == playlistId) { qDebug() << "Already focused on playlist " << playlistId; return; } m_iPlaylistId = playlistId; QString playlistTableName = "playlist_" + QString::number(m_iPlaylistId); QSqlQuery query(m_database); FieldEscaper escaper(m_database); QStringList columns; columns << PLAYLISTTRACKSTABLE_TRACKID + " AS " + LIBRARYTABLE_ID << PLAYLISTTRACKSTABLE_POSITION << PLAYLISTTRACKSTABLE_DATETIMEADDED << "'' AS " + LIBRARYTABLE_PREVIEW // For sorting the cover art column we give LIBRARYTABLE_COVERART // the same value as the cover hash. << LIBRARYTABLE_COVERART_HASH + " AS " + LIBRARYTABLE_COVERART; // We drop files that have been explicitly deleted from mixxx // (mixxx_deleted=0) from the view. There was a bug in <= 1.9.0 where // removed files were not removed from playlists, so some users will have // libraries where this is the case. QString queryString = QString("CREATE TEMPORARY VIEW IF NOT EXISTS %1 AS " "SELECT %2 FROM PlaylistTracks " "INNER JOIN library ON library.id = PlaylistTracks.track_id " "WHERE PlaylistTracks.playlist_id = %3") .arg(escaper.escapeString(playlistTableName), columns.join(","), QString::number(playlistId)); if (!m_showAll) { queryString.append(" AND library.mixxx_deleted = 0"); } query.prepare(queryString); if (!query.exec()) { LOG_FAILED_QUERY(query); } columns[0] = LIBRARYTABLE_ID; // columns[1] = PLAYLISTTRACKSTABLE_POSITION from above // columns[2] = PLAYLISTTRACKSTABLE_DATETIMEADDED from above columns[3] = LIBRARYTABLE_PREVIEW; columns[4] = LIBRARYTABLE_COVERART; setTable(playlistTableName, LIBRARYTABLE_ID, columns, m_pTrackCollection->getTrackSource()); setSearch(""); setDefaultSort(fieldIndex(ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_POSITION), Qt::AscendingOrder); setSort(defaultSortColumn(), defaultSortOrder()); connect(&m_playlistDao, SIGNAL(changed(int)), this, SLOT(playlistChanged(int))); }
void SqlTableModel::setTable(const QString &tableName) { QSqlTableModel::setTable(tableName); generateRoleNames(); int col = fieldIndex(_sortField); if (col >= 0) { setSort(col, _sortOrder); } select(); }
void ItemViewWidget::showEvent(QShowEvent *event) { if (m_isInitialized) { QTreeView::showEvent(event); return; } const QString name = objectName(); const QString suffix = QLatin1String("ViewWidget"); const QString type = (name.endsWith(suffix) ? name.left(name.size() - suffix.size()) : name); if (type.isEmpty()) { return; } Settings settings(SessionsManager::getReadableDataPath(QLatin1String("views.ini"))); settings.beginGroup(type); setSort(settings.getValue(QLatin1String("sortColumn"), -1).toInt(), ((settings.getValue(QLatin1String("sortOrder"), QLatin1String("ascending")).toString() == QLatin1String("ascending")) ? Qt::AscendingOrder : Qt::DescendingOrder)); const QStringList columns = settings.getValue(QLatin1String("columns")).toString().split(QLatin1Char(','), QString::SkipEmptyParts); if (!columns.isEmpty()) { for (int i = 0; i < model()->columnCount(); ++i) { setColumnHidden(i, true); } disconnect(m_headerWidget, SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveState())); for (int i = 0; i < columns.count(); ++i) { setColumnHidden(columns[i].toInt(), false); if (m_headerWidget) { m_headerWidget->moveSection(m_headerWidget->visualIndex(columns[i].toInt()), i); } } connect(m_headerWidget, SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveState())); } m_headerWidget->setStretchLastSection(true); m_isInitialized = true; QTreeView::showEvent(event); }
/* This constructor must be called! Call it before closing the script header! */ list_base(cgiScript&sc):read_base(),webIO(sc),opened(false),hotCol(0) ,listPg(0), itemsPerPg(12), recCount(0), colCount(0) ,pgCount(0), dsetCount(0) { cgiInput & args = sc.ClientArguments(); filter = cookie.get("lFilter"); // set and cache the current sort order setSort( args ); // set and cache the current filter setFilter( args ); // set and cache the current page of data setPage( args ); }
void HeaderViewWidget::toggleSort(int column) { ItemViewWidget *view = qobject_cast<ItemViewWidget*>(parent()); if (!view) { return; } if (column >= 0 && view->getSortColumn() != column) { setSort(column, Qt::AscendingOrder); } else if (column >= 0 && view->getSortOrder() == Qt::AscendingOrder) { setSort(column, Qt::DescendingOrder); } else { setSort(-1, Qt::AscendingOrder); } }
int main(void) { unsigned m[MAX], saveM[MAX]; unsigned loopInd; for (loopInd = 1; loopInd <= TEST_LOOP_CNT; loopInd++) { printf("\n<<<<< Тест %u >>>>>\n", loopInd); init(m,MAX); memcpy(saveM, m, sizeof(m)); /* Запазва се копие на масива */ printf("Масивът преди сортирането:\n"); print(m,MAX); setSort(m,MAX); printf("Масивът след сортирането:\n"); print(m,MAX); check(m,saveM,MAX); } return 0; }
MovieTableModel::MovieTableModel(QObject *parent) : QSqlRelationalTableModel(parent) { setTable("movie"); setSort(1, Qt::AscendingOrder); setEditStrategy(QSqlTableModel::OnManualSubmit); setHeaderData(0, Qt::Horizontal, trUtf8("ID")); setHeaderData(1, Qt::Horizontal, trUtf8("Title")); setHeaderData(2, Qt::Horizontal, trUtf8("Main characters")); setHeaderData(3, Qt::Horizontal, trUtf8("Director")); setHeaderData(4, Qt::Horizontal, trUtf8("Distributor")); setHeaderData(5, Qt::Horizontal, trUtf8("Release date")); setHeaderData(6, Qt::Horizontal, trUtf8("Status")); setHeaderData(7, Qt::Horizontal, trUtf8("Availability")); }
Status ParsedUpdate::parseQueryToCQ() { dassert(!_canonicalQuery.get()); const ExtensionsCallbackReal extensionsCallback(_opCtx, &_request->getNamespaceString()); // The projection needs to be applied after the update operation, so we do not specify a // projection during canonicalization. auto qr = stdx::make_unique<QueryRequest>(_request->getNamespaceString()); qr->setFilter(_request->getQuery()); qr->setSort(_request->getSort()); qr->setCollation(_request->getCollation()); qr->setExplain(_request->isExplain()); // Limit should only used for the findAndModify command when a sort is specified. If a sort // is requested, we want to use a top-k sort for efficiency reasons, so should pass the // limit through. Generally, a update stage expects to be able to skip documents that were // deleted/modified under it, but a limit could inhibit that and give an EOF when the update // has not actually updated a document. This behavior is fine for findAndModify, but should // not apply to update in general. if (!_request->isMulti() && !_request->getSort().isEmpty()) { qr->setLimit(1); } // $expr is not allowed in the query for an upsert, since it is not clear what the equality // extraction behavior for $expr should be. MatchExpressionParser::AllowedFeatureSet allowedMatcherFeatures = MatchExpressionParser::kAllowAllSpecialFeatures; if (_request->isUpsert()) { allowedMatcherFeatures &= ~MatchExpressionParser::AllowedFeatures::kExpr; } boost::intrusive_ptr<ExpressionContext> expCtx; auto statusWithCQ = CanonicalQuery::canonicalize( _opCtx, std::move(qr), std::move(expCtx), extensionsCallback, allowedMatcherFeatures); if (statusWithCQ.isOK()) { _canonicalQuery = std::move(statusWithCQ.getValue()); } if (statusWithCQ.getStatus().code() == ErrorCodes::QueryFeatureNotAllowed) { // The default error message for disallowed $expr is not descriptive enough, so we rewrite // it here. return {ErrorCodes::QueryFeatureNotAllowed, "$expr is not allowed in the query predicate for an upsert"}; } return statusWithCQ.getStatus(); }
FilmModel::FilmModel(QObject *parent) : QSqlTableModel(parent) { setTable("films"); setEditStrategy(QSqlTableModel::OnManualSubmit); setSort(0, Qt::AscendingOrder); setFilter(""); select(); setHeaderData(1, Qt::Horizontal, "Name"); setHeaderData(2, Qt::Horizontal, "Year"); setHeaderData(3, Qt::Horizontal, "Country"); setHeaderData(4, Qt::Horizontal, "Director"); setHeaderData(5, Qt::Horizontal, "Actors"); setHeaderData(6, Qt::Horizontal, "Type"); setHeaderData(7, Qt::Horizontal, "Genre"); setHeaderData(8, Qt::Horizontal, "Score"); }
SoundCloudAccountModel::SoundCloudAccountModel(QObject *parent) : QSqlTableModel(parent) { m_roles[UserIdRole] = "userId"; m_roles[UsernameRole] = "username"; m_roles[AccessTokenRole] = "accessToken"; m_roles[RefreshTokenRole] = "refreshToken"; m_roles[ScopesRole] = "scopes"; m_roles[ActiveRole] = "active"; #if QT_VERSION < 0x050000 setRoleNames(m_roles); #endif setTable("soundcloudAccounts"); setSort(1, Qt::AscendingOrder); setEditStrategy(QSqlTableModel::OnRowChange); select(); emit countChanged(rowCount()); }
void run() { OldClientWriteContext ctx(&_txn, nss.ns()); addIndex(BSON("a" << 1 << "b" << 1)); addIndex(BSON("a" << 1 << "c" << 1)); // Every doc matches. insert(BSON("_id" << 1 << "a" << 1)); insert(BSON("_id" << 2 << "a" << 2)); insert(BSON("_id" << 3 << "a" << 3)); insert(BSON("_id" << 4)); auto qr = stdx::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{$or: [{a: 1}, {a: {$ne:1}}]}")); qr->setSort(BSON("d" << 1)); auto cq = unittest::assertGet(CanonicalQuery::canonicalize( txn(), std::move(qr), ExtensionsCallbackDisallowExtensions())); Collection* collection = ctx.getCollection(); QueryPlannerParams plannerParams; fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams); WorkingSet ws; std::unique_ptr<SubplanStage> subplan( new SubplanStage(&_txn, collection, &ws, plannerParams, cq.get())); PlanYieldPolicy yieldPolicy(PlanExecutor::YIELD_MANUAL, _clock); ASSERT_OK(subplan->pickBestPlan(&yieldPolicy)); size_t numResults = 0; PlanStage::StageState stageState = PlanStage::NEED_TIME; while (stageState != PlanStage::IS_EOF) { WorkingSetID id = WorkingSet::INVALID_ID; stageState = subplan->work(&id); ASSERT_NE(stageState, PlanStage::DEAD); ASSERT_NE(stageState, PlanStage::FAILURE); if (stageState == PlanStage::ADVANCED) { ++numResults; } } ASSERT_EQ(numResults, 4U); }
MProductos::MProductos(QObject *parent) : QSqlRelationalTableModel(parent) { setTable( "producto" ); setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "Categoria" ); if( preferencias::getInstancia()->value( "Preferencias/Productos/categorias" ).toBool() ) { setRelation( 1, QSqlRelation( "categoria_producto", "id", "nombre" ) ); } setHeaderData( 2, Qt::Horizontal, QString::fromUtf8( "#Código" ) ); setHeaderData( 3, Qt::Horizontal, "Nombre" ); setHeaderData( 4, Qt::Horizontal, "Precio de Costo" ); setHeaderData( 5, Qt::Horizontal, "Precio de venta" ); setHeaderData( 6, Qt::Horizontal, "Descripcion" ); setHeaderData( 7, Qt::Horizontal, "Marca" ); setHeaderData( 8, Qt::Horizontal, "Stock" ); setHeaderData( 9, Qt::Horizontal, "Habilitado" ); setSort( 0, Qt::AscendingOrder ); }
void HeaderViewWidget::toggleSort(QAction *action) { if (action) { const int value = action->data().toInt(); if (value == -2 || value == -3) { ItemViewWidget *view = qobject_cast<ItemViewWidget*>(parent()); if (view) { setSort(view->getSortColumn(), ((value == -2) ? Qt::AscendingOrder : Qt::DescendingOrder)); } } else { toggleSort(value); } } }
UsersModel::UsersModel( QObject* parent ) : BaseModel( parent ), m_filter( UsersModel::AllUsers ) { appendModel( new QSqlQueryModel( this ) ); bool emailEnabled = dataManager->setting( "email_enabled" ).toInt(); if ( emailEnabled ) setColumnMapping( 0, QList<int>() << 1 << 2 << 3 << 4 ); else setColumnMapping( 0, QList<int>() << 1 << 2 << 4 ); setHeaderData( 0, Qt::Horizontal, tr( "Name" ) ); setHeaderData( 1, Qt::Horizontal, tr( "Login" ) ); if ( emailEnabled ) setHeaderData( 2, Qt::Horizontal, tr( "Email" ) ); setHeaderData( emailEnabled ? 3 : 2, Qt::Horizontal, tr( "Access" ) ); setSort( 0, Qt::AscendingOrder ); updateQueries(); }
//------------------------------------------------------------------------------ bool FGStandardComboBox::onAdd() { if(!Parent::onAdd()) return false; popUpCtrl = new FGStandardPopUp(this); AssertFatal(popUpCtrl, "could not allocate memory"); manager->addObject(popUpCtrl); deleteNotify(popUpCtrl); //ensure the entries are sorted setSort(TRUE); //set the bmps char buf[256]; sprintf(buf, "%s_DF.BMP", mBitmapRootName); mTitleBMP = SimResource::get(manager)->load(buf); sprintf(buf, "%s_BD.BMP", mBitmapRootName); mTitleGhostBMP = SimResource::get(manager)->load(buf); return true; }