X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FLengthCombo.cpp;h=a21bc4da3668bae8cb52d7900d45b614f671e89f;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=448737c3d76172d08714622c9f5f1643d0ef99d5;hpb=18a8d490c7b8c2f33d41d529b5634007be5d157a;p=lyx.git diff --git a/src/frontends/qt4/LengthCombo.cpp b/src/frontends/qt4/LengthCombo.cpp index 448737c3d7..a21bc4da36 100644 --- a/src/frontends/qt4/LengthCombo.cpp +++ b/src/frontends/qt4/LengthCombo.cpp @@ -27,14 +27,14 @@ LengthCombo::LengthCombo(QWidget * 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 (QString(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))); } @@ -45,7 +45,7 @@ lyx::Length::UNIT LengthCombo::currentLengthItem() const } -void LengthCombo::has_activated(int) +void LengthCombo::hasActivated(int) { // emit signal selectionChanged(currentLengthItem()); @@ -54,10 +54,15 @@ void LengthCombo::has_activated(int) 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; } @@ -90,7 +95,7 @@ void LengthCombo::noPercents() } -void LengthCombo::removeItem(lyx::Length::UNIT unit) +void LengthCombo::removeUnit(lyx::Length::UNIT unit) { QString const val = lyx::toqstr(lyx::stringFromUnit(unit)); int num = QComboBox::count(); @@ -103,13 +108,7 @@ void LengthCombo::removeItem(lyx::Length::UNIT unit) } -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(); @@ -124,9 +123,4 @@ void LengthCombo::addItem(lyx::Length::UNIT unit) } -void LengthCombo::addItem(QString const item) -{ - QComboBox::addItem(item); -} - #include "moc_LengthCombo.cpp"