equal
deleted
inserted
replaced
42 \param parent The parent of scroll area widget |
42 \param parent The parent of scroll area widget |
43 */ |
43 */ |
44 CalenDayContentScrollArea::CalenDayContentScrollArea(QGraphicsItem *parent) : |
44 CalenDayContentScrollArea::CalenDayContentScrollArea(QGraphicsItem *parent) : |
45 HbScrollArea(parent), mPanDayDirection(ECalenPanNotSet), mIsMoving(false), |
45 HbScrollArea(parent), mPanDayDirection(ECalenPanNotSet), mIsMoving(false), |
46 mMoveDirection(ECalenScrollNoDayChange) |
46 mMoveDirection(ECalenScrollNoDayChange) |
47 { |
47 { |
48 // Set scroll settings |
|
49 setScrollDirections(Qt::Horizontal); |
|
50 setClampingStyle(StrictClamping); |
|
51 setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); |
|
52 |
|
53 #ifdef CALENDAYVIEW_PANNING_ENABLED |
48 #ifdef CALENDAYVIEW_PANNING_ENABLED |
54 grabGesture(Qt::PanGesture); |
49 grabGesture(Qt::PanGesture); |
55 ungrabGesture(Qt::SwipeGesture); |
50 ungrabGesture(Qt::SwipeGesture); |
56 #else |
51 #else |
57 grabGesture(Qt::SwipeGesture); |
52 grabGesture(Qt::SwipeGesture); |
59 #endif |
54 #endif |
60 |
55 |
61 // Get the width of content area and orientation of screen |
56 // Get the width of content area and orientation of screen |
62 mContentWidth = CalenDayUtils::instance()->contentWidth(); |
57 mContentWidth = CalenDayUtils::instance()->contentWidth(); |
63 mOrientation = CalenDayUtils::instance()->orientation(); |
58 mOrientation = CalenDayUtils::instance()->orientation(); |
|
59 |
|
60 // Fix the width of scroll area |
|
61 setMinimumWidth(mContentWidth); |
|
62 setMaximumWidth(mContentWidth); |
64 |
63 |
65 // Connect to main window's orientationChanged SIGNAL to handle orientation |
64 // Connect to main window's orientationChanged SIGNAL to handle orientation |
66 // switching |
65 // switching |
67 connect(CalenDayUtils::instance()->mainWindow(), |
66 connect(CalenDayUtils::instance()->mainWindow(), |
68 SIGNAL(orientationChanged(Qt::Orientation)), this, |
67 SIGNAL(orientationChanged(Qt::Orientation)), this, |
400 void CalenDayContentScrollArea::orientationChanged(Qt::Orientation orientation) |
399 void CalenDayContentScrollArea::orientationChanged(Qt::Orientation orientation) |
401 { |
400 { |
402 // Update the width of content area |
401 // Update the width of content area |
403 mContentWidth = CalenDayUtils::instance()->contentWidth(); |
402 mContentWidth = CalenDayUtils::instance()->contentWidth(); |
404 mOrientation = orientation; |
403 mOrientation = orientation; |
405 |
404 |
|
405 // Fix the width of scroll area |
|
406 setMinimumWidth(mContentWidth); |
|
407 setMaximumWidth(mContentWidth); |
|
408 |
|
409 scrollToMiddleWidget(); |
|
410 |
406 // Reset flag related to moving |
411 // Reset flag related to moving |
407 mPanDayDirection = ECalenPanNotSet; |
412 mPanDayDirection = ECalenPanNotSet; |
408 mMoveDirection = ECalenScrollNoDayChange; |
413 mMoveDirection = ECalenScrollNoDayChange; |
409 mIsMoving = false; |
414 mIsMoving = false; |
410 } |
415 } |