+/////////////////////////////////////////////////////////////////////
+//
+// GuiSymbols::Model
+//
+/////////////////////////////////////////////////////////////////////
+
+class GuiSymbols::Model : public QAbstractItemModel
+{
+public:
+ Model(GuiSymbols * parent)
+ : QAbstractItemModel(parent), parent_(parent)
+ {}
+
+ QModelIndex index(int row, int column, QModelIndex const &) const
+ {
+ return createIndex(row, column);
+ }
+
+ QModelIndex parent(QModelIndex const &) const
+ {
+ return QModelIndex();
+ }
+
+ int rowCount(QModelIndex const &) const
+ {
+ return symbols_.count();
+ }
+
+ int columnCount(QModelIndex const &) const
+ {
+ return 1;
+ }
+
+ QVariant data(QModelIndex const & index, int role) const
+ {
+ static QString const strCharacter = qt_("Character: ");
+ static QString const strCodePoint = qt_("Code Point: ");
+
+ static char codeName[10];
+
+ char_type c = symbols_.at(index.row());
+
+ if (role == Qt::TextAlignmentRole)
+ return QVariant(Qt::AlignCenter);
+
+ if (role == Qt::DisplayRole)
+ return toqstr(c);
+
+ if (role == Qt::ToolTipRole) {
+ sprintf(codeName, "0x%04x", c);
+ return strCharacter + toqstr(c) + '\n'
+ + strCodePoint + QLatin1String(codeName);
+ }
+
+ //LYXERR0("role: " << role << " row: " << index.row());
+ return QVariant();
+ }
+
+ void setSymbols(QList<char_type> const & symbols)
+ {
+ symbols_ = symbols;
+ QAbstractItemModel::reset();
+ }
+
+private:
+ friend class GuiSymbols;
+ GuiSymbols * parent_;
+
+ QList<char_type> symbols_;
+};
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// GuiSymbols
+//
+/////////////////////////////////////////////////////////////////////
+