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
15 #include "lengthcombo.h"
16 #include <qwhatsthis.h>
18 #include "lengthcommon.h"
19 #include "qt_helpers.h"
22 LengthCombo::LengthCombo(QWidget * parent, char * name)
23 : QComboBox(parent, name)
25 for (int i=0; i < num_units; i++)
26 insertItem(unit_name_gui[i]);
28 connect(this, SIGNAL(activated(int)),
29 this, SLOT(has_activated(int)));
33 LyXLength::UNIT LengthCombo::currentLengthItem() const
35 return static_cast<LyXLength::UNIT>(currentItem());
39 void LengthCombo::has_activated(int)
41 emit selectionChanged(currentLengthItem());
45 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
47 QComboBox::setCurrentItem(int(unit));
51 void LengthCombo::setEnabled(bool b)
53 QComboBox::setEnabled(b);