]> git.lyx.org Git - features.git/commitdiff
Block signals to the combo box when we update it. This fixes a problem
authorRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 14:50:20 +0000 (14:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 14:50:20 +0000 (14:50 +0000)
with flashing.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33854 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiCitation.cpp

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