/***************************************************************************
 * qsizecm.cpp: implementation of QSizeCm class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2007 the KTabEdit development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "qsizecm.h"

#include "pixel.h"

QSizeCm::QSizeCm()
: mWidth(0, 72),
  mHeight(0, 72)
{
}

QSizeCm::QSizeCm(const Cm& w, const Cm& h)
: mWidth(w),
  mHeight(h)
{
}

QSizeCm::~QSizeCm()
{

}

void QSizeCm::setWidth(const Cm& w)
{
	mWidth = w;
}

Cm QSizeCm::width() const
{
	return mWidth;
}

uint QSizeCm::widthValueOfPixel() const
{
	return mWidth.valueOfPixel();
}

void QSizeCm::setHeight(const Cm& h)
{
	mHeight = h;
}

Cm QSizeCm::height() const
{
	return mHeight;
}

uint QSizeCm::heightValueOfPixel() const
{
	return mHeight.valueOfPixel();
}

QSize QSizeCm::toQSize() const
{
	return QSize(mWidth.toPixel().value(), mHeight.toPixel().value());
}

bool QSizeCm::operator==(const QSizeCm& sizeCm) const
{
	return mHeight == sizeCm.mHeight;
}

bool QSizeCm::operator!=(const QSizeCm& sizeCm) const
{
	return !this->operator==(sizeCm);
}
