author | hgs |
Wed, 13 Oct 2010 12:41:01 +0300 | |
changeset 21 | 53314abf04ed |
parent 20 | a60f8b6b1d32 |
permissions | -rw-r--r-- |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <QGesture> |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <QPainter> |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QTimer> |
5
4fa04caf0f43
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
21 |
#include <HbGridViewItem> |
4fa04caf0f43
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
22 |
#include <HbMainWindow> |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include "hggridcontainer.h" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "hgmediawallrenderer.h" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "hgquad.h" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include "hgwidgetitem.h" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "trace.h" |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
5
4fa04caf0f43
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
29 |
#include <HbGridView> |
4fa04caf0f43
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
30 |
#include <HbIconItem> |
4fa04caf0f43
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
31 |
#include <QAbstractItemModel> |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include "hglongpressvisualizer.h" |
17 | 33 |
#include <HbPinchGesture> |
34 |
#include <QGraphicsSceneMouseEvent> |
|
20 | 35 |
#include <HbWidgetFeedback> |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
static const qreal KCameraMaxYAngle(20); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
static const qreal KSpringVelocityToCameraYAngleFactor(2); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
|
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
40 |
HgGridContainer::HgGridContainer(QGraphicsItem *parent) : |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
41 |
HgContainer(parent), |
17 | 42 |
mEffect3dEnabled(true), |
43 |
mPinchEnabled(false), |
|
44 |
mPinchingOngoing(false), |
|
45 |
mTempImageHeightForLineGrid(-1), |
|
46 |
mTempImageHeightFinal(-1), |
|
47 |
mTempRowCount(-1), |
|
48 |
mPinchEndAlreadyHandled(false), |
|
49 |
mReactToOnlyPanGestures(false), |
|
20 | 50 |
mHorizontalRowCount(2), |
17 | 51 |
mVerticalColumnCount(3), |
52 |
mHorizontalPinchLevels(QPair<int,int>(2,3)), |
|
53 |
mVerticalPinchLevels(QPair<int,int>(2,5)) |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
{ |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
mUserItemSize = QSize(120,120); |
20 | 56 |
mUserItemSpacing = QSize(1,1); |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
HgGridContainer::~HgGridContainer() |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
{ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
void HgGridContainer::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
{ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
HgContainer::paint(painter, option, widget); |
17 | 66 |
|
67 |
// Draw these only while pinching |
|
68 |
if(mPinchingOngoing) |
|
69 |
{ |
|
70 |
const QPen& oldPen = painter->pen(); |
|
71 |
||
72 |
// dim the background, i.e. draw trasparent black screen-sized rect (alpha is 100 of 255) |
|
73 |
painter->fillRect(rect(), QColor(0, 0, 0, 100)); |
|
74 |
||
75 |
QPen pen = painter->pen(); |
|
76 |
pen.setColor(Qt::white); |
|
77 |
pen.setWidth(4); |
|
78 |
painter->setPen(pen); |
|
79 |
||
80 |
int imageXCount; |
|
81 |
int imageYCount; |
|
82 |
int widthSpacingPlusImage; |
|
83 |
int heightSpacingPlusImage; |
|
84 |
// Use temp values that are updated during pinching |
|
85 |
QSize imageSize(mTempImageHeightForLineGrid, mTempImageHeightForLineGrid); |
|
86 |
||
87 |
if (scrollDirection() == Qt::Horizontal ) //landscape mode |
|
88 |
{ |
|
89 |
imageXCount = rect().width() / imageSize.width(); |
|
90 |
imageYCount = mTempRowCount; |
|
91 |
widthSpacingPlusImage = mRenderer->getSpacing().height() + imageSize.height(); |
|
92 |
heightSpacingPlusImage = mRenderer->getSpacing().width() + imageSize.width(); |
|
93 |
} |
|
94 |
else //portrait mode |
|
95 |
{ |
|
96 |
imageXCount = mTempRowCount; |
|
97 |
imageYCount = rect().height() / imageSize.height(); |
|
98 |
widthSpacingPlusImage = mRenderer->getSpacing().width() + imageSize.width(); |
|
99 |
heightSpacingPlusImage = mRenderer->getSpacing().height() + imageSize.height(); |
|
100 |
} |
|
101 |
||
102 |
int yOffset(0); |
|
103 |
if (scrollDirection() == Qt::Horizontal ) { |
|
104 |
yOffset = (rect().height() - (mUserItemSize.height()*mHorizontalRowCount))/2; |
|
105 |
} |
|
106 |
||
107 |
for (int xCounter = 0; xCounter < (imageXCount+1); ++xCounter) |
|
108 |
{ |
|
109 |
for (int yCounter = 0; yCounter < (imageYCount+1); ++yCounter) |
|
110 |
{ |
|
111 |
painter->drawLine(QPoint(0, yOffset + yCounter * heightSpacingPlusImage), |
|
112 |
QPoint(rect().width(), yOffset + yCounter * heightSpacingPlusImage)); |
|
113 |
} |
|
114 |
||
115 |
painter->drawLine(QPoint(xCounter * widthSpacingPlusImage, yOffset), |
|
116 |
QPoint(xCounter * widthSpacingPlusImage, rect().height()-yOffset)); |
|
117 |
} |
|
118 |
||
119 |
painter->setPen(oldPen); |
|
120 |
||
121 |
} |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
122 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
updateSelectedItem(); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
125 |
|
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
HgMediaWallRenderer* HgGridContainer::createRenderer(Qt::Orientation scrollDirection) |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
{ |
2
49c70dcc3f17
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
128 |
HgMediaWallRenderer* renderer = new HgMediaWallRenderer(this, scrollDirection, scrollDirection, false); |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
renderer->enableCoverflowMode(false); |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
renderer->setImageSize(mUserItemSize); |
17 | 131 |
const int rowCount = scrollDirection == Qt::Horizontal ? mHorizontalRowCount : mVerticalColumnCount; |
132 |
renderer->setRowCount(rowCount, renderer->getImageSize(), false); |
|
20 | 133 |
renderer->enableReflections(mReflectionsEnabled && scrollDirection == Qt::Horizontal); |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
renderer->setSpacing(mUserItemSpacing); |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
return renderer; |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
qreal HgGridContainer::getCameraDistance(qreal springVelocity) |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
{ |
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
141 |
if (mRenderer->getScrollDirection() == Qt::Vertical || !mEffect3dEnabled) |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
return 0; |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
return qAbs(springVelocity * 0.01f); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
qreal HgGridContainer::getCameraRotationY(qreal springVelocity) |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
{ |
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
149 |
if (mRenderer->getScrollDirection() == Qt::Vertical || !mEffect3dEnabled) |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
return 0; |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
|
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
return qBound(-KCameraMaxYAngle, springVelocity * KSpringVelocityToCameraYAngleFactor, KCameraMaxYAngle); |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
|
17 | 155 |
bool HgGridContainer::handleTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
{ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
Q_UNUSED(pos) |
17 | 158 |
|
20 | 159 |
if (!mIgnoreGestureAction) { |
160 |
// This enables tactile and audio feedback |
|
161 |
HbWidgetFeedback::triggered(this, Hb::InstantPressed, 0); |
|
162 |
} |
|
163 |
||
164 |
if (!mIgnoreGestureAction && mSelectionMode != HgWidget::NoSelection) { |
|
17 | 165 |
return handleItemSelection(hitItem); |
166 |
} |
|
167 |
||
168 |
if (!mIgnoreGestureAction) { |
|
169 |
selectItem(hitItemIndex); |
|
170 |
emit activated(hitItem->modelIndex()); |
|
171 |
} else { |
|
172 |
mSpring.resetVelocity(); |
|
173 |
update(); |
|
174 |
mIgnoreGestureAction = false; |
|
175 |
} |
|
176 |
return true; |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
} |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
|
17 | 179 |
bool HgGridContainer::handleLongTapAction(const QPointF& pos, HgWidgetItem* hitItem, int hitItemIndex) |
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
{ |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
Q_UNUSED(hitItemIndex) |
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
|
17 | 183 |
INFO("Long tap:" << hitItem->modelIndex().row()); |
184 |
||
2
49c70dcc3f17
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
1
diff
changeset
|
185 |
selectItem(hitItemIndex); |
17 | 186 |
|
187 |
if (!mIgnoreGestureAction) { |
|
188 |
if (mHandleLongPress){ |
|
189 |
emit longPressed(hitItem->modelIndex(), pos); |
|
190 |
} |
|
191 |
} else { |
|
192 |
mSpring.resetVelocity(); |
|
193 |
update(); |
|
194 |
mIgnoreGestureAction = false; |
|
195 |
} |
|
196 |
return true; |
|
0
89c329efa980
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
} |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
|
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
199 |
void HgGridContainer::onScrollPositionChanged(qreal pos) |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
{ |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
201 |
HgContainer::onScrollPositionChanged(pos); |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
|
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
if (pos < 0) return; |
17 | 204 |
const int index = ((int)pos)*currentRowCount(); |
1
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
205 |
if (index > itemCount()) return; |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
206 |
|
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
207 |
HgWidgetItem* item = itemByIndex(index); |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
208 |
if (item && item->modelIndex() != mSelectionModel->currentIndex()) { |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
mSelectionModel->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Current); |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
210 |
} |
e48454f237ca
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
211 |
} |
3
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
212 |
|
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
213 |
void HgGridContainer::setEffect3dEnabled(bool effect3dEnabled) |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
214 |
{ |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
215 |
if (mEffect3dEnabled != effect3dEnabled) { |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
216 |
// Setting has changed. redraw screen. |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
217 |
mEffect3dEnabled = effect3dEnabled; |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
218 |
update(); |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
219 |
} |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
220 |
} |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
221 |
|
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
222 |
bool HgGridContainer::effect3dEnabled() const |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
223 |
{ |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
224 |
return mEffect3dEnabled; |
c863538fcbb6
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
2
diff
changeset
|
225 |
} |
17 | 226 |
|
227 |
bool HgGridContainer::handleTap(Qt::GestureState state, const QPointF &pos) |
|
228 |
{ |
|
229 |
FUNC_LOG; |
|
230 |
||
231 |
bool handleGesture = false; |
|
232 |
||
233 |
if (hasItemAt(pos)) { |
|
234 |
switch (state) |
|
235 |
{ |
|
236 |
case Qt::GestureStarted: |
|
20 | 237 |
{ |
17 | 238 |
// TODO IS THIS IF REALLY NEEDED |
239 |
if(mSpring.isActive()) { |
|
240 |
qreal springPos = mSpring.pos().x(); |
|
241 |
int gridTotalHeightInImages = ceilf( mItems.count() / mRenderer->getRowCount() ); |
|
242 |
qreal currentViewHeightInImages; |
|
243 |
if (scrollDirection() == Qt::Horizontal ) { |
|
244 |
int rowHeight = mRenderer->getImageSize().width() + mRenderer->getSpacing().width(); |
|
245 |
currentViewHeightInImages = rect().width() / rowHeight; |
|
246 |
} else { |
|
247 |
int rowHeight = mRenderer->getImageSize().height() + mRenderer->getSpacing().height(); |
|
248 |
currentViewHeightInImages = rect().height() / rowHeight; |
|
249 |
} |
|
250 |
||
251 |
// If list does not currently fill the whole screen (some theme background behind the list |
|
252 |
// is visible), and list is moving, then do not react to tapping. |
|
253 |
if( springPos >= 0 |
|
254 |
&& springPos <= (gridTotalHeightInImages - currentViewHeightInImages) ) { |
|
255 |
mSpring.cancel(); |
|
256 |
mEmitScrollingEnded = true; |
|
257 |
} |
|
258 |
mIgnoreGestureAction = true; |
|
259 |
} else if (mHandleLongPress){ |
|
260 |
startLongPressWatcher(pos); |
|
261 |
} |
|
262 |
break; |
|
263 |
} |
|
264 |
case Qt::GestureFinished: |
|
265 |
{ |
|
266 |
int hitItemindex = -1; |
|
267 |
HgWidgetItem* hitItem = getItemAt(pos,hitItemindex); |
|
268 |
handleGesture = handleTapAction(pos, hitItem, hitItemindex); |
|
269 |
if (mEmitScrollingEnded) { |
|
270 |
mEmitScrollingEnded = false; |
|
271 |
emit scrollingEnded(); |
|
272 |
} |
|
273 |
} |
|
274 |
case Qt::GestureUpdated: |
|
275 |
case Qt::GestureCanceled: |
|
276 |
default: |
|
277 |
stopLongPressWatcher(); |
|
278 |
break; |
|
279 |
} |
|
280 |
||
281 |
handleGesture = true; |
|
282 |
} else { |
|
283 |
if (state == Qt::GestureFinished) { |
|
284 |
mSpring.resetVelocity(); |
|
285 |
mSpring.cancel(); |
|
286 |
update(); |
|
287 |
emit emptySpacePressed(); |
|
288 |
} |
|
289 |
} |
|
290 |
return handleGesture; |
|
291 |
} |
|
292 |
||
293 |
bool HgGridContainer::handleLongTap(Qt::GestureState state, const QPointF &pos) |
|
294 |
{ |
|
295 |
// HContainer handles the long tap if there is item at the pos. |
|
296 |
bool handled = HgContainer::handleLongTap(state,pos); |
|
297 |
if (!handled && state == Qt::GestureFinished) { |
|
298 |
mSpring.resetVelocity(); |
|
299 |
mSpring.cancel(); |
|
300 |
update(); |
|
301 |
emit emptySpacePressed(); |
|
302 |
} |
|
303 |
return handled; |
|
304 |
} |
|
305 |
||
306 |
void HgGridContainer::setPinchEnabled(bool pinchEnabled) |
|
307 |
{ |
|
308 |
if (mPinchEnabled != pinchEnabled) { |
|
309 |
mPinchEnabled = pinchEnabled; |
|
310 |
if (mPinchEnabled) { |
|
311 |
grabGesture(Qt::PinchGesture); |
|
312 |
iFadeAnimation.setTargetObject(this); |
|
313 |
iFadeAnimation.setPropertyName("opacity"); |
|
314 |
iFadeAnimation.setDuration(500); |
|
315 |
iFadeAnimation.setStartValue(1.0); |
|
316 |
iFadeAnimation.setEndValue(0.0); |
|
317 |
connect(&iFadeAnimation, SIGNAL(finished()), SLOT(effectFinished())); |
|
318 |
||
319 |
} else { |
|
320 |
iFadeAnimation.stop(); |
|
321 |
setOpacity(1); |
|
322 |
disconnect(&iFadeAnimation,SIGNAL(finished()), this, SLOT(effectFinished())); |
|
323 |
ungrabGesture(Qt::PinchGesture); |
|
324 |
} |
|
325 |
} |
|
326 |
} |
|
327 |
||
328 |
bool HgGridContainer::pinchEnabled() const |
|
329 |
{ |
|
330 |
return mPinchEnabled; |
|
331 |
} |
|
332 |
||
333 |
void HgGridContainer::mousePressEvent(QGraphicsSceneMouseEvent *event) |
|
334 |
{ |
|
335 |
if(event->type() == QEvent::GraphicsSceneMousePress) |
|
336 |
{ |
|
337 |
//reset, just in case |
|
338 |
mPinchingOngoing = false; |
|
339 |
mPinchEndAlreadyHandled = false; |
|
340 |
mTempImageHeightForLineGrid = -1; |
|
341 |
mTempImageHeightFinal = -1; |
|
342 |
} |
|
343 |
} |
|
344 |
||
345 |
void HgGridContainer::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
|
346 |
{ |
|
347 |
if(event->type() == QEvent::GraphicsSceneMouseRelease) |
|
348 |
{ |
|
349 |
handlePinchEnd(); |
|
350 |
} |
|
351 |
} |
|
352 |
||
353 |
void HgGridContainer::gestureEvent(QGestureEvent* event) |
|
354 |
{ |
|
355 |
if (mItems.count() == 0) { |
|
356 |
// we have no items so no need to handle the gesture. |
|
357 |
event->ignore(); |
|
358 |
return; |
|
359 |
} |
|
360 |
||
361 |
if (!mPinchingOngoing) { |
|
362 |
HgContainer::gestureEvent(event); |
|
363 |
} |
|
364 |
||
365 |
bool eventHandled(false); |
|
366 |
||
367 |
QGesture* pinchGesture = event->gesture(Qt::PinchGesture); |
|
368 |
if(mPinchEnabled && !mReactToOnlyPanGestures && pinchGesture) |
|
369 |
{ |
|
20 | 370 |
mIgnoreGestureAction = true; |
17 | 371 |
HbPinchGesture* pinch = static_cast<HbPinchGesture *>(pinchGesture); |
372 |
switch (pinch->state()) |
|
373 |
{ |
|
374 |
case Qt::GestureUpdated: |
|
375 |
handlePinchUpdate( pinch ); |
|
376 |
break; |
|
377 |
case Qt::GestureStarted: |
|
378 |
mTempRowCount = -1; //reset, just in case |
|
379 |
mTempImageHeightForLineGrid = -1; //reset, just in case |
|
380 |
mTempImageHeightFinal = -1; //reset, just in case |
|
381 |
iTargetRowCountList.clear(); |
|
382 |
mPinchingOngoing = true; |
|
383 |
mPinchEndAlreadyHandled = false; |
|
20 | 384 |
stopLongPressWatcher(); |
385 |
if (mSpring.isActive()) { |
|
386 |
mSpring.cancel(); |
|
387 |
emit scrollingEnded(); |
|
388 |
} |
|
17 | 389 |
break; |
390 |
case Qt::GestureCanceled: |
|
391 |
mPinchingOngoing = false; |
|
392 |
mPinchEndAlreadyHandled = true; |
|
393 |
update(); //redraw |
|
394 |
break; |
|
395 |
case Qt::GestureFinished: |
|
396 |
handlePinchEnd(); |
|
397 |
break; |
|
398 |
default: |
|
399 |
break; |
|
400 |
} |
|
401 |
||
402 |
eventHandled = true; |
|
403 |
} |
|
404 |
||
405 |
eventHandled ? event->accept() : event->ignore(); |
|
406 |
} |
|
407 |
||
408 |
void HgGridContainer::handlePinchUpdate(HbPinchGesture* pinch) |
|
409 |
{ |
|
410 |
// while user is scaling down scale factor changes from 1 -> 0. When scaling up scale factor |
|
411 |
// changes from 1 -> x |
|
412 |
qreal change = 0.0; |
|
413 |
qreal scaleFactor = pinch->scaleFactor();// + pinch->lastScaleFactor())/2; |
|
414 |
if (scaleFactor < 1) { |
|
415 |
change = -5*(1-scaleFactor); |
|
416 |
} else { |
|
417 |
change = scaleFactor - 1; |
|
418 |
} |
|
419 |
||
420 |
qreal wannaBeRowCount = mRenderer->getRowCount() + change*1.5; |
|
421 |
||
422 |
int minRowCount = scrollDirection() == Qt::Horizontal ? |
|
423 |
mHorizontalPinchLevels.first : mVerticalPinchLevels.first; |
|
424 |
int maxRowCount = scrollDirection() == Qt::Horizontal ? |
|
425 |
mHorizontalPinchLevels.second : mVerticalPinchLevels.second; |
|
426 |
||
427 |
if(wannaBeRowCount < minRowCount) { |
|
428 |
wannaBeRowCount = minRowCount; |
|
429 |
} |
|
430 |
else if(wannaBeRowCount > maxRowCount) { |
|
431 |
wannaBeRowCount = maxRowCount; |
|
432 |
} |
|
433 |
||
434 |
mTempRowCount = (int)wannaBeRowCount; |
|
435 |
||
436 |
while (iTargetRowCountList.count() >= 4) { |
|
437 |
iTargetRowCountList.dequeue(); |
|
438 |
} |
|
439 |
||
440 |
iTargetRowCountList.enqueue(wannaBeRowCount); |
|
441 |
||
442 |
||
443 |
qreal averageRowCount = 0; |
|
444 |
int count = iTargetRowCountList.count(); |
|
445 |
if (count >= 2 ) { |
|
446 |
averageRowCount += iTargetRowCountList.at(count-1); |
|
447 |
averageRowCount += iTargetRowCountList.at(count-2); |
|
448 |
averageRowCount /= 2; |
|
449 |
} else { |
|
450 |
averageRowCount = wannaBeRowCount; |
|
451 |
} |
|
452 |
||
453 |
if (scrollDirection() == Qt::Horizontal ) { |
|
454 |
int centerAreaheight = mUserItemSize.height()*mHorizontalRowCount; |
|
455 |
mTempImageHeightForLineGrid = (centerAreaheight - ((int)averageRowCount + 1) * mRenderer->getSpacing().height()) / averageRowCount; |
|
456 |
} else { |
|
457 |
mTempImageHeightForLineGrid = (rect().width() - ((int)averageRowCount + 1) * mRenderer->getSpacing().width()) / averageRowCount; |
|
458 |
} |
|
459 |
||
460 |
update(); //redraw |
|
461 |
} |
|
462 |
||
463 |
void HgGridContainer::handlePinchEnd() |
|
464 |
{ |
|
465 |
if(mPinchingOngoing && !mPinchEndAlreadyHandled) { |
|
466 |
mPinchingOngoing = false; |
|
467 |
mPinchEndAlreadyHandled = true; |
|
468 |
||
469 |
qreal averageRowCount = 0; |
|
470 |
int count = iTargetRowCountList.count(); |
|
471 |
while (!iTargetRowCountList.isEmpty()) { |
|
472 |
qreal value = iTargetRowCountList.dequeue(); |
|
473 |
averageRowCount += value; |
|
474 |
} |
|
475 |
||
476 |
averageRowCount /= count; |
|
477 |
||
478 |
qreal temp = floorf(averageRowCount); |
|
479 |
averageRowCount = (averageRowCount - temp > 0.5f) ? ceilf(averageRowCount) : temp; |
|
480 |
mTempRowCount = averageRowCount; |
|
481 |
||
482 |
// change the row count if it has been changed by pinching |
|
483 |
if ( (mTempRowCount != -1) |
|
484 |
&& (mTempRowCount != mRenderer->getRowCount()) ) { |
|
485 |
||
486 |
if (scrollDirection() == Qt::Horizontal ) { |
|
487 |
int centerAreaheight = mUserItemSize.height()*mHorizontalRowCount; |
|
488 |
mTempImageHeightFinal = (centerAreaheight - ((int)mTempRowCount + 1) * mRenderer->getSpacing().height()) / (int)mTempRowCount; |
|
489 |
} else { |
|
490 |
mTempImageHeightFinal = (rect().width() - ((int)mTempRowCount + 1) * mRenderer->getSpacing().width()) / (int)mTempRowCount; |
|
491 |
} |
|
492 |
||
493 |
mTargetRowCount = mTempRowCount; |
|
494 |
mTargetImageSize = QSizeF(mTempImageHeightFinal,mTempImageHeightFinal); |
|
495 |
iFadeAnimation.setDirection(QAbstractAnimation::Forward); |
|
496 |
iFadeAnimation.start(); |
|
497 |
} |
|
498 |
} |
|
499 |
} |
|
500 |
||
501 |
bool HgGridContainer::event(QEvent *e) |
|
502 |
{ |
|
503 |
if (e->type() == QEvent::TouchBegin) |
|
504 |
{ |
|
505 |
// The TouchBegin event must be accepted (i.e. return true) to be able to receive Pinch events. |
|
506 |
return true; |
|
507 |
} |
|
508 |
else if(e->type() == QEvent::Gesture) |
|
509 |
{ |
|
510 |
// Since pinch gesture is not forwarded to |
|
511 |
// gestureEvent function so lets handle it here. |
|
512 |
QGestureEvent* gesture = static_cast<QGestureEvent*>(e); |
|
513 |
gestureEvent(gesture); |
|
514 |
return true; |
|
515 |
} |
|
516 |
||
517 |
return QGraphicsObject::event(e); |
|
518 |
} |
|
519 |
||
520 |
void HgGridContainer::effectFinished() |
|
521 |
{ |
|
522 |
if (iFadeAnimation.direction() == QAbstractAnimation::Forward) { |
|
523 |
mRenderer->setRowCount(mTargetRowCount, mTargetImageSize); |
|
524 |
mRenderer->setImageSize(mTargetImageSize); |
|
525 |
scrollTo(mSelectionModel->currentIndex()); |
|
526 |
iFadeAnimation.setDirection(QAbstractAnimation::Backward); |
|
20 | 527 |
iFadeAnimation.start(); |
528 |
||
529 |
// Reflections are drawn only in horizontal scrolling mode. |
|
530 |
const bool reflectionsEnabled = mReflectionsEnabled && |
|
531 |
scrollDirection() == Qt::Horizontal; |
|
532 |
// reflections need to be recreated since row count changes. |
|
533 |
// reflections are created only to the bottom row. |
|
534 |
updateReflections(reflectionsEnabled,0,mItems.count()); |
|
17 | 535 |
} |
536 |
} |
|
537 |
||
538 |
void HgGridContainer::setRowCount(int count, Qt::Orientation scrollDirection) |
|
539 |
{ |
|
540 |
if (scrollDirection == Qt::Horizontal) { |
|
541 |
mHorizontalRowCount = count; |
|
542 |
} else { |
|
543 |
mVerticalColumnCount = count; |
|
544 |
} |
|
545 |
} |
|
546 |
||
547 |
int HgGridContainer::rowCount(Qt::Orientation scrollDirection) const |
|
548 |
{ |
|
549 |
return scrollDirection == Qt::Horizontal ? mHorizontalRowCount : mVerticalColumnCount; |
|
550 |
} |
|
551 |
||
552 |
void HgGridContainer::setOrientation(Qt::Orientation orientation, bool animate) |
|
553 |
{ |
|
20 | 554 |
const int newRowCount = orientation == Qt::Horizontal ? |
555 |
mHorizontalRowCount : mVerticalColumnCount; |
|
556 |
const bool rowCountChanges = currentRowCount() != newRowCount; |
|
17 | 557 |
|
20 | 558 |
// Disable orientation change animation if the row count also changes. |
559 |
HgContainer::setOrientation(orientation, animate && !rowCountChanges); |
|
560 |
||
561 |
mRenderer->setImageSize(mUserItemSize); |
|
562 |
if (rowCountChanges) { |
|
563 |
mRenderer->setRowCount(newRowCount, mUserItemSize, false); |
|
564 |
scrollTo(mSelectionModel->currentIndex()); |
|
17 | 565 |
} |
20 | 566 |
|
567 |
// Reflections are drawn only in horizontal scrolling mode. |
|
568 |
const bool reflectionsEnabled = mReflectionsEnabled && orientation == Qt::Horizontal; |
|
569 |
mRenderer->enableReflections(reflectionsEnabled); |
|
570 |
updateReflections(reflectionsEnabled,0,mItems.count()); |
|
17 | 571 |
} |
572 |
||
573 |
void HgGridContainer::setPinchLevels(QPair<int,int> levels, Qt::Orientation scrollDirection) |
|
574 |
{ |
|
575 |
if (scrollDirection == Qt::Horizontal) { |
|
576 |
mHorizontalPinchLevels = levels; |
|
577 |
} else { |
|
578 |
mVerticalPinchLevels = levels; |
|
579 |
} |
|
580 |
} |
|
581 |
||
582 |
QPair<int,int> HgGridContainer::pinchLevels(Qt::Orientation scrollDirection) const |
|
583 |
{ |
|
584 |
return scrollDirection == Qt::Horizontal ? |
|
585 |
mHorizontalPinchLevels : mVerticalPinchLevels; |
|
586 |
} |
|
587 |
||
20 | 588 |
void HgGridContainer::setReflectionsEnabled(bool reflectionsEnabled) |
589 |
{ |
|
590 |
mReflectionsEnabled = reflectionsEnabled; |
|
591 |
mRenderer->enableReflections(reflectionsEnabled); |
|
592 |
} |
|
593 |
||
594 |
bool HgGridContainer::reflectionsEnabled() const |
|
595 |
{ |
|
596 |
return mReflectionsEnabled; |
|
597 |
} |
|
598 |
||
599 |
void HgGridContainer::updateReflections(bool enable, int start, int end) |
|
600 |
{ |
|
601 |
int first = qBound(0, start, mItems.count()-1); |
|
602 |
int last = qBound(0, end, mItems.count()-1); |
|
603 |
const int rowCount = currentRowCount(); |
|
604 |
for(;first<=last; first++){ |
|
605 |
HgWidgetItem* item = mItems.at(first); |
|
606 |
item->enableReflection(enable && ((first+1)%rowCount == 0)); |
|
607 |
} |
|
608 |
} |
|
609 |
||
610 |
void HgGridContainer::addItems(int start, int end) |
|
611 |
{ |
|
612 |
HgContainer::addItems(start, end); |
|
613 |
if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) { |
|
614 |
updateReflections(true,start,mItems.count()); |
|
615 |
} |
|
616 |
} |
|
617 |
||
618 |
void HgGridContainer::removeItems(int start, int end) |
|
619 |
{ |
|
620 |
HgContainer::removeItems(start,end); |
|
621 |
if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) { |
|
622 |
updateReflections(true,start,mItems.count()); |
|
623 |
} |
|
624 |
} |
|
625 |
||
626 |
void HgGridContainer::moveItems(int start, int end, int destination) |
|
627 |
{ |
|
628 |
HgContainer::moveItems(start,end,destination); |
|
629 |
if (mReflectionsEnabled && scrollDirection() == Qt::Horizontal) { |
|
630 |
updateReflections(true,start,destination+(end-start)); |
|
631 |
} |
|
632 |
} |
|
633 |
||
17 | 634 |
// End of file |