lyx_mirror/src/frontends/qt4/lengthcombo.C
Abdelrazak Younes 995da7bafc Qt4 compilation speedup patch by Bo Peng and me.
* configure.ac: removed frontends/qt4/moc compilation.
* frontends/qt4/: moc files (*_moc.cpp) are now included at the end of relevant source file (*.C)
* SConscript: adapted to "moc included in .C file" change.
* frontends/qt4/Makefile.am:  adapted to "moc included in .C file" change.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13860 a592a061-630c-0410-9148-cb99ea01b6c8
2006-05-18 08:51:12 +00:00

82 lines
1.4 KiB
C

/**
* \file lengthcombo.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Herbert Voß
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "lengthcombo.h"
#include "lengthcommon.h"
LengthCombo::LengthCombo(QWidget * parent, char * name)
: QComboBox(parent, name)
{
for (int i = 0; i < num_units; i++)
insertItem(unit_name_gui[i]);
connect(this, SIGNAL(activated(int)),
this, SLOT(has_activated(int)));
}
LengthCombo::LengthCombo(QWidget * parent)
: QComboBox(parent)
{
for (int i = 0; i < num_units; i++)
insertItem(unit_name_gui[i]);
connect(this, SIGNAL(activated(int)),
this, SLOT(has_activated(int)));
}
LyXLength::UNIT LengthCombo::currentLengthItem() const
{
return static_cast<LyXLength::UNIT>(currentItem());
}
void LengthCombo::has_activated(int)
{
emit selectionChanged(currentLengthItem());
}
void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
{
QComboBox::setCurrentItem(int(unit));
}
void LengthCombo::setCurrentItem(int item)
{
QComboBox::setCurrentItem(item);
}
void LengthCombo::setEnabled(bool b)
{
QComboBox::setEnabled(b);
}
void LengthCombo::noPercents()
{
int num = QComboBox::count();
for (int i = 0; i < num; i++) {
if (QComboBox::text(i).contains('%') > 0) {
QComboBox::removeItem(i);
i -= 1;
num -= 1;
}
}
}
#include "lengthcombo_moc.cpp"