QString getBlock(char_type c)
{
// store an educated guess for the next search
+ // FIXME THREAD
static int lastBlock = 0;
// "clever reset"
// guessing was wrong so far. do a real search.
int i = 0;
- while (c > unicode_blocks[i].end && i < no_blocks)
+ while (i < no_blocks && c > unicode_blocks[i].end)
++i;
if (i == no_blocks)
return QString();
{
public:
Model(GuiSymbols * parent)
- : QAbstractItemModel(parent), parent_(parent)
+ : QAbstractItemModel(parent)
{}
QModelIndex index(int row, int column, QModelIndex const &) const
static QString const strCharacter = qt_("Character: ");
static QString const strCodePoint = qt_("Code Point: ");
+ // FIXME THREAD
static char codeName[10];
char_type c = symbols_.at(index.row());
private:
friend class GuiSymbols;
- GuiSymbols * parent_;
-
+
QList<char_type> symbols_;
};
symbolsLW->setViewMode(QListView::IconMode);
// increase the display size of the symbols a bit
- QFont font= symbolsLW->font();
- int size = font.pointSize() + 3;
+ QFont font = symbolsLW->font();
+ const int size = font.pointSize() + 3;
font.setPointSize(size);
symbolsLW->setFont(font);
QFontMetrics fm(font);
- symbolsLW->setGridSize(QSize(fm.maxWidth() + 2, fm.height() + 2));
+ const int cellHeight = fm.height() + 2;
+ // FIXME: using at least cellHeight because of
+ // QFontMetrics::maxWidth() is returning 0 with Qt/Cocoa on Mac OS
+ const int cellWidth = max(cellHeight, fm.maxWidth() + 2);
+ symbolsLW->setGridSize(QSize(cellWidth, cellHeight));
symbolsLW->setModel(model_);
}