#include <string>
+namespace lyx {
+namespace frontend {
+
LengthCombo::LengthCombo(QWidget * parent)
: QComboBox(parent)
{
for (int i = 0; i < lyx::num_units; i++) {
// mu does not make sense usually
// so it must be added manually, if needed
- if (lyx::unit_name[i] == "mu")
+ if (QLatin1String(lyx::unit_name[i]) == "mu")
continue;
QComboBox::addItem(lyx::qt_(lyx::unit_name_gui[i]),
lyx::toqstr(lyx::unit_name[i]));
}
connect(this, SIGNAL(activated(int)),
- this, SLOT(has_activated(int)));
+ this, SLOT(hasActivated(int)));
}
}
-void LengthCombo::has_activated(int)
+void LengthCombo::hasActivated(int)
{
// emit signal
selectionChanged(currentLengthItem());
void LengthCombo::setCurrentItem(lyx::Length::UNIT unit)
{
- QString const val = lyx::toqstr(lyx::stringFromUnit(unit));
+ setCurrentItem(lyx::toqstr(lyx::stringFromUnit(unit)));
+}
+
+
+void LengthCombo::setCurrentItem(QString const & item)
+{
int num = QComboBox::count();
for (int i = 0; i < num; i++) {
- if (QComboBox::itemData(i).toString() == val) {
+ if (QComboBox::itemData(i).toString() == item) {
QComboBox::setCurrentIndex(i);
break;
}
}
-void LengthCombo::removeItem(lyx::Length::UNIT unit)
+void LengthCombo::removeFontDependent()
+{
+ removeUnit(Length::EM);
+ removeUnit(Length::EX);
+ removeUnit(Length::MU);
+}
+
+
+void LengthCombo::removeUnit(lyx::Length::UNIT unit)
{
QString const val = lyx::toqstr(lyx::stringFromUnit(unit));
int num = QComboBox::count();
}
-void LengthCombo::removeItem(int item)
-{
- QComboBox::removeItem(item);
-}
-
-
-void LengthCombo::addItem(lyx::Length::UNIT unit)
+void LengthCombo::addUnit(lyx::Length::UNIT unit)
{
QString const val = lyx::toqstr(lyx::stringFromUnit(unit));
int num = QComboBox::count();
lyx::toqstr(lyx::unit_name[int(unit)]));
}
-
-void LengthCombo::addItem(QString const item)
-{
- QComboBox::addItem(item);
-}
+} // namespace frontend
+} // namespace lyx
#include "moc_LengthCombo.cpp"