3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #include "lengthcombo.h"
16 #include "lengthcommon.h"
19 LengthCombo::LengthCombo(QWidget * parent)
22 for (int i = 0; i < num_units; i++)
23 addItem(unit_name_gui[i]);
25 connect(this, SIGNAL(activated(int)),
26 this, SLOT(has_activated(int)));
29 LyXLength::UNIT LengthCombo::currentLengthItem() const
31 return static_cast<LyXLength::UNIT>(currentIndex());
35 void LengthCombo::has_activated(int)
38 selectionChanged(currentLengthItem());
42 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
44 QComboBox::setCurrentIndex(int(unit));
48 void LengthCombo::setCurrentItem(int item)
50 QComboBox::setCurrentIndex(item);
54 void LengthCombo::setEnabled(bool b)
56 QComboBox::setEnabled(b);
60 void LengthCombo::noPercents()
62 int num = QComboBox::count();
63 for (int i = 0; i < num; i++) {
64 if (QComboBox::itemText(i).contains('%') > 0) {
65 QComboBox::removeItem(i);
72 #include "lengthcombo_moc.cpp"