namespace {
-struct ColorSorter
+bool ColorSorter(ColorCode lhs, ColorCode rhs)
{
- bool operator()(ColorCode lhs, ColorCode rhs) const {
- return
- support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
- }
-};
+ return support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
+}
} // namespace anon
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));
// the background can be uncolored while the frame cannot
color_codes_ = colors();
- sort(color_codes_.begin(), color_codes_.end(), ColorSorter());
+ qSort(color_codes_.begin(), color_codes_.end(), ColorSorter);
fillComboColor(backgroundColorCO, true);
fillComboColor(frameColorCO, false);
{
// 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(
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)));
}