2015-05-17 10:57 GMT+02:00 Jürgen Spitzmüller <sp...@lyx.org>:

>
> OK, found it. Since the population of the frameColorCO depends on the
> population of backgroundColorCO (the existence of the "none" entry), it has
> to be populated after that one.
>
> Please test the attached patch.
>

Sorry, wrong one. Test this, please.

Jürgen
diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp
index da2abe8..9db6ca8 100644
--- a/src/frontends/qt4/GuiBox.cpp
+++ b/src/frontends/qt4/GuiBox.cpp
@@ -139,8 +139,8 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
        connect(shadowsizeED, SIGNAL(textChanged(QString)), this, 
SIGNAL(changed()));
        connect(shadowsizeUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
                this, SIGNAL(changed()));
-       connect(frameColorCO, SIGNAL(highlighted(QString)), this, 
SIGNAL(changed()));
-       connect(backgroundColorCO, SIGNAL(highlighted(QString)), this, 
SIGNAL(changed()));
+       connect(backgroundColorCO, SIGNAL(currentIndexChanged(int)),
+               this, SIGNAL(changed()));
 
        heightED->setValidator(unsignedLengthValidator(heightED));
        widthED->setValidator(unsignedLengthValidator(widthED));
@@ -157,8 +157,8 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
 
        // the background can be uncolored while the frame cannot
        color_codes_ = colors();
-       fillComboColor(frameColorCO, false);
        fillComboColor(backgroundColorCO, true);
+       fillComboColor(frameColorCO, false);
 
        initDialog();
 }
@@ -183,10 +183,9 @@ void GuiBox::fillComboColor(QComboBox * combo, bool const 
is_none)
 }
 
 
-void GuiBox::on_innerBoxCO_activated(int /* index */)
+void GuiBox::on_innerBoxCO_activated(int index)
 {
-       QString itype =
-               innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+       QString itype = innerBoxCO->itemData(index).toString();
        // handle parbox and minipage the same way
        bool const ibox = (itype != "none" && itype != "makebox");
        if (heightCB->isChecked() && !ibox)
@@ -233,8 +232,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(
@@ -242,7 +241,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)));
        }

Reply via email to