45
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "cxeviewfinderwidgetdesktop.h"
|
|
18 |
#include <QPainter>
|
|
19 |
#include "cxutils.h"
|
|
20 |
|
|
21 |
const double RES_WIDTH = 640.0;
|
|
22 |
const double RES_HEIGHT = 360.0;
|
|
23 |
|
|
24 |
/*!
|
|
25 |
* Construtor
|
|
26 |
*/
|
|
27 |
CxeViewfinderWidgetDesktop::CxeViewfinderWidgetDesktop() :
|
|
28 |
QGraphicsWidget()
|
|
29 |
{
|
|
30 |
CX_DEBUG_ENTER_FUNCTION();
|
|
31 |
mCurrentPixmap = QPixmap();
|
|
32 |
resize(RES_WIDTH, RES_HEIGHT);
|
|
33 |
CX_DEBUG_EXIT_FUNCTION();
|
|
34 |
}
|
|
35 |
|
|
36 |
/*!
|
|
37 |
* Destrutor
|
|
38 |
*/
|
|
39 |
CxeViewfinderWidgetDesktop::~CxeViewfinderWidgetDesktop()
|
|
40 |
{
|
|
41 |
|
|
42 |
}
|
|
43 |
|
|
44 |
/*!
|
|
45 |
* Paint
|
|
46 |
*/
|
|
47 |
void CxeViewfinderWidgetDesktop::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
|
48 |
{
|
|
49 |
Q_UNUSED(option);
|
|
50 |
Q_UNUSED(widget);
|
|
51 |
|
|
52 |
painter->drawPixmap(rect().toRect(), mCurrentPixmap);
|
|
53 |
}
|
|
54 |
|
|
55 |
/*!
|
|
56 |
* Handle image change
|
|
57 |
*/
|
|
58 |
void CxeViewfinderWidgetDesktop::handleImageChange(const QPixmap &newImage)
|
|
59 |
{
|
|
60 |
CX_DEBUG_ENTER_FUNCTION();
|
|
61 |
mCurrentPixmap = newImage;
|
|
62 |
update();
|
|
63 |
CX_DEBUG_EXIT_FUNCTION();
|
|
64 |
}
|