• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

Public Types | Public Member Functions | Static Public Member Functions | List of all members
Unit Class Reference

#include <unit.h>

Public Types

enum  MetricalUnit { pixel = 0, cm, in }
 

Public Member Functions

 Unit (double value=0.0, Unit::MetricalUnit unit=cm, int dpi=1)
 
 ~Unit ()
 
void convertTo (Unit::MetricalUnit unit)
 
int dpi () const
 
double getValue (Unit::MetricalUnit unit) const
 
Unit & operator= (const Unit &u)
 
void setDpi (int dpi)
 
void setUnit (Unit::MetricalUnit unit)
 
void setValue (double value)
 
Unit::MetricalUnit unit () const
 
double value () const
 

Static Public Member Functions

static double convert (double value, Unit::MetricalUnit from, Unit::MetricalUnit to, int dpi=1)
 
static Unit::MetricalUnit intToUnit (int index)
 
static int precision (Unit::MetricalUnit unit)
 
static QStringList unitList ()
 

Detailed Description

This small class server as helper to perform conversions between metrical units.

Definition at line 30 of file unit.h.

Member Enumeration Documentation

enum Unit::MetricalUnit

The kinds of metrical units we support.

Enumerator
pixel 
cm 
in 

Definition at line 36 of file unit.h.

Constructor & Destructor Documentation

Unit::Unit ( double  value = 0.0,
Unit::MetricalUnit  unit = cm,
int  dpi = 1 
)
explicit

Definition at line 26 of file unit.cc.

Unit::~Unit ( )

Definition at line 33 of file unit.cc.

Member Function Documentation

double Unit::convert ( double  value,
Unit::MetricalUnit  from,
Unit::MetricalUnit  to,
int  dpi = 1 
)
static

The most useful method of this class: convert the specified value from the unit from to the unit to, using the specified dpi in case of conversions from/to pixels.

Definition at line 86 of file unit.cc.

void Unit::convertTo ( Unit::MetricalUnit  unit)

Set the unit of the current object to unit and convert the value to the new unit using convert().

See also
setUnit()

Definition at line 52 of file unit.cc.

int Unit::dpi ( ) const

Definition at line 73 of file unit.cc.

double Unit::getValue ( Unit::MetricalUnit  unit) const

Definition at line 63 of file unit.cc.

Unit::MetricalUnit Unit::intToUnit ( int  index)
static

Definition at line 127 of file unit.cc.

Unit & Unit::operator= ( const Unit &  u)

Definition at line 78 of file unit.cc.

int Unit::precision ( Unit::MetricalUnit  unit)
static

How many decimals the unit have.

Definition at line 139 of file unit.cc.

void Unit::setDpi ( int  dpi)

Definition at line 68 of file unit.cc.

void Unit::setUnit ( Unit::MetricalUnit  unit)

Set the unit of the current object to unit, but it doesn't convert the value to the new unit.

See also
convertTo()

Definition at line 47 of file unit.cc.

void Unit::setValue ( double  value)

Definition at line 37 of file unit.cc.

Unit::MetricalUnit Unit::unit ( ) const

Definition at line 58 of file unit.cc.

QStringList Unit::unitList ( )
static

Get a list of the supported metrical units.

Definition at line 118 of file unit.cc.

double Unit::value ( ) const

Definition at line 42 of file unit.cc.


The documentation for this class was generated from the following files:
  • unit.h
  • unit.cc
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal