Results 1 to 2 of 2

Thread: Reimplementing way items move in QGraphicsScene/QGraphicsView

  1. #1
    Join Date
    Oct 2010
    Posts
    41
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Reimplementing way items move in QGraphicsScene/QGraphicsView

    I want to implement a time line similar to what video editors have. The time line itself would be a subclass of QGraphicsView. The problem is that I want the rectangles (i.e. short sequence of videos) to only move sideways and not in any direction like the ItemIsMovable flag does.

    I'm pretty confused and I'm not sure where I should reimplement the mouse events to make it so only a change in the x position of the mouse causes a movement of the rectangle when the mouse button is pressed. I don't know if I have to reimplement them in QGraphicsScene, QGraphicsView or on the QGraphicsItem themselves. Also, I'm not sure if I have to reimplement mouse move events, press, release or all of them.

    I would like to also make the rectangles resizable but that's a different question and I'll make a new thread when I get there.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2010
    Posts
    41
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Reimplementing way items move in QGraphicsScene/QGraphicsView

    Ok, I got it working now. For anyone with the same problem. I reimplemented mouseMoveEvent() in a QGraphicsItem subclass and just make the item move with the mouse.

Similar Threads

  1. Move items up and down in QListWidget
    By araglin in forum Newbie
    Replies: 7
    Last Post: 31st August 2016, 11:05
  2. Replies: 0
    Last Post: 6th November 2009, 21:59
  3. Position of Items in QGraphicsScene/QGraphicsView
    By StefanK2 in forum Qt Programming
    Replies: 11
    Last Post: 7th July 2009, 14:04
  4. Can't move Items in the scene
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 16th May 2008, 09:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.