2015-05-17 10:19 GMT+02:00 Jürgen Spitzmüller:
>
> This should not be necessary. We check if none is in the combo via the
> code you replaced.
> Please tell me how to reproduce the problem with my code.
>
>
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.
This also removes an unnecessary signal (you already connect to changed()
in on_frameColorCO_currentIndexChanged) and changed the other to the more
appropriate currentIndexChanged(). Furthermore, I have simplified a bit
more.
Jürgen
> Jürgen
>
diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp
index da2abe8..60c4b70 100644
--- a/src/frontends/qt4/GuiBox.cpp
+++ b/src/frontends/qt4/GuiBox.cpp
@@ -139,8 +139,6 @@ 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()));
heightED->setValidator(unsignedLengthValidator(heightED));
widthED->setValidator(unsignedLengthValidator(widthED));
@@ -157,8 +155,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 +181,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 +230,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 +239,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)));
}