A combo box to select a unit for measures. More...
#include <klfunitinput.h>
Classes | |
struct | Unit |
Public Slots | |
void | setUnits (const QString &unitstrlist) |
void | setUnits (const QList< Unit > &unitlist) |
void | setCurrentUnit (const QString &unitName) |
void | setCurrentUnitAbbrev (const QString &unitAbbrev) |
void | setCurrentUnitIndex (int k) |
Signals | |
void | unitChanged (const QString &unitName) |
void | unitChanged (double unitFactor) |
void | unitChanged (double unitFactor, const QString &suffix) |
Protected Member Functions | |
virtual void | changeEvent (QEvent *event) |
A combo box to select a unit for measures.
Typical usage:
Definition at line 43 of file klfunitinput.h.
KLFUnitChooser::KLFUnitChooser | ( | QWidget * | parent = NULL | ) |
Definition at line 36 of file klfunitinput.cpp.
References QComboBox::currentIndexChanged().
|
virtual |
Definition at line 41 of file klfunitinput.cpp.
|
protectedvirtual |
Definition at line 122 of file klfunitinput.cpp.
References QString::isEmpty(), setCurrentUnit(), and QEvent::type().
|
inline |
Definition at line 60 of file klfunitinput.h.
References QComboBox::itemData().
|
inline |
Definition at line 62 of file klfunitinput.h.
|
inline |
Definition at line 63 of file klfunitinput.h.
|
inline |
Definition at line 61 of file klfunitinput.h.
|
slot |
Definition at line 86 of file klfunitinput.cpp.
References QComboBox::itemData(), KLF_FUNC_NAME, and setCurrentUnitIndex().
Referenced by changeEvent().
|
slot |
Definition at line 97 of file klfunitinput.cpp.
References QComboBox::itemData(), KLF_FUNC_NAME, and setCurrentUnitIndex().
|
slot |
Definition at line 110 of file klfunitinput.cpp.
References unitChanged().
Referenced by setCurrentUnit(), and setCurrentUnitAbbrev().
|
slot |
Set the possible units user can choose from. Units are specified as a string of semicolon-separated items, each item in the list corresponding to one unit, specified as a string like "Inch=in=25.4"
or "Centimeter=cm=10"
or "Millimeter=mm=1"
, that is a string with three sections separated by an '='
sign giving unit name, unit abbreviation, and the factor of that unit to a reference unit. See KLFUnitSpinBox for discussion about units.
Example:
Definition at line 45 of file klfunitinput.cpp.
References KLFUnitChooser::Unit::abbrev, KLFUnitChooser::Unit::factor, KLF_FUNC_NAME, KLFUnitChooser::Unit::name, QString::split(), and QStringList::split().
Set the possible units user can choose from.
Definition at line 65 of file klfunitinput.cpp.
References QComboBox::addItem(), QComboBox::clear(), and KLFUnitChooser::Unit::name.
|
signal |
Referenced by setCurrentUnitIndex().
|
signal |
|
signal |
Definition at line 67 of file klfunitinput.h.
|
inline |
Definition at line 65 of file klfunitinput.h.
References KLFUnitChooser::Unit::name.
QString KLFUnitChooser::unitStringDescription | ( | ) | const |
Definition at line 77 of file klfunitinput.cpp.
References QStringList::join().