if (!index.isValid())
return QVariant();
- static QString const strCharacter = qt_("Character: ");
- static QString const strCodePoint = qt_("Code Point: ");
-
char_type c = symbols_.at(index.row());
switch (role) {
case Qt::DisplayRole:
return toqstr(c);
case Qt::ToolTipRole: {
- char codeName[10];
- sprintf(codeName, "0x%04x", c);
- return strCharacter + toqstr(c) + '\n'
- + strCodePoint + QLatin1String(codeName);
+ QString latex;
+ if (encoding_) {
+ // how is the character output in the current encoding?
+ docstring const code = encoding_->latexChar(c).first;
+ // only show it when it is not coded by itself
+ if (code != docstring(1, c))
+ latex = qt_("<p>LaTeX code: %1</p>").arg(toqstr(code));
+ }
+ return formatToolTip(QString("<p align=center><span "
+ "style=\"font-size: xx-large;\">%1"
+ "</span><br>U+%2</p>%3")
+ .arg(toqstr(c))
+ .arg(QString("%1").arg(c, 0, 16).toUpper())
+ .arg(latex));
}
case Qt::SizeHintRole:
// Fix many symbols not displaying in combination with
}
}
- void setSymbols(QList<char_type> const & symbols)
+ void setSymbols(QList<char_type> const & symbols, Encoding const * encoding)
{
beginResetModel();
beginInsertRows(QModelIndex(), 0, symbols.size() - 1);
symbols_ = symbols;
+ encoding_ = encoding;
endInsertRows();
endResetModel();
}
friend class GuiSymbols;
QList<char_type> symbols_;
+ Encoding const * encoding_;
};
}
bool const show_all = categoryFilterCB->isChecked();
+ Encoding const * const enc = encodings.fromLyXName(encoding_);
+
if (symbols_.empty() || update_combo)
- symbols_ = encodings.fromLyXName(encoding_)->symbolsList();
+ symbols_ = enc->symbolsList();
if (!show_all) {
for (int i = 0 ; i < no_blocks; ++i)
used_blocks[block] = numItem;
}
}
- model_->setSymbols(s);
+ model_->setSymbols(s, enc);
if (update_combo) {
// update category combo