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. Time Line zoom

Time Line zoom

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k 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.
  • BlackMambaB Offline
    BlackMambaB Offline
    BlackMamba
    wrote on last edited by
    #1

    Hello,

    I want to achieve a classic time line for the duration of a video.
    I want to be able to zoom in this line to have more accurate time.

    Which Qt widgets would you use to achieve that? Is there something native to scale and display the values depending or how much you zoomed in or should it be completely manual?

    Cheers,

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      You could use a QSlider and use the indicator position where the video is.
      The class you create could inherit the QSlider and catch the event where the zoom is made with (probably mousescrollwheel??). Then set the min and max value accordingly.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • BlackMambaB Offline
        BlackMambaB Offline
        BlackMamba
        wrote on last edited by
        #3

        Hello,
        Yes I need to do with wheel event.
        However, now I have an issue, here is my code :

        @
        #include "SliderTimeLine.h"
        #include <QPainter>
        #include <QWheelEvent>
        #include <QDebug>

        SliderTimeLine::SliderTimeLine(QWidget *parent) :
        QSlider(parent)
        {
        scale = 1;
        setTickInterval(1000);
        setTickPosition(QSlider::TicksBelow);
        }

        void SliderTimeLine::paintEvent ( QPaintEvent * event )
        {
        QPainter painter(this);
        painter.scale(scale,1);
        // paint the parent with painter
        }
        void SliderTimeLine::wheelEvent ( QWheelEvent * event )
        {
        qDebug() << "wheel event";
        scale+=(event->delta()/100);
        update();
        }
        @

        I need to find a way to draw the parent slider with the scaled painter, and I cant figure how to achieve that :(

        Any idea?

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          The child is always capable of sending a signal to the parent (if connected from the parent).
          Also (not real OO programming, but still) you are able to call a parent function by the QObject function parent().
          So something like this:
          @
          this->parent()->update();
          @

          Greetz, Jeroen

          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