/*======================================================================================

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkQTextEditIODevice.cxx
	Version:		$Revision: 1761 $
	Date:			$Date: 2011-09-23 17:25:41 +0200 (Fr, 23 Sep 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
	See RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#include "ritkQTextEditIODevice.h"

namespace ritk
{

QTextEditIODevice::QTextEditIODevice(QTextEdit *TextEdit, QObject *Parent) :
	QIODevice(Parent),
	m_QTextEdit(TextEdit)
{
	open(QIODevice::WriteOnly|QIODevice::Text);
}


//----------------------------------------------------------------------------
QTextEditIODevice::~QTextEditIODevice()
{
}


//----------------------------------------------------------------------------
qint64 
QTextEditIODevice::readData(char *data, qint64 maxSize) 
{ 
	return 0; 
}


//----------------------------------------------------------------------------
qint64 
QTextEditIODevice::writeData(const char *data, qint64 maxSize)
{
	if( m_QTextEdit )
	{
		m_QTextEdit->append(data);
	}
	return maxSize;
}


} // end namespace ritk
