summaryrefslogtreecommitdiffstats
path: root/kview/kviewcanvas/test/test.cpp
blob: de1694f81d58acb5f0ef5f3fdecb53cd703dc247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * kimageviewertest.cpp
 *
 * Copyright (c) 2001 Matthias Kretz <kretz@kde.org>
 */
#include "test.h"
#include <kimageviewer/canvas.h>

#include <kurl.h>
#include <klibloader.h>
#include <tdemessagebox.h>
#include <tdeparts/componentfactory.h>

#include <tqimage.h>

KImageViewerTest::KImageViewerTest()
    : KParts::MainWindow( 0L, "KImageViewerTest" )
{
	TQWidget * widget = KParts::ComponentFactory::createInstanceFromQuery<TQWidget>(
			"KImageViewer/Canvas", TQString(), this );
    if( widget )
    {
		m_part = dynamic_cast<KImageViewer::Canvas *>( widget );
		setCentralWidget( widget );
    }
    else
    {
        KMessageBox::error(this, "Could not find our Part!");
        kapp->quit();
    }
}

KImageViewerTest::~KImageViewerTest()
{
}

void KImageViewerTest::load(const KURL& url)
{
	TQImage image( url.fileName() );
	if( m_part )
		m_part->setImage( image );
	else
        KMessageBox::error(this, "can't load the file");
}

#include "test.moc"