+
+void LengthCombo::removeUnit(lyx::Length::UNIT unit)
+{
+ QString const val = lyx::toqstr(lyx::stringFromUnit(unit));
+ int num = QComboBox::count();
+ for (int i = 0; i < num; i++) {
+ if (QComboBox::itemData(i).toString() == val) {
+ QComboBox::removeItem(i);
+ break;
+ }
+ }
+}
+
+
+void LengthCombo::addUnit(lyx::Length::UNIT unit)
+{
+ QString const val = lyx::toqstr(lyx::stringFromUnit(unit));
+ int num = QComboBox::count();
+ for (int i = 0; i < num; i++) {
+ if (QComboBox::itemData(i).toString() == val) {
+ // already there, nothing to do
+ return;
+ }
+ }
+ insertItem(int(unit), lyx::qt_(lyx::unit_name_gui[int(unit)]),
+ lyx::toqstr(lyx::unit_name[int(unit)]));
+}
+
+