| 89 | } |
| 90 | |
| 91 | void SlidingStackedWidget::slideInWgt(QWidget *newwidget, |
| 92 | enum t_direction direction) |
| 93 | { |
| 94 | if (m_active) |
| 95 | { |
| 96 | return; // at the moment, do not allow re-entrance before an animation is completed. |
| 97 | // other possibility may be to finish the previous animation abrupt, or |
| 98 | // to revert the previous animation with a counter animation, before going ahead |
| 99 | // or to revert the previous animation abrupt |
| 100 | // and all those only, if the newwidget is not the same as that of the previous running animation. |
| 101 | } |
| 102 | else |
| 103 | { |
| 104 | m_active = true; |
| 105 | } |
| 106 | |
| 107 | enum t_direction directionhint; |
| 108 | int now = currentIndex(); // currentIndex() is a function inherited from QStackedWidget |
| 109 | int next = indexOf(newwidget); |
| 110 | |
| 111 | if (now == next) |
| 112 | { |
| 113 | m_active = false; |
| 114 | return; |
| 115 | } |
| 116 | else if (now < next) |
| 117 | { |
| 118 | directionhint = m_vertical ? TOP2BOTTOM : RIGHT2LEFT; |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | directionhint = m_vertical ? BOTTOM2TOP : LEFT2RIGHT; |
| 123 | } |
| 124 | |
| 125 | if (direction == AUTOMATIC) |
| 126 | { |
| 127 | direction = directionhint; |
| 128 | } |
| 129 | |
| 130 | // NOW.... |
| 131 | // calculate the shifts |
| 132 | int offsetx = frameRect().width(); // inherited from mother |
| 133 | int offsety = frameRect().height(); // inherited from mother |
| 134 | // the following is important, to ensure that the new widget |
| 135 | // has correct geometry information when sliding in first time |
| 136 | widget(next)->setGeometry(0, 0, offsetx, offsety); |
| 137 | |
| 138 | if (direction == BOTTOM2TOP) |
| 139 | { |
| 140 | offsetx = 0; |
| 141 | offsety = -offsety; |
| 142 | } |
| 143 | else if (direction == TOP2BOTTOM) |
| 144 | { |
| 145 | offsetx = 0; |
| 146 | // offsety=offsety; |
| 147 | } |
| 148 | else if (direction == RIGHT2LEFT) |
nothing calls this directly
no test coverage detected