38 #include "wrtperftracer.h" |
39 #include "wrtperftracer.h" |
39 #endif |
40 #endif |
40 |
41 |
41 namespace GVA { |
42 namespace GVA { |
42 |
43 |
43 ChromeView::ChromeView(ChromeWidget * chrome, QWidget * parent) |
44 ChromeView::ChromeView(QGraphicsScene *graphicsScene, ChromeWidget * chrome, QWidget * parent) |
44 #ifdef ORBIT_UI |
45 #ifdef ORBIT_UI |
45 : HbMainWindow(parent), |
46 : HbMainWindow(parent), |
46 #else |
47 #else |
47 : QGraphicsView(new QGraphicsScene(), parent), |
48 : QGraphicsView(graphicsScene, parent), |
48 #endif // ORBIT_UI |
49 #endif // ORBIT_UI |
49 m_topWidget(chrome) |
50 m_chrome(chrome), |
|
51 m_topWidget(chrome->layout()) |
50 { |
52 { |
51 #ifdef ORBIT_UI |
53 #ifdef ORBIT_UI |
52 addView(chrome); |
54 addView(chrome->layout()); |
53 #endif // ORRBIT_UI |
55 #endif // ORRBIT_UI |
54 |
56 |
55 // Initialize the ChromeWidget with the scene created in the ChromeView |
57 // Initialize the ChromeWidget with the scene created in the ChromeView |
56 chrome->setScene(scene()); |
58 chrome->layout()->setScene(scene()); |
57 |
59 |
58 //setGeometry(chrome->geometry().toRect()); |
60 //setGeometry(chrome->geometry().toRect()); |
59 setObjectName("ChromeView"); |
61 setObjectName("ChromeView"); |
60 //When content view is external widget, make the background transparent |
62 //When content view is external widget, make the background transparent |
61 //setStyleSheet("QGraphicsView#ChromeView {margin:0; border: 0; padding:0; background:transparent}"); |
63 //setStyleSheet("QGraphicsView#ChromeView {margin:0; border: 0; padding:0; background:transparent}"); |
62 setStyleSheet("QGraphicsView#ChromeView {margin:0; border: 0; padding:0; background:#fff}"); |
64 setStyleSheet("QGraphicsView#ChromeView {margin:0; border: 0; padding:0; background:#fff}"); |
63 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
65 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
64 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
66 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
67 |
|
68 #ifdef BEDROCK_TILED_BACKING_STORE |
|
69 setFrameShape(QFrame::NoFrame); |
|
70 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
71 scene()->setItemIndexMethod(QGraphicsScene::NoIndex); |
|
72 #endif |
|
73 |
65 //NB: maybe not needed? |
74 //NB: maybe not needed? |
66 setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); |
75 setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate); |
67 //installEventFilter(this); |
76 //installEventFilter(this); |
68 //chrome->page()->setView(this); |
77 //chrome->page()->setView(this); |
69 #ifndef NO_QSTM_GESTURE |
78 #ifndef NO_QSTM_GESTURE |
82 #endif //Q_OS_SYMBIAN |
91 #endif //Q_OS_SYMBIAN |
83 } |
92 } |
84 |
93 |
85 ChromeView::~ChromeView() |
94 ChromeView::~ChromeView() |
86 { |
95 { |
87 |
|
88 } |
96 } |
89 |
97 |
90 void ChromeView::resizeEvent(QResizeEvent * ev) |
98 void ChromeView::resizeEvent(QResizeEvent * ev) |
91 { |
99 { |
92 //Resize the chrome to match the view and scene rectangle size |
100 //Resize the chrome to match the view and scene rectangle size |
93 if (m_topWidget) { |
101 if (m_topWidget) { |
94 |
102 |
95 // On calling setGeometry on QGraphicsWidget, the layout resize if |
103 // On calling setGeometry on QGraphicsWidget, the layout resizes if |
96 // first called before resize on children happens. In order to avoid painting |
104 // first called before resize on children happens. In order to avoid painting |
97 // the children in the worn positions, first let children change size |
105 // the children in their old positions, first let children change size |
98 ChromeWidget * w = static_cast<ChromeWidget*>(m_topWidget); |
106 // ChromeWidget * w = static_cast<ChromeWidget*>(m_topWidget); |
99 w->sizeChange(ev->size()); |
107 // w->sizeChange(ev->size()); |
100 |
108 //TODO: move sizeChange to ChromeLayout, remove m_chrome member !!!!! |
101 m_topWidget->setGeometry(0,0, ev->size().width(), ev->size().height()); |
109 m_chrome->sizeChange(ev->size()); |
|
110 m_topWidget->setGeometry(0,0, ev->size().width(), ev->size().height()); |
102 } |
111 } |
103 QGraphicsView::resizeEvent(ev); |
112 QGraphicsView::resizeEvent(ev); |
|
113 |
|
114 #ifdef BEDROCK_TILED_BACKING_STORE |
|
115 if (scene()) { |
|
116 QRectF rect(QPointF(0, 0), size()); |
|
117 scene()->setSceneRect(rect); |
|
118 } |
|
119 #endif |
104 } |
120 } |
105 |
121 |
106 //Never scroll the chrome |
122 //Never scroll the chrome |
107 //NB: this shouldn't be needed, but some events from |
123 //NB: this shouldn't be needed, but some events from |
108 //the chrome are causing scrolling. Need to track this |
124 //the chrome are causing scrolling. Need to track this |