//! [0] void DeviceModel::refresh() { setQuery("SELECT * FROM tab_devices ORDER BY d_typeID, d_producer, d_name"); setHeaderData(0, Qt::Horizontal, QObject::tr("ID")); setHeaderData(1, Qt::Horizontal, QObject::tr("First name")); setHeaderData(2, Qt::Horizontal, QObject::tr("Last name")); }/*
void SmlAllModel::refresh(int orderColumn, int orderMode) { QString orderString(""); switch (orderColumn) { case 0: { if(orderMode) orderString = "ORDER by sml.smlid DESC"; else orderString = "ORDER by sml.smlid ASC"; } break; case 1: { if(orderMode) orderString = "ORDER by smla.author DESC"; else orderString = "ORDER by smla.author ASC"; } break; case 2: { if(orderMode) orderString = "ORDER by sml.title DESC"; else orderString = "ORDER by sml.title ASC"; } break; case 3: { if(orderMode) orderString = "ORDER by smlp.publisher DESC"; else orderString = "ORDER by smlp.publisher ASC"; } break; } QSqlQuery query("SELECT sml.smlid, smla.author, sml.title, smlp.publisher FROM sheetmusiclibrary sml, smlauthor smla, smlpublisher smlp WHERE smla.smlauthorid=sml.author AND smlp.smlpublisherid=sml.publisher "+orderString, *myW->getMyDb()->getMyPupilDb()); setQuery(query); if (query.lastError().isValid()) qDebug() << "DB Error: 148 - " << query.lastError(); setHeaderData(0, Qt::Horizontal, QObject::tr("Index")); setHeaderData(1, Qt::Horizontal, QObject::tr("Komponist / Author")); setHeaderData(2, Qt::Horizontal, QObject::tr("Titel")); setHeaderData(3, Qt::Horizontal, QObject::tr("Verlag")); }
void EditableSqlModel::refresh() { setQuery("select * from person"); setHeaderData(0, Qt::Horizontal, QObject::tr("ID")); setHeaderData(1, Qt::Horizontal, QObject::tr("First name")); setHeaderData(2, Qt::Horizontal, QObject::tr("Last name")); }
VcsFileChangesModel::VcsFileChangesModel(QObject *parent, bool allowSelection) : QStandardItemModel(parent), d(new VcsFileChangesModelPrivate) { setColumnCount(2); setHeaderData(0, Qt::Horizontal, i18n("Filename")); setHeaderData(1, Qt::Horizontal, i18n("Status")); d->allowSelection = allowSelection; }
MEstablecimiento::MEstablecimiento( QObject *parent ) : QSqlTableModel( parent ) { setTable( "car_establecimientos" ); setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "Nombre" ); setHeaderData( 2, Qt::Horizontal, "#RESMPA" ); }
void EmployeeTableModel::refresh() { clear(); setQuery(selectQ, QSqlDatabase::database("KarbowyDb")); setHeaderData(EMPLOYEE_COLUMN_LOGIN, Qt::Horizontal, "Login"); setHeaderData(EMPLOYEE_COLUMN_PASSWORD, Qt::Horizontal, "Hasło"); setHeaderData(EMPLOYEE_COLUMN_NAME, Qt::Horizontal, "Imię i nazwisko"); }
void BaseSqlTableModel::setHeaderProperties( ColumnCache::Column column, QString title, int defaultWidth) { int fi = fieldIndex(column); setHeaderData(fi, Qt::Horizontal, m_tableColumnCache.columnName(column), TrackModel::kHeaderNameRole); setHeaderData(fi, Qt::Horizontal, title, Qt::DisplayRole); setHeaderData(fi, Qt::Horizontal, defaultWidth, TrackModel::kHeaderWidthRole); }
MPrefCategorias::MPrefCategorias(QObject *parent) : QSqlTableModel(parent) { setTable( "car_categorias" ); setHeaderData( 0, Qt::Horizontal, "#id_db" ); setHeaderData( 1, Qt::Horizontal, "Categoria" ); setHeaderData( 2, Qt::Horizontal, "Especial" ); setEditStrategy( QSqlTableModel::OnManualSubmit ); }
void OrderLineModel::setToEmptyModel() { //! TODO : verify setQuery(""); setHeaderData(OrderLineField_id, Qt::Horizontal, tr("EMPTY")); setHeaderData(OrderLineField_name, Qt::Horizontal, tr("EMPTY")); setHeaderData(OrderLineField_price, Qt::Horizontal, tr("EMPTY")); }
MCaravanaDueno::MCaravanaDueno(QObject *parent) : QAbstractTableModel(parent) { setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "Codigo de Caravana" ); #ifdef GESTOTUX_CARAVANAS_TIENEN_DUENOS setHeaderData( 2, Qt::Horizontal, "Dueño" ); #endif }
MVPresupuestos::MVPresupuestos(QObject *parent) : QSqlRelationalTableModel(parent) { setTable( "v_presupuestos" ); setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "#Presupuesto" ); setHeaderData( 2, Qt::Horizontal, "Destinatario" ); setHeaderData( 3, Qt::Horizontal, "Fecha" ); setHeaderData( 4, Qt::Horizontal, "Total" ); }
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(); }
MCompraProducto::MCompraProducto(QObject *parent) : QSqlRelationalTableModel(parent) { setTable( "compras_productos" ); setHeaderData( 0, Qt::Horizontal, "#item" ); setHeaderData( 1, Qt::Horizontal, "#Compra" ); setHeaderData( 2, Qt::Horizontal, "#Producto" ); setHeaderData( 3, Qt::Horizontal, "Precio Compra" ); setHeaderData( 4, Qt::Horizontal, "Cantidad" ); }
MMascota::MMascota( QObject *parent ) : QSqlRelationalTableModel( parent ) { setTable( "mascota" ); setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "Dueño" ); setRelation( 1, QSqlRelation( "dueno", "id", "apellido" ) ); setHeaderData( 2, Qt::Horizontal, "Nombre" ); setHeaderData( 3, Qt::Horizontal, "Raza" ); setHeaderData( 4, Qt::Horizontal, "Genero" ); }
AboCommentsModel::AboCommentsModel(const QString &telA, QObject *parent) : QSqlTableModel(parent) { setTable("tb_abonentNotes"); setFilter(QString("telA=%1").arg(telA)); select(); setHeaderData(TelA, Qt::Horizontal, trUtf8("Телефон")); setHeaderData(Date, Qt::Horizontal, trUtf8("Дата")); setHeaderData(Text, Qt::Horizontal, trUtf8("Примечание")); }
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(); }
/** * Allows to set the text of the headerView */ void QSearchItemModel::setHeader(QString vocName) { QStringList tokens = (vocName).split("__"); QString lang1 = tokens.value(0); QString lang2 = tokens.value(1); //set the header data setHeaderData(0, Qt::Horizontal, lang1); setHeaderData(1, Qt::Horizontal, lang2); m_vocName = vocName; }
ResumenComprasPorProductos::ResumenComprasPorProductos(QObject *parent) : QSqlQueryModel(parent) { _metodo_temporal = PorMes; consultas.insert( "QSQLITE", "SELECT cp.id_producto as id_producto, SUM( cp.cantidad ), p.nombre AS proveedor, MAX( c.fecha ) as ultima_compra FROM compras_productos AS cp, compras AS c, proveedor AS p WHERE p.id = c.id_proveedor AND cp.id_compra = c.id " ); //consultas.insert( "QMYSQL", "SELECT COUNT( id ) as cantidad, MAX( fecha ) as fecha, strftime( \"%m\" , fecha ) as mes, strftime( \"%Y\", fecha ) as ano, SUM( total ) as total, id_proveedor FROM compras " ); setQuery( consultas.value( QSqlDatabase::database().driverName() ) ); setHeaderData( 0, Qt::Horizontal, "Producto" ); setHeaderData( 1, Qt::Horizontal, "Cantidad Total" ); setHeaderData( 2, Qt::Horizontal, "Proveedor" ); setHeaderData( 3, Qt::Horizontal, QString::fromUtf8( "Fecha última" ) ); _id_producto = -1; }
void Datenmodell::AbfrageStarten(QString welche) { QSqlDatabase DB=QSqlDatabase::database(DBVERBINDUNG,false); if(!DB.isOpen()) return; setQuery(welche,DB); if(lastError().isValid()) { FehlerAufgetreten(lastError().text()); return; } setHeaderData(0,Qt::Horizontal,tr("Zeichen")); setHeaderData(1,Qt::Horizontal,tr("Wort")); }
void KNMusicPlaylistModel::initialHeader() { //Using retranslate to update the header text. retranslate(); //Set header size hint. setHeaderData(0, Qt::Horizontal, QSize(10,23), Qt::SizeHintRole); //Set header alignment for(int i=0;i<MusicDataCount;i++) { setHeaderData(i, Qt::Horizontal, Qt::AlignVCenter, Qt::TextAlignmentRole); } //Set sort flag. setHeaderSortFlag(); }
//----------------------------------------------------------------------------- void PhaseParameterModel::update() { SqlQuery parameterWeightQuery; parameterWeightQuery.prepare(QString("SELECT %4.%1, %2, %3 FROM %4 INNER JOIN %5 ON %4.%6 = %5.%7 WHERE %8 = :phaseId ORDER BY %3 DESC") .arg("ID", "Name", "Weight", "PhaseParameter" , "Parameter", "ParameterID", "ID" , "PhaseID")); //%! Тут нужно все-таки %4.%1 т.е. Id другой. parameterWeightQuery.addBindValue(mPhaseId); parameterWeightQuery.exec(); setQuery(parameterWeightQuery); setHeaderData(0, Qt::Horizontal, tr("ID")); setHeaderData(1, Qt::Horizontal, tr("Name")); setHeaderData(2, Qt::Horizontal, tr("Weight")); }
MPeluqueria::MPeluqueria(QObject *parent , bool relacion ) : QSqlRelationalTableModel(parent) { setTable( "peluqueria" ); setHeaderData( 0, Qt::Horizontal, "#ID" ); setHeaderData( 1, Qt::Horizontal, "Mascota" ); setHeaderData( 2, Qt::Horizontal, "Descripcion" ); setHeaderData( 3, Qt::Horizontal, "Precio" ); setHeaderData( 4, Qt::Horizontal, "Fecha" ); limite = -1; if( relacion == true ) { setRelation( 1, QSqlRelation( "mascota", "id", "nombre" ) ); } }
void CustomHeader::addSection(const QString &txt, const QString &tooltipTxt, QuestionMarkHint questionMark, ClickLabel::HeaderData headerData) { auto headerTextLabel = new QLabel; headerTextLabel->setText(txt); headerTextLabel->setToolTip(tooltipTxt); layout->addWidget(headerTextLabel, layout->rowCount(), 0); if (questionMark == QuestionMarkHint::QuestionMark) { auto questionMarkLabel = new ClickLabel; auto pixmap_2x = QPixmap(QStringLiteral(":/icons/qm-enabled")); #if defined(Q_OS_MAC) pixmap_2x.setDevicePixelRatio(2.0); #endif questionMarkLabel->setPixmap(pixmap_2x); questionMarkLabel->setHeaderData(headerData); // questionMarkLabel->setObjectName(QStringLiteral("questionMarkImg")); connect(questionMarkLabel, &ClickLabel::clicked, this, &CustomHeader::onlineHelpTrigger); layout->addWidget(questionMarkLabel, layout->rowCount() - 1, 1); } }
void DB2TableModel::fillOffsets() { quint16 offset = 0; for (int i = 0; i < fieldCount; i++) { RecordFld rec; rec.type = (FldType)format[i].toLatin1(); rec.offset = offset; switch(format[i].toLatin1()) { case FLD_INT: rec.title = "integer"; offset += sizeof(int); break; case FLD_KEY: rec.title = "key"; offset += sizeof(int); break; case FLD_FLOAT: rec.title = "float"; offset += sizeof(float); break; case FLD_STRING: rec.title = "string"; offset += sizeof(char*); break; } fieldsOffsets.append(rec); setHeaderData(i, Qt::Horizontal, rec.title, Qt::DisplayRole); } emit headerDataChanged(Qt::Horizontal, 1, fieldsOffsets.size()); }
SqlTableModel::SqlTableModel(sql::ResultSet result, Wt::WContainerWidget* parent) : Wt::WStandardItemModel(0, 0, parent) { sql::ResultSetMetaData * rsmd = result.getResultSetMetaData(); int fieldCount = rsmd->getColumnCount(); insertColumns(0, fieldCount); for (int a = 0; a < fieldCount; a++) { /* * for locale support * if(!setHeaderData(a,Wt::WString::tr(rsmd->getColumnName(a).c_str()))){ */ if (!setHeaderData(a, rsmd->getColumnName(a))) { // if(!setHeaderData(a,boost::any(rsmd->getColumnName(a)))){ // if(!setHeaderData(a,boost::any(string("test")))){ std::cout << "Failed" << std::endl; } } for (int a = 0; result.next(); a++) { if (rowCount() <= a) insertRow(rowCount()); for (int b = 0; b < fieldCount; b++) if (!setData(a, b, result.getString(b))) { // if(!setData(a,b,boost::any(result.getString(b)))){ // if(!setData(a,b,boost::any(new string("test")))){ std::cout << "set data Failed" << std::endl; }else { } } // load(result); }
void ZDataModel::parse(const ZConfig &el){ if(el.hasAttribute("table")){ setTable(el.attribute("table")); for(int i = 0; i < columnCount(); i++){ _columns.insert(headerData(i,Qt::Horizontal).toString(), i); } foreach(const ZConfig &field, el.children("zee:field")){ if(_columns.contains(field.attribute("name"))){ // set header title if(field.hasAttribute("title")){ setHeaderData(_columns.value(field.attribute("name")), Qt::Horizontal, QVariant(field.attribute("title"))); } if(field.hasAttribute("belongsTo")){ QString relation = field.attribute("belongsTo"); QString rTable = relation.section(":",0,0); QString rKey = relation.section(":",1,1); QString rDisplay = relation.section(":",2,2); if(!(rTable.isEmpty() && rKey.isEmpty() && rDisplay.isEmpty())){ setRelation(_columns.value(field.attribute("name")), QSqlRelation(rTable,rKey,rDisplay)); } } } } }
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 StringListModel::setHeader(const QStringList &item) { if (item.size() != columnCount()) return; for (int i = 0; i < item.size(); i++) setHeaderData(i, Qt::Horizontal, item.at(i)); }
void checkpivotmodel::buildQuery() { QString query,from,where; query="select df.runid,df.value"; from=" from detectorFlag as df"; where=" where df.tagid=128"; int colid=2; for (unsigned int i=0; i<infocolumns.size(); i++) { query+=QString(",rd%1.value").arg(i); from+=QString(" join rundata as rd%1 on df.runid=rd%1.runid ").arg(i); where+=infocolumns[i].clause(QString("rd%1").arg(i)); } for (unsigned int i=0; i<detectorcolumns.size(); i++) { query+=QString(",df%1.value").arg(i); from+=QString(" join detectorFlag as df%1 on df.runid=df%1.runid ").arg(i); where+=detectorcolumns[i].clause(QString("df%1").arg(i)); } QString q=query+from+where+addFilter+" group by df.runid order by df.runid"; setQuery(q); while (canFetchMore()) fetchMore(); setHeaderData(0, Qt::Horizontal, tr("Run ID")); setHeaderData(1, Qt::Horizontal, tr("Type")); for (unsigned int i=0; i<infocolumns.size(); i++) { setHeaderData(colid,Qt::Horizontal,infocolumns[i].name ); colid++; } firstdetectorcolumn=colid; for (unsigned int i=0; i<detectorcolumns.size(); i++) { setHeaderData(colid,Qt::Horizontal,detectorcolumns[i].name); colid++; } }
MemoryAreaView::MemoryAreaView(QWidget * parent, medusa::Medusa &core) : QTreeView(parent) , View(medusa::Document::Subscriber::MemoryAreaUpdated, core.GetDocument()) , _core(core) { qRegisterMetaType<medusa::MemoryArea*>("MemoryArea"); setEditTriggers(QAbstractItemView::NoEditTriggers); auto model = new QStandardItemModel(this); model->setColumnCount(4); model->setHeaderData(0, Qt::Horizontal, "Name"); model->setHeaderData(1, Qt::Horizontal, "Address"); model->setHeaderData(2, Qt::Horizontal, "Size"); model->setHeaderData(3, Qt::Horizontal, "Access"); setModel(model); connect(this, SIGNAL(doubleClicked(QModelIndex const&)), this, SLOT(onDoubleClickMemoryArea(QModelIndex const&))); connect(this, SIGNAL(memoryAreaAdded(medusa::MemoryArea const&)), this, SLOT(onAddMemoryArea(medusa::MemoryArea const&))); }