[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Classes | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KLFUnitChooser Class Reference

A combo box to select a unit for measures. More...

#include <klfunitinput.h>

Inheritance diagram for KLFUnitChooser:
Inheritance graph
[legend]
Collaboration diagram for KLFUnitChooser:
Collaboration graph
[legend]

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< UnitunitList () const
 
QString unitStringDescription () const
 

Protected Member Functions

virtual void changeEvent (QEvent *event)
 

Properties

QString currentUnit
 
double currentUnitFactor
 
QString klfUnits
 

Detailed Description

A combo box to select a unit for measures.

Typical usage:

Definition at line 43 of file klfunitinput.h.

Constructor & Destructor Documentation

◆ KLFUnitChooser()

KLFUnitChooser::KLFUnitChooser ( QWidget *  parent = NULL)

Definition at line 36 of file klfunitinput.cpp.

◆ ~KLFUnitChooser()

KLFUnitChooser::~KLFUnitChooser ( )
virtual

Definition at line 41 of file klfunitinput.cpp.

Member Function Documentation

◆ changeEvent()

void KLFUnitChooser::changeEvent ( QEvent event)
protectedvirtual

◆ currentUnit()

Unit KLFUnitChooser::currentUnit ( ) const
inline

Definition at line 60 of file klfunitinput.h.

◆ currentUnitAbbrev()

QString KLFUnitChooser::currentUnitAbbrev ( ) const
inline

Definition at line 62 of file klfunitinput.h.

◆ currentUnitFactor()

double KLFUnitChooser::currentUnitFactor ( ) const
inline

Definition at line 63 of file klfunitinput.h.

◆ currentUnitName()

QString KLFUnitChooser::currentUnitName ( ) const
inline

Definition at line 61 of file klfunitinput.h.

◆ setCurrentUnit

void KLFUnitChooser::setCurrentUnit ( const QString unitName)
slot

Definition at line 86 of file klfunitinput.cpp.

References KLF_FUNC_NAME, and setCurrentUnitIndex().

Referenced by changeEvent().

◆ setCurrentUnitAbbrev

void KLFUnitChooser::setCurrentUnitAbbrev ( const QString unitAbbrev)
slot

Definition at line 97 of file klfunitinput.cpp.

References KLF_FUNC_NAME, and setCurrentUnitIndex().

◆ setCurrentUnitIndex

void KLFUnitChooser::setCurrentUnitIndex ( int  k)
slot

Definition at line 110 of file klfunitinput.cpp.

References unitChanged().

Referenced by setCurrentUnit(), and setCurrentUnitAbbrev().

◆ setUnits [1/2]

void KLFUnitChooser::setUnits ( const QString unitstrlist)
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:

setUnits("Postscript Point=pt=1;Millimeter=mm=2.835;Centimeter=cm=28.35;1/8 th inch=1/8 in=9;Inch=in=72")

Definition at line 45 of file klfunitinput.cpp.

References KLFUnitChooser::Unit::abbrev, KLFUnitChooser::Unit::factor, KLF_FUNC_NAME, KLFUnitChooser::Unit::name, QList::size(), and QString::split().

◆ setUnits [2/2]

void KLFUnitChooser::setUnits ( const QList< Unit > &  unitlist)
slot

Set the possible units user can choose from.

Definition at line 65 of file klfunitinput.cpp.

References KLFUnitChooser::Unit::name.

◆ unitChanged [1/3]

void KLFUnitChooser::unitChanged ( const QString unitName)
signal

Referenced by changeEvent(), and setCurrentUnitIndex().

◆ unitChanged [2/3]

void KLFUnitChooser::unitChanged ( double  unitFactor)
signal

◆ unitChanged [3/3]

void KLFUnitChooser::unitChanged ( double  unitFactor,
const QString suffix 
)
signal

◆ unitList()

QList<Unit> KLFUnitChooser::unitList ( ) const
inline

Definition at line 67 of file klfunitinput.h.

References Q_DECLARE_METATYPE().

◆ unitNames()

QStringList KLFUnitChooser::unitNames ( ) const
inline

Definition at line 65 of file klfunitinput.h.

References KLFUnitChooser::Unit::name.

◆ unitStringDescription()

QString KLFUnitChooser::unitStringDescription ( ) const

Definition at line 77 of file klfunitinput.cpp.

References QString::arg(), and QStringList::join().

Property Documentation

◆ currentUnit

QString KLFUnitChooser::currentUnit
readwrite

Definition at line 47 of file klfunitinput.h.

◆ currentUnitFactor

double KLFUnitChooser::currentUnitFactor
read

Definition at line 48 of file klfunitinput.h.

◆ klfUnits

QString KLFUnitChooser::klfUnits
readwrite

Definition at line 49 of file klfunitinput.h.


The documentation for this class was generated from the following files:

Generated by doxygen 1.8.13