]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/lengthcombo.C
Get rid of the static_casts.
[lyx.git] / src / frontends / qt2 / lengthcombo.C
1 /**
2  * \file lengthcombo.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Herbert Voss
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14
15 #include "lengthcombo.h"
16 #include <qwhatsthis.h>
17
18 #include "lengthcommon.h"
19 #include "qt_helpers.h"
20
21
22 LengthCombo::LengthCombo(QWidget * parent, char * name)
23         : QComboBox(parent, name)
24 {
25         for (int i=0; i < num_units; i++)
26                 insertItem(unit_name_gui[i]);
27
28         connect(this, SIGNAL(activated(int)),
29                 this, SLOT(has_activated(int)));
30 }
31
32
33 LyXLength::UNIT LengthCombo::currentLengthItem() const
34 {
35         return static_cast<LyXLength::UNIT>(currentItem());
36 }
37
38
39 void LengthCombo::has_activated(int)
40 {
41         emit selectionChanged(currentLengthItem());
42 }
43
44
45 void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
46 {
47         QComboBox::setCurrentItem(int(unit));
48 }
49
50
51 void LengthCombo::setEnabled(bool b)
52 {
53         QComboBox::setEnabled(b);
54 }