small refactoring

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23876 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-21 16:45:01 +00:00
parent 1f2cee9589
commit f23773c8c5
2 changed files with 13 additions and 9 deletions

View File

@ -263,24 +263,27 @@ void GuiSymbols::on_categoryCO_activated(QString const & text)
{
if (!categoryFilterCB->isChecked())
updateSymbolList(false);
else if (used_blocks.find(text) != used_blocks.end())
symbolsLW->scrollToItem(used_blocks[text],
QAbstractItemView::PositionAtTop);
else
scrollToItem(text);
}
void GuiSymbols::on_categoryFilterCB_toggled(bool on)
{
updateSymbolList(on);
if (on) {
QString const category = categoryCO->currentText();
if (used_blocks.find(category) != used_blocks.end())
symbolsLW->scrollToItem(used_blocks[category],
QAbstractItemView::PositionAtTop);
}
if (on)
scrollToItem(categoryCO->currentText());
}
void GuiSymbols::scrollToItem(QString const & category)
{
if (used_blocks.find(category) != used_blocks.end()) {
symbolsLW->scrollToItem(used_blocks[category],
QAbstractItemView::PositionAtTop);
}
}
void GuiSymbols::updateSymbolList(bool update_combo)
{
QString category = categoryCO->currentText();

View File

@ -51,6 +51,7 @@ public Q_SLOTS:
void on_chosenLE_textChanged(QString const &);
private:
void scrollToItem(QString const & category);
/** update the widgets (symbol browser, category combo)
* \p combo indicates if the combo box has to be refreshed
* as well (which is rather expensive)