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) |
Public Member Functions | |
KLFUnitChooser (QWidget *parent=NULL) | |
virtual | ~KLFUnitChooser () |
Unit | currentUnit () const |
QString | currentUnitName () const |
QString | currentUnitAbbrev () const |
double | currentUnitFactor () const |
QStringList | unitNames () const |
QList< Unit > | unitList () const |
QString | unitStringDescription () const |
Protected Member Functions | |
virtual void | changeEvent (QEvent *event) |
Properties | |
QString | currentUnit |
double | currentUnitFactor |
QString | klfUnits |
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.
|
virtual |
Definition at line 41 of file klfunitinput.cpp.
|
protectedvirtual |
Definition at line 122 of file klfunitinput.cpp.
References setCurrentUnit(), and QEvent::type().
Referenced by unitChanged().
|
inline |
Definition at line 60 of file klfunitinput.h.
|
inline |
Definition at line 62 of file klfunitinput.h.
References currentUnit.
|
inline |
Definition at line 63 of file klfunitinput.h.
References currentUnit.
|
inline |
Definition at line 61 of file klfunitinput.h.
References currentUnit.
|
slot |
Definition at line 86 of file klfunitinput.cpp.
References setCurrentUnitIndex().
Referenced by changeEvent().
|
slot |
Definition at line 97 of file klfunitinput.cpp.
References setCurrentUnitIndex().
|
slot |
Definition at line 110 of file klfunitinput.cpp.
References unitChanged().
Referenced by setCurrentUnit(), and setCurrentUnitAbbrev().
Set the possible units user can choose from.
Definition at line 65 of file klfunitinput.cpp.
References QVariant::fromValue(), and KLFUnitChooser::Unit::name.
|
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, KLFUnitChooser::Unit::name, setUnits(), QList::size(), and QString::split().
Referenced by setUnits().
|
signal |
Referenced by setCurrentUnitIndex().
|
signal |
|
signal |
References changeEvent().
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 QString::arg(), and QStringList::join().
|
readwrite |
Definition at line 47 of file klfunitinput.h.
Referenced by currentUnitAbbrev(), currentUnitFactor(), and currentUnitName().
|
read |
Definition at line 48 of file klfunitinput.h.
|
readwrite |
Definition at line 49 of file klfunitinput.h.