943 void CalenMonthGrid::orientationChanged(Qt::Orientation newOrientation) |
943 void CalenMonthGrid::orientationChanged(Qt::Orientation newOrientation) |
944 { |
944 { |
945 Q_UNUSED(newOrientation) |
945 Q_UNUSED(newOrientation) |
946 // We are overriding this function to avoid the default behavior of |
946 // We are overriding this function to avoid the default behavior of |
947 // hbgridview on orientation change as it swaps the row and column counts |
947 // hbgridview on orientation change as it swaps the row and column counts |
|
948 // Calculate the proper index to be scrolled to |
|
949 int rowsInPrevMonth; |
|
950 int itemToBeScrolled; |
|
951 QModelIndex indexToBeScrolled; |
|
952 if (newOrientation == Qt::Horizontal) { |
|
953 rowsInPrevMonth = mView->rowsInPrevMonth(); |
|
954 itemToBeScrolled = rowsInPrevMonth * KCalenDaysInWeek; |
|
955 indexToBeScrolled = mModel->index(itemToBeScrolled, 0); |
|
956 mIsAtomicScroll = true; |
|
957 scrollTo(indexToBeScrolled); |
|
958 } else { |
|
959 rowsInPrevMonth = mView->rowsInPrevMonth(); |
|
960 itemToBeScrolled = rowsInPrevMonth * KCalenDaysInWeek; |
|
961 indexToBeScrolled = mModel->index(itemToBeScrolled, 0); |
|
962 mIsAtomicScroll = true; |
|
963 scrollTo(indexToBeScrolled); |
|
964 |
|
965 itemToBeScrolled = ((rowsInPrevMonth + KNumOfVisibleRows) * |
|
966 KCalenDaysInWeek) - 1; |
|
967 indexToBeScrolled = mModel->index(itemToBeScrolled, 0); |
|
968 mIsAtomicScroll = true; |
|
969 scrollTo(indexToBeScrolled); |
|
970 } |
948 } |
971 } |
949 |
972 |
950 /*! |
973 /*! |
951 Paint function to draw grid lines |
974 Paint function to draw grid lines |
952 */ |
975 */ |