Results 1 to 2 of 2

Thread: How to use/embed a QGraphicsView into QML with touch events for pinch/pan?

  1. #1
    Join Date
    Jun 2010
    Posts
    31
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default How to use/embed a QGraphicsView into QML with touch events for pinch/pan?

    Hi all,
    I'm using Qt 4.8.2 on Windows7 (with touch screen) and XP (with mouse) for developing an application with graphical editor functionality for placing ICs on a board. The board is a simple image and the goal of that editor is to position the ICs an get their coordinates. That is well done with QGraphicsScene and QGraphicsView.

    The Ui is made with QML because I want to use the ListView component to change several main pages horizontally which contains other custom QML components. On one page you should see the Editors view (exactly the QGraphicsView). Therefore I have "exported" the Editors view with qmlRegisterTyp() - now I can use it in my QML code. But the scene is managed in C++ and I get access to the instantiated Editor via QDeclarativeView->rootObject()->child() to set the scene of that Editor. Everything works fine.

    The Editors QGraphicsView catches Touch events and implements a Pinch and Pan function.

    The problem is that when I use it inside a QML main page, select an IC and move it horizontally the ListView is flicking to next main page. It seems the move/drag events are catched by the QML's declarative view before they passed trough to the Editor's QGraphicsView. I tried also to overwrite viewportEvent(), event() without success.

    I know QML's declarative view is in reality also a QGraphicsView. What I make is to put another QGraphicsView into a QGraphicsView. I think to propagate the events between these views costs a lot of overhead.

    But what kind of architecture I can use if I want to create my Ui with QML and the underlaying complex logic uses a QGraphicsScene?

    Can I pass a QGraphicsScene to an predefined QML component? I think no.

    Write the whole Ui in a QGraphicsView would become high complex and means QML should only be used for simple Uis. I think this is not the goal of QML.

    Have anybody experience with embedding QGraphicsView in QML?

    Thanks a lot...

  2. #2
    Join Date
    Jun 2010
    Posts
    31
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to use/embed a QGraphicsView into QML with touch events for pinch/pan?


Similar Threads

  1. Capturing Touch Screen events in MainWindow
    By lightydo in forum Qt Programming
    Replies: 1
    Last Post: 30th September 2013, 15:23
  2. opengl widget not able to embed in QGraphicsView
    By wagmare in forum Qt Programming
    Replies: 4
    Last Post: 14th December 2010, 07:22
  3. QGraphicsProxyWidget and touch events
    By johnsoga in forum Qt Programming
    Replies: 0
    Last Post: 21st February 2010, 06:53
  4. How to Implement the Touch Screen Events?
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th December 2008, 09:44
  5. Embed QGraphicsView in the QGraphicsScene
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2008, 08:40

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.