QVariant NixArrayTableModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::ToolTipRole)) { return QVariant(); } if (role == Qt::DisplayRole) { double d = 0.0; nix::NDSize count(shape.size(), 1); if ((index.row() < rows) && (index.column() < cols)) { nix::NDSize offset(shape.size(), 0); offset[0] = index.row(); if (shape.size() > 1) { offset[1] = index.column(); } if (shape.size() > 2) { offset[2] = page; } array.getData(nix::DataType::Double, &d, count, offset); return QVariant(d); } } else if (role == Qt::ToolTipRole) { std::string label = (array.label() ? *array.label() : "") + (array.unit() ? " [" + *array.unit() + "]" : "") + " @ \n"; label = label + headerData(index.row(), Qt::Vertical, Qt::ToolTipRole).toString().toStdString() + ": " + headerData(index.row(), Qt::Vertical, Qt::DisplayRole).toString().toStdString() + "\n"; label = label + headerData(index.column(), Qt::Horizontal, Qt::ToolTipRole).toString().toStdString() + ": " + headerData(index.column(), Qt::Horizontal, Qt::DisplayRole).toString().toStdString() + "\n"; return QString::fromStdString(label); } return QVariant(); }
QString KWQQuizModel::langAnswer() { if (column(m_list.at(m_currentQuestion)) == 0) return headerData(0, Qt::Horizontal, Qt::DisplayRole).toString(); else return headerData(1, Qt::Horizontal, Qt::DisplayRole).toString();; }
QString KWQQuizModel::kbAnswer() { int col = column(m_list.at(m_currentQuestion)); QString result; if (col == 0) return headerData(0, Qt::Horizontal, KWQTableModel::KeyboardLayoutRole).toString(); if (col == 1) return headerData(1, Qt::Horizontal, KWQTableModel::KeyboardLayoutRole).toString(); return result; }
void RecollModel::saveAsCSV(FILE *fp) { if (m_source.isNull()) return; int cols = columnCount(); int rows = rowCount(); vector<string> tokens; for (int col = 0; col < cols; col++) { QString qs = headerData(col, Qt::Horizontal,Qt::DisplayRole).toString(); tokens.push_back((const char *)qs.toUtf8()); } string csv; stringsToCSV(tokens, csv); fprintf(fp, "%s\n", csv.c_str()); tokens.clear(); for (int row = 0; row < rows; row++) { Rcl::Doc doc; if (!m_source->getDoc(row, doc)) { continue; } for (int col = 0; col < cols; col++) { tokens.push_back(m_getters[col](m_fields[col], doc)); } stringsToCSV(tokens, csv); fprintf(fp, "%s\n", csv.c_str()); tokens.clear(); } }
QString MotionLibrary::toHtml() const { QString html = "<table border=\"1\"><tr>"; // Header for (int i = 0; i < columnCount(); ++i) html += "<th>" + headerData(i, Qt::Horizontal).toString() + "</th>"; html += "</tr>"; // Data for (int r = 0; r < rowCount(); ++r) { html += "<tr>"; for (int c = 0; c < columnCount(); ++c) html += "<td>" + data(index(r, c)).toString() + "</td>"; html += "</tr>"; } html += "</table>"; // // Details // html += "<ol>"; // foreach (Motion *motion, m_motions) // html += "<li>" + motion->toHtml() + "</li>"; // // html += "</ol>"; return html; }
QString NonlinearProperty::toHtml() const { QString html = tr( "<h4>%1</h4>" "<table border = \"0\">" "<tr><th>Type:</th><td>%1</td></tr>" "<tr><th>Name:</th><td>%2</td></tr>" "</table>") .arg(m_type == ModulusReduction ? tr("Shear Modulus Reduction") : tr("Damping Ratio")) .arg(m_name); html += "<table border=\"1\"><tr>"; // Header for (int i = 0; i < columnCount(); ++i) html += "<th>" + headerData(i, Qt::Horizontal).toString() + "</th>"; html += "</tr>"; // Data for (int r = 0; r < rowCount(); ++r) { html += "<tr>"; for (int c = 0; c < columnCount(); ++c) html += "<td>" + data(index(r, c)).toString() + "</td>"; html += "</tr>"; } html += "</table>"; return html; }
QVariant PasswordsModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::SizeHintRole) { QFont font; font.setPointSize(10); QFontMetrics fm(font); int height = fm.height() + fm.height()/3; int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString()); return QSize(width, height); } if (orientation == Qt::Horizontal) { if (role != Qt::DisplayRole) return QVariant(); switch (section) { case 0: return tr("Web URL"); case 1: return tr("User Name"); case 2: return tr("Password"); default: return QVariant(); } } return QAbstractTableModel::headerData(section, orientation, role); }
QVariant ExosModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); QStringList exoRecord = exosList.at(index.row()+1); if (role == Qt::DisplayRole) { return exoRecord.at(index.column()); } if (role == Qt::ToolTipRole) { QString tip, key, value; tip = "<table>"; int maxLines = exoRecord.count(); for (int i=0; i<maxLines; i++) { key = headerData(i, Qt::Horizontal, Qt::DisplayRole).toString(); value = exoRecord.at(i); if (!value.isEmpty()) tip += QString("<tr><td><b>%1</b>: %2</td></tr>").arg(key, value); } tip += "</table>"; return tip; } return QVariant(); }
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 SqlTableModel::ouvrirCSV(QString commande) { QTemporaryFile* temporaryFile = new QTemporaryFile(parent()); if (temporaryFile->open()) { QxtCsvModel csv(this); csv.insertColumns(0, columnCount()); csv.insertRows(0, rowCount()); for (int column = 0; column < csv.columnCount(); column ++) { csv.setHeaderText(column, headerData(column, Qt::Horizontal).toString()); } for (int row = 0; row < csv.rowCount(); row ++) { for (int column = 0; column < csv.columnCount(); column ++) { csv.setText(row, column, QSqlTableModel::data(index(row, column)).toString()); } } csv.toCSV(temporaryFile->fileName(), true); temporaryFile->close(); QProcess* process = new QProcess(); process->start(commande, QStringList { temporaryFile->fileName() }); connect(process, SIGNAL(finished(int)), temporaryFile, SLOT(deleteLater())); } else { qCritical() << temporaryFile->errorString(); } }
void MonrepoSqlQueryModel::generateRoleNames() { m_roleNames.clear(); for (int i = 0; i < columnCount(); i++) m_roleNames[Qt::UserRole + i + 1] = QVariant( (headerData(i, Qt::Horizontal)).toString().toUtf8() ).toByteArray(); }
bool RealEstateQueryModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) { if (value != headerData(section, orientation, role) && orientation == Qt::Horizontal) { fColumnNames[section] = value; emit headerDataChanged(orientation, section, section); return true; } return false; }
QVariant pPartitionModel::data( const QModelIndex& index, int role ) const { if ( !index.isValid() || index.row() < 0 || index.row() >= rowCount( index.parent() ) || index.column() < 0 || index.column() >= columnCount( index.parent() ) ) { return QVariant(); } const pPartition& partition = mPartitions[ index.row() ]; switch ( role ) { case Qt::DecorationRole: { if ( index.column() == pPartition::Label ) { } break; } case Qt::DisplayRole: { switch ( index.column() ) { case pPartition::Label: case pPartition::DevicePath: case pPartition::FileSystem: case pPartition::MountPoints: case pPartition::DeviceVendor: case pPartition::DeviceModel: case pPartition::DisplayText: return partition.property( pPartition::Property( index.column() ) ); case pPartition::FileSystemId: return QString::number( partition.property( pPartition::Property( index.column() ) ).toLongLong(), 16 ).toUpper().prepend( "0x" ); case pPartition::TotalSize: case pPartition::UsedSize: case pPartition::FreeSize: return pCoreUtils::fileSizeToString( partition.property( pPartition::Property( index.column() ) ).toLongLong() ); case pPartition::LastCheck: return partition.property( pPartition::LastCheck ).toDateTime().toString( Qt::SystemLocaleShortDate ); } break; } case Qt::ToolTipRole: { QStringList tooltip; for ( int i = 0; i < columnCount(); i++ ) { tooltip << QString( "<b>%1:</b> %2" ) .arg( headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString() ) .arg( data( index.sibling( index.row(), i ), Qt::DisplayRole ).toString() ) ; } return tooltip.join( "<br />" ); break; } } return QVariant(); }
//====================================================================== // DATABASEMODEL //====================================================================== Qt::ItemFlags DatabaseModel::flags(const QModelIndex& index) const { // Only notes can be updated manually Qt::ItemFlags flags = QSqlQueryModel::flags(index); if (headerData(index.column(), Qt::Horizontal) == "notes") flags |= Qt::ItemIsEditable; return flags; }
QVariant WGTransposeProxy::headerData(int section, Qt::Orientation orientation, int role) const { auto source = sourceModel(); if (source == nullptr) { return QVariant(); } return source->headerData(section, orientation == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal, role); }
int QAbstractItemModel_headerData(lua_State* const state) { auto self = lua::get<QAbstractItemModel*>(state, 1); if (lua_gettop(state) == 3) { lua::push(state, self->headerData( lua::get<int>(state, 2), lua::get<Qt::Orientation>(state, 3) )); } else { lua::push(state, self->headerData( lua::get<int>(state, 2), lua::get<Qt::Orientation>(state, 3), lua::get<int>(state, 4) )); } return 1; }
void qMirrorModel::on_headerDataChanged(Qt::Orientation orientation, int first, int last) { qDebug() << "QMirrorModel::on_headerDataChanged"; for(int i = first; i <= last; ++i) { QVariant hdr = srcModel->headerData(i, orientation, Qt::DisplayRole); if(headerData(i, orientation) != hdr) setHeaderData(i, orientation, Qt::DisplayRole); } }
int Model::fieldIndex(const QString &fieldName) { int index = m_fields.value(fieldName, -1); if (index == -1) { bool ok = false; int i = fieldName.toInt(&ok); if (ok && !headerData(i, Qt::Horizontal).isNull()) return i; } return m_fields.value(fieldName, -1); }
QByteArray TestModel::save() { QDomDocument doc; QDomProcessingInstruction pi = doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf8\""); doc.appendChild(pi); QDomElement modelEl = doc.createElement("model"); doc.appendChild(modelEl); QDomElement cellsEl = doc.createElement("cells"); cellsEl.setAttribute("rows", rowCount()); cellsEl.setAttribute("cols", columnCount()); modelEl.appendChild(cellsEl); QDomElement titlesEl = doc.createElement("titles"); for (int i = 0; i < columnCount(); i++) { QDomElement col = doc.createElement(QString("col%1").arg(i)); QDomText text = doc.createTextNode(headerData(i, Qt::Horizontal, Qt::DisplayRole).toString()); col.appendChild(text); titlesEl.appendChild(col); } modelEl.appendChild(titlesEl); for (int row = 0; row < rowCount(); row++) { QDomElement itemRow = doc.createElement(QString("row%1").arg(row)); for (int col = 0; col < columnCount(); col++ ) { //TODO save images if (index(row, col).data().toString().simplified().isEmpty()) { continue; } QDomElement itemCol = doc.createElement(QString("col%1").arg(col)); itemCol.setAttribute("type", QVariant::typeToName(columnType(col))); QDomText text = doc.createTextNode(index(row, col).data().toByteArray()); itemCol.appendChild(text); itemRow.appendChild(itemCol); } if (itemRow.childNodes().count() > 0) cellsEl.appendChild(itemRow); } // QFile file("c:/test.xml"); // if(file.open(QIODevice::WriteOnly)) { // QTextStream(&file) << doc.toString(); // file.close(); // } return doc.toByteArray().toBase64(); }
QModelIndex BlockPropertyModel::indexForProperty( const QString &property, int row ) { int col = -1; for( int idx = 0; idx < columnCount( QModelIndex() ); ++idx ) if( headerData(idx, Qt::Horizontal, Qt::DisplayRole ).toString() == property ) col = idx; if( col == -1 ) return QModelIndex(); else return index(row, col); }
QVariant ChartItemModel::data( const QModelIndex &index, int role ) const { QString r; if ( role == KDChart::DatasetPenRole ) r = "DatasetPenRole"; if ( role == KDChart::DatasetBrushRole ) r = "DatasetBrushRole"; if ( role == KDChart::DataValueLabelAttributesRole ) r = "DataValueLabelAttributesRole"; if ( role == KDChart::ThreeDAttributesRole ) r = "ThreeDAttributesRole"; if ( role == KDChart::LineAttributesRole ) r = "LineAttributesRole"; if ( role == KDChart::ThreeDLineAttributesRole ) r = "ThreeDLineAttributesRole"; if ( role == KDChart::BarAttributesRole ) r = "BarAttributesRole"; if ( role == KDChart::StockBarAttributesRole ) r = "StockBarAttributesRole"; if ( role == KDChart::ThreeDBarAttributesRole ) r = "ThreeDBarAttributesRole"; if ( role == KDChart::PieAttributesRole ) r = "PieAttributesRole"; if ( role == KDChart::ThreeDPieAttributesRole ) r = "ThreeDPieAttributesRole"; if ( role == KDChart::DataHiddenRole ) r = "DataHiddenRole"; if ( role == KDChart::ValueTrackerAttributesRole ) r = "ValueTrackerAttributesRole"; if ( role == KDChart::CommentRole ) r = "CommentRole"; QVariant result; if ( role == Qt::DisplayRole ) { r = "DisplayRole"; switch ( index.column() ) { case 0: result = bcwsCost( index.row() ); break; case 1: result = bcwpCost( index.row() ); break; case 2: result = acwpCost( index.row() ); break; case 3: result = bcwsEffort( index.row() ); break; case 4: result = bcwpEffort( index.row() ); break; case 5: result = acwpEffort( index.row() ); break; default: break; } //kDebug()<<index<<r<<result; return result; } else if ( role == KDChart::DatasetBrushRole ) { return headerData( index.column(), Qt::Horizontal, role ); } else if ( role == KDChart::DatasetPenRole ) { return headerData( index.column(), Qt::Horizontal, role ); } //kDebug()<<index<<r<<result; return result; }
void ExosModel::updateModel(QMap<QString,QString> newRowMap, bool update) { if (!update) { QStringList curList=QStringList(); QStringList headerList = Preferences::p_getMetaToView(); QStringList tempList = Preferences::p_getMetaList(); for (int i=0;i<tempList.size();i++) { if (!headerList.contains(tempList.at(i))) headerList << tempList.at(i); curList.insert(i,QString()); } QMapIterator<QString, QString> j(newRowMap); while (j.hasNext()) { j.next(); if (curList.at(headerList.indexOf(j.key())).isEmpty()) { curList.replace(headerList.indexOf(j.key()),j.value()); } else curList.replace(headerList.indexOf(j.key()),curList.at(headerList.indexOf(j.key()))+"; "+j.value()); } exosList.append(curList); } else { QStringList toUpdate; QString header; QString filePath; for (int i=0;i<Preferences::p_getMetaSize();i++) { header = headerData(i,Qt::Horizontal,Qt::DisplayRole).toString(); toUpdate << newRowMap.value(header); if (header=="filepath") filePath=newRowMap.value(header); } for (int i = 0; i < exosList.size(); ++i) { if (exosList.at(i).contains(filePath)) exosList.replace(i,toUpdate); } } endResetModel(); }
bool DatabaseModel::setData(const QModelIndex& index, const QVariant& value, int /*role*/) { // Only notes can be updated manually if (headerData(index.column(), Qt::Horizontal) != "notes") return false; // TODO: Grab indices in a more robust manner QModelIndex repoIndex = this->index(index.row(), 1); QModelIndex fileIndex = this->index(index.row(), 2); QModelIndex msgIndex = this->index(index.row(), 4); // Update error notes. Errors are considered identical if the same message // originates from the same file QString updateQuery = "UPDATE Errors SET notes=? " "WHERE file=" " (SELECT id FROM Files WHERE file=? AND repo=" " (SELECT id FROM Repos WHERE repo=?)" " ) " "AND message=" " (SELECT id FROM Messages WHERE message=?)"; QSqlQuery q; q.prepare(updateQuery); q.addBindValue(value); q.addBindValue(data(fileIndex)); q.addBindValue(data(repoIndex)); q.addBindValue(data(msgIndex)); bool ok = q.exec(); // Refresh. Block modelAboutToBeReset()/modelReset() signals // to maintain the views' sort order and scroll position if (ok) { q = this->query(); q.exec(); this->blockSignals(true); this->setQuery(q); while (canFetchMore()) fetchMore(); this->blockSignals(false); } return ok; }
QVariant TableModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); if (index.row() >= _rowCount || index.row() < 0) return QVariant(); if (role == Qt::DisplayRole) { QSqlRecord record = _model->record(index.row()); QString header = headerData(index.column()).toString(); QString value = record.value(header).toString(); return value; } return QVariant(); }
QVariant RelationItemModel::data( const QModelIndex &index, int role ) const { if ( role == Qt::TextAlignmentRole ) { return headerData( index.column(), Qt::Horizontal, role ); } QVariant result; Relation *r = relation( index ); if ( r != 0 ) { result = m_relationmodel.data( r, index.column(), role ); } if ( result.isValid() ) { if ( role == Qt::DisplayRole && result.type() == QVariant::String && result.toString().isEmpty()) { // HACK to show focus in empty cells result = " "; } return result; } return result; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- QVariant SGRDFTableModel::data(const QModelIndex& index, qint32 role) const { if (!index.isValid()) { return QVariant(); } if (role == Qt::SizeHintRole) { QStyleOptionComboBox comboBox; comboBox.currentText = QString("10001"); if (index.column() < SGRDFTableModel::ColumnCount) { const QString header = headerData(index.column(), Qt::Horizontal, Qt::DisplayRole).toString(); if (header.length() > comboBox.currentText.length()) { comboBox.currentText = header; } } else { Q_ASSERT(false); } QFontMetrics fontMetrics(data(index, Qt::FontRole) .value<QFont > ()); comboBox.fontMetrics = fontMetrics; QSize size(fontMetrics.width(comboBox.currentText), fontMetrics.height()); return dream3dApp->style()->sizeFromContents(QStyle::CT_ComboBox, &comboBox, size); } else if (role == Qt::TextAlignmentRole) { return int(Qt::AlignRight | Qt::AlignVCenter); } else if (role == Qt::DisplayRole || role == Qt::EditRole) { int col = index.column(); if (col == Frequency) { return QVariant(m_Frequencies[index.row()]); } } return QVariant(); }
QVariant ChartItemModel::headerData( int section, Qt::Orientation orientation, int role ) const { QVariant result; if ( role == Qt::DisplayRole ) { if ( orientation == Qt::Horizontal ) { switch ( section ) { case 0: return i18nc( "Cost based Budgeted Cost of Work Scheduled", "BCWS Cost" ); case 1: return i18nc( "Cost based Budgeted Cost of Work Performed", "BCWP Cost" ); case 2: return i18nc( "Cost based Actual Cost of Work Performed", "ACWP Cost" ); case 3: return i18nc( "Effort based Budgeted Cost of Work Scheduled", "BCWS Effort" ); case 4: return i18nc( "Effort based Budgeted Cost of Work Performed", "BCWP Effort" ); case 5: return i18nc( "Effort based Actual Cost of Work Performed", "ACWP Effort" ); default: return QVariant(); } } else { return startDate().addDays( section ).toString( i18nc( "Date format used as chart axis labels. Must follow QDate specification.", "MM.dd" ) ); } } else if ( role == KDChart::DatasetBrushRole ) { if ( orientation == Qt::Horizontal ) { switch ( section ) { case 0: result = QBrush( Qt::red ); break; case 1: result = QBrush( Qt::green ); break; case 2: result = QBrush( Qt::blue ); break; case 3: result = QBrush( Qt::cyan ); break; case 4: result = QBrush( Qt::magenta ); break; case 5: result = QBrush( Qt::darkYellow ); break; default: break; } //kDebug()<<this<<orientation<<section<<"DatasetBrushRole"<<result; return result; } } else if ( role == KDChart::DatasetPenRole ) { QPen p; p.setBrush( headerData( section, orientation, KDChart::DatasetBrushRole ).value<QBrush>() ); result = p; //kDebug()<<section<<"DatasetPenRole"<<result; return result; } return ItemModelBase::headerData(section, orientation, role); }
QVariant CookieExceptionsModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::SizeHintRole) { QFont font; font.setPointSize(10); QFontMetrics fm(font); int height = fm.height() + fm.height() / 3; int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString()); return QSize(width, height); } if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { case 0: return tr("Website"); case 1: return tr("Rule"); } } return QAbstractTableModel::headerData(section, orientation, role); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- QVariant SGMDFTableModel::data(const QModelIndex& index, qint32 role) const { if (!index.isValid()) { return QVariant(); } if (role == Qt::SizeHintRole) { QStyleOptionFrame comboBox; QLineEdit contents("1"); switch(index.column()) { case Angle: { contents.setText( QString("11.") ); const QString header = headerData(Angle, Qt::Horizontal, Qt::DisplayRole).toString(); if (header.length() > contents.text().length()) { contents.text() = header; } break; } case Axis: { contents.setText( QString("1,1,1") ); const QString header = headerData(Axis, Qt::Horizontal, Qt::DisplayRole).toString(); if (header.length() > contents.text().length()) { contents.text() = header; } break; } case Weight: { contents.setText( QString("11.") ); const QString header = headerData(Weight, Qt::Horizontal, Qt::DisplayRole).toString(); if (header.length() > contents.text().length()) { contents.text() = header; } break; } default: Q_ASSERT(false); } QFontMetrics fontMetrics(data(index, Qt::FontRole) .value<QFont > ()); comboBox.fontMetrics = fontMetrics; QSize size(fontMetrics.width(contents.text()), fontMetrics.height()); return dream3dApp->style()->sizeFromContents(QStyle::CT_ComboBox, &comboBox, size); } else if (role == Qt::TextAlignmentRole) { return int(Qt::AlignRight | Qt::AlignVCenter); } else if (role == Qt::DisplayRole || role == Qt::EditRole) { int col = index.column(); if (col == Angle) { return QVariant(m_Angles[index.row()]); } else if (col == Weight) { return QVariant(m_Weights[index.row()]); } else if (col == Axis) { return QVariant(m_Axis[index.row()]); } } return QVariant(); }
QVariant UserListModel::data(const QModelIndex & index, int role) const { if (!index.isValid()) return QVariant(); UserListItem * item = static_cast<UserListItem*>(index.internalPointer()); if (!item) return QVariant(); switch (role){ case Qt::DisplayRole: { switch (index.column()) { case COLUMN_NICK: return item->nick; case COLUMN_COMMENT: return item->comm; case COLUMN_TAG: return item->tag; case COLUMN_CONN: return item->conn; case COLUMN_EMAIL: return item->email; case COLUMN_SHARE: return WulforUtil::formatBytes(item->share); case COLUMN_IP: return item->ip; } break; } case Qt::DecorationRole: { if (index.column() != COLUMN_NICK) break; if (item->px) return (*item->px); break; } case Qt::ToolTipRole: { if (index.column() == COLUMN_SHARE) return QString::number(item->share); else { QString ttip = ""; ttip = "<b>" + headerData(COLUMN_NICK, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + item->nick + "<br/>"; ttip += "<b>" + headerData(COLUMN_COMMENT, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + item->comm + "<br/>"; ttip += "<b>" + headerData(COLUMN_EMAIL, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + item->email + "<br/>"; ttip += "<b>" + headerData(COLUMN_IP, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + item->ip + "<br/>"; ttip += "<b>" + headerData(COLUMN_SHARE, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + WulforUtil::formatBytes(item->share) + "<br/>"; QString tag = item->tag; WulforUtil::getInstance()->textToHtml(tag, true); ttip += "<b>" + headerData(COLUMN_TAG, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + tag + "<br/>"; ttip += "<b>" + headerData(COLUMN_CONN, Qt::Horizontal, Qt::DisplayRole).toString() + "</b>: " + item->conn + "<br/>"; if (item->isOp) ttip += tr("<b>Hub role</b>: Operator"); else ttip += tr("<b>Hub role</b>: User"); if (FavoriteManager::getInstance()->isFavoriteUser(item->ptr)) ttip += tr("<br/><b>Favorite user</b>"); return ttip; } break; } case Qt::TextAlignmentRole: { if (index.column() == COLUMN_SHARE) return static_cast<int>(Qt::AlignRight | Qt::AlignVCenter); break; } case Qt::FontRole: { QFont font; font.setBold(true); if (item->fav && WBGET(WB_CHAT_HIGHLIGHT_FAVS)) return font; break; } } return QVariant(); }