mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
fabd5d2057
This kind of wrapping will be needed anyway, and it's an improvement on what we had. Please give it a run. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5846 a592a061-630c-0410-9148-cb99ea01b6c8
60 lines
1.1 KiB
C
60 lines
1.1 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 Voss
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "lengthcombo.h"
|
|
#include <qwhatsthis.h>
|
|
|
|
#include "lengthcommon.h"
|
|
#include "qt_helpers.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)));
|
|
|
|
QWhatsThis::add(this, qt_("Choose one of the units or relative lengths"));
|
|
}
|
|
|
|
|
|
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::setEnabled(bool b)
|
|
{
|
|
QComboBox::setEnabled(b);
|
|
}
|