void GuiSymbols::scrollToItem(QString const & category)
{
if (used_blocks.find(category) != used_blocks.end()) {
- symbolsLW->scrollToItem(used_blocks[category],
- QAbstractItemView::PositionAtTop);
+ int row = used_blocks[category];
+ QModelIndex index = symbolsLW->model()->index(row, 0, QModelIndex());
+ symbolsLW->scrollTo(index, QAbstractItemView::PositionAtTop);
}
}
static QString const strCodePoint = qt_("Code Point: ");
SymbolsList::const_iterator const end = symbols_.end();
+ int numItem = 0;
for (SymbolsList::const_iterator it = symbols_.begin(); it != end; ++it) {
char_type c = *it;
if (!update_combo && !show_all && (c <= range_start || c >= range_end))
if (cat == QChar::Other_Control || cat == QChar::Separator_Space)
continue;
QListWidgetItem * lwi = new QListWidgetItem(toqstr(c));
+ ++numItem;
if (show_all || c >= range_start && c <= range_end) {
sprintf(codeName, "0x%04x", c);
lwi->setTextAlignment(Qt::AlignCenter);
if (category.isEmpty())
category = block;
if (used_blocks.find(block) == used_blocks.end())
- used_blocks[block] = lwi;
+ used_blocks[block] = numItem;
}
}
/// the encoding at cursor position
std::string encoding_;
/// which blocks do we actually include?
- typedef std::map<QString, QListWidgetItem *> UsedBlocks;
+ typedef std::map<QString, int> UsedBlocks;
///
UsedBlocks used_blocks;
/// list of all symbols