]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/LengthCombo.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / LengthCombo.cpp
index 448737c3d76172d08714622c9f5f1643d0ef99d5..a21bc4da3668bae8cb52d7900d45b614f671e89f 100644 (file)
@@ -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"