Thumbnail Slider moving within boundary limit of the player
-
My thumbnail slider moves with the mouse pointer in a video player, but at the extreme ends on both sides, it moves out of the player's boundary.
I want it to make work like youtube, at the extreme ends the preview window compensates its with the mouse pointer.
Below is the code to move the preview window.
bool inside(QPoint p){ QRect r(mapToGlobal(QPoint(0, -height())), QSize(width(), 2*height())); return r.contains(p); } //. . . . . . . case QEvent::MouseMove: { QMouseEvent *pMouseEvent = static_cast<QMouseEvent*>(e); if(inside(pMouseEvent->globalPos())) { QPoint point(pMouseEvent->globalPos().x(), mapToGlobal(QPoint(0, 0)).y()-100); QRect geometry = m_PrvDialog->geometry(); geometry.moveCenter(point); //setting image on the preview widget . . . //moving the preview widget m_PrvDialog->move(pMouseEvent->globalPos().x() - 100, geometry.y() - 10); } break; }
-
Hi,
How are you determining the image number to get from the video ?
There you need to put a limit to ensure that you don't request a frame that has a bigger number than the available amount.
-
Hi,
How are you determining the image number to get from the video ?
There you need to put a limit to ensure that you don't request a frame that has a bigger number than the available amount.
@SGaist No not about the fetching image. Its about restricting the movement of the preview dialog. In the attached image it should be in the green box, it should not move outside the player, red mark boundary. Just like the preview happens in Youtube player at the both extreme ends.
-
The same suggestion applies. You have to ensure that when you move the preview widget, its left coordinates is at most at the player's right minus the preview width.
-
The same suggestion applies. You have to ensure that when you move the preview widget, its left coordinates is at most at the player's right minus the preview width.
-
So what is your current issue ?