]> git.lyx.org Git - features.git/commitdiff
GuiBox: do not rely on count (as explained on lyx-devel)
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 18 May 2015 11:12:26 +0000 (13:12 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 18 May 2015 11:12:26 +0000 (13:12 +0200)
src/frontends/qt4/GuiBox.cpp

index adc107e2151d460b42414648b98f9df983b1c89b..b34bd68d062a7da8cc560a46c3742b9f4a859e53 100644 (file)
@@ -246,8 +246,8 @@ void GuiBox::on_frameColorCO_currentIndexChanged(int index)
 {
        // if there is a non-black frame color the background cannot be uncolored
        // therefore remove the entry "none" in this case
+       int const n = backgroundColorCO->findData("none");
        if (index != frameColorCO->findData("black")) {
-               int const n = backgroundColorCO->findData("none");
                if (n != -1) {
                        if (backgroundColorCO->currentIndex() == n)
                                backgroundColorCO->setCurrentIndex(
@@ -255,7 +255,7 @@ void GuiBox::on_frameColorCO_currentIndexChanged(int index)
                        backgroundColorCO->removeItem(n);
                }
        } else {
-               if (backgroundColorCO->count() == color_codes_.count() - 1)
+               if (n == -1)
                        backgroundColorCO->insertItem(0, toqstr(translateIfPossible((lcolor.getGUIName(Color_none)))),
                                                      toqstr(lcolor.getLaTeXName(Color_none)));
        }