Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Thumbnail Slider moving within boundary limit of the player
Forum Updated to NodeBB v4.3 + New Features

Thumbnail Slider moving within boundary limit of the player

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 373 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sayan275
    wrote on last edited by sayan275
    #1

    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.
    slider_preview.png

    I want it to make work like youtube, at the extreme ends the preview window compensates its with the mouse pointer.
    slider_utube.gif

    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;
            }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        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.

        S Offline
        S Offline
        sayan275
        wrote on last edited by sayan275
        #3

        @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.

        slider_1.png

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply
          1
          • SGaistS SGaist

            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.

            S Offline
            S Offline
            sayan275
            wrote on last edited by
            #5

            @SGaist Yes I have to get the player's geometry also and negate it. Actually all are separate modules. Combined and added to form a player.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              So what is your current issue ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved