Block signals to the combo box when we update it. This fixes a problem

with flashing.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33854 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-24 14:50:20 +00:00
parent ebb24e51e1
commit 625144c193

View File

@ -276,27 +276,35 @@ void GuiCitation::fillStyles(BiblioInfo const & bi)
return; return;
} }
int const oldIndex = citationStyleCO->currentIndex();
if (!selectedLV->selectionModel()->selectedIndexes().empty()) if (!selectedLV->selectionModel()->selectedIndexes().empty())
curr = selectedLV->selectionModel()->selectedIndexes()[0].row(); curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
QStringList sty = citationStyles(bi, curr); QStringList sty = citationStyles(bi, curr);
citationStyleCO->clear();
if (sty.isEmpty()) { if (sty.isEmpty()) {
// some error // some error
citationStyleCO->setEnabled(false); citationStyleCO->setEnabled(false);
citationStyleLA->setEnabled(false); citationStyleLA->setEnabled(false);
citationStyleCO->clear();
return; return;
} }
citationStyleCO->blockSignals(true);
// save old index
int const oldIndex = citationStyleCO->currentIndex();
citationStyleCO->clear();
citationStyleCO->insertItems(0, sty); citationStyleCO->insertItems(0, sty);
citationStyleCO->setEnabled(true); citationStyleCO->setEnabled(true);
citationStyleLA->setEnabled(true); citationStyleLA->setEnabled(true);
// restore old index
if (oldIndex != -1 && oldIndex < citationStyleCO->count()) if (oldIndex != -1 && oldIndex < citationStyleCO->count())
citationStyleCO->setCurrentIndex(oldIndex); citationStyleCO->setCurrentIndex(oldIndex);
citationStyleCO->blockSignals(false);
// simulate a change of index to trigger updateFormatting().
on_citationStyleCO_currentIndexChanged(citationStyleCO->currentIndex());
} }