small step towards s/QListWidget/QListView/g

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23877 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-21 16:53:15 +00:00
parent f23773c8c5
commit b9bee4dd86
2 changed files with 7 additions and 4 deletions

View File

@ -279,8 +279,9 @@ void GuiSymbols::on_categoryFilterCB_toggled(bool on)
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);
}
}
@ -314,6 +315,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
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))
@ -328,6 +330,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
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);
@ -340,7 +343,7 @@ void GuiSymbols::updateSymbolList(bool update_combo)
if (category.isEmpty())
category = block;
if (used_blocks.find(block) == used_blocks.end())
used_blocks[block] = lwi;
used_blocks[block] = numItem;
}
}

View File

@ -60,7 +60,7 @@ private:
/// 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