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)));
31 QWhatsThis::add(this, qt_("Choose one of the units or relative lengths"));
35 LyXLength::UNIT LengthCombo::currentLengthItem() const
37 return static_cast<LyXLength::UNIT>(currentItem());
41 void LengthCombo::has_activated(int)
43 emit selectionChanged(currentLengthItem());
47 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
49 QComboBox::setCurrentItem(int(unit));
53 void LengthCombo::setEnabled(bool b)
55 QComboBox::setEnabled(b);