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. Move my video rendering label
Forum Update on Monday, May 27th 2025

Move my video rendering label

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 266 Views
  • 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.
  • vicky.vigiaV Offline
    vicky.vigiaV Offline
    vicky.vigia
    wrote on last edited by
    #1

    Hi Team,

    I am trying this code and modified it a bit to create my own QLabel class, so I can support mouse move. The code is:

    void videoLbl::mouseMoveEvent(QMouseEvent *ev)
    {
        this->move(ev->x(), ev->y());
    }
    

    But, as soon as I move the video, it flickers and snaps back to the original position, like it repaints and get back to the original rendering position! Now, I am not sure, how to update the newly moved frame(s) to get rendered at the new position.

    Furthermore, if I try to move the same using this code, by hardcoding the position values, it never works, or gets repainted to the original position:

    void videoLbl::updatePlayerUI(QImage img)
    {
        //this->setAlignment(Qt::AlignCenter);
        this->setGeometry(10, 10, 40, 40);
        this->move(10, 10);
        this->setPixmap(QPixmap::fromImage(img).scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation));
    }
    
    

    I am using the following way in my main window class to render my custom Label class:

        m_videoLblDrag = new videoLbl(); // custom QLabel class instance
        m_videoLblDrag->m_vidplayer->loadVideo(fullpath);
        m_videoLblDrag->m_vidplayer->Play();
        ui->videoBox1->layout()->addWidget(m_videoLblDrag);
    

    Please, can you guide me, please?

    • Vicky
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Did you try to pause the video, then move widget and resume video ?

      1 Reply Last reply
      3
      • vicky.vigiaV Offline
        vicky.vigiaV Offline
        vicky.vigia
        wrote on last edited by
        #3

        Hello,

        Many thanks for your reply. Yes, after I pause/stop the video, it works as expected! Now what?

        Best Regards!

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

          Hi
          it means you should temporary pause it
          while user moves the Label to avoid the flashing.

          I assume " mouse move." means that user can select the label and move it around on screen.

          Also to make that look good, you should keep the offset into the WIdget where you "grab it"
          like they do there
          https://stackoverflow.com/questions/11172420/moving-object-with-mouse

          1 Reply Last reply
          2

          • Login

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