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 |
|
18 #include <QGraphicsItem> |
|
19 #include <QEvent> |
|
20 #include <QGraphicsSceneResizeEvent> |
|
21 #include "scrollareawidget.h" |
|
22 #include "OstTraceDefinitions.h" |
|
23 #ifdef OST_TRACE_COMPILER_IN_USE |
|
24 #include "scrollareawidgetTraces.h" |
|
25 #endif |
|
26 |
|
27 |
|
28 QTM_USE_NAMESPACE |
|
29 |
|
30 |
|
31 ScrollAreaWidget::ScrollAreaWidget(QGraphicsItem *parent): |
|
32 QGraphicsWidget(parent) |
|
33 { |
|
34 OstTraceFunctionEntry0( SCROLLAREAWIDGET_SCROLLAREAWIDGET_ENTRY ); |
|
35 OstTraceFunctionExit0( SCROLLAREAWIDGET_SCROLLAREAWIDGET_EXIT ); |
|
36 } |
|
37 |
|
38 ScrollAreaWidget::~ScrollAreaWidget() |
|
39 { |
|
40 OstTraceFunctionEntry0( DUP1_SCROLLAREAWIDGET_SCROLLAREAWIDGET_ENTRY ); |
|
41 OstTraceFunctionExit0( DUP1_SCROLLAREAWIDGET_SCROLLAREAWIDGET_EXIT ); |
|
42 } |
|
43 |
|
44 /*! |
|
45 Filters the resizing events to get the widget resized when switching to |
|
46 landscape and back |
|
47 */ |
|
48 bool ScrollAreaWidget::eventFilter(QObject *object, QEvent *event) |
|
49 { |
|
50 OstTraceFunctionEntry0( SCROLLAREAWIDGET_EVENTFILTER_ENTRY ); |
|
51 |
|
52 if(event->type() == QEvent::GraphicsSceneResize){ |
|
53 resize(((QGraphicsSceneResizeEvent*)event)->newSize()); |
|
54 OstTraceFunctionExit0( SCROLLAREAWIDGET_EVENTFILTER_EXIT ); |
|
55 return true; |
|
56 } else { |
|
57 return QGraphicsWidget::eventFilter(object, event); |
|
58 } |
|
59 } |
|