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, char * name)
20 : QComboBox(parent, name)
22 for (int i = 0; i < num_units; i++)
23 insertItem(unit_name_gui[i]);
25 connect(this, SIGNAL(activated(int)),
26 this, SLOT(has_activated(int)));
29 LengthCombo::LengthCombo(QWidget * parent)
32 for (int i = 0; i < num_units; i++)
33 insertItem(unit_name_gui[i]);
35 connect(this, SIGNAL(activated(int)),
36 this, SLOT(has_activated(int)));
39 LyXLength::UNIT LengthCombo::currentLengthItem() const
41 return static_cast<LyXLength::UNIT>(currentItem());
45 void LengthCombo::has_activated(int)
48 selectionChanged(currentLengthItem());
52 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
54 QComboBox::setCurrentItem(int(unit));
58 void LengthCombo::setCurrentItem(int item)
60 QComboBox::setCurrentItem(item);
64 void LengthCombo::setEnabled(bool b)
66 QComboBox::setEnabled(b);
70 void LengthCombo::noPercents()
72 int num = QComboBox::count();
73 for (int i = 0; i < num; i++) {
74 if (QComboBox::text(i).contains('%') > 0) {
75 QComboBox::removeItem(i);
82 #include "lengthcombo_moc.cpp"