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. Custom QQuickItem vs. Widgets QGraphicsView for music notation

Custom QQuickItem vs. Widgets QGraphicsView for music notation

Scheduled Pinned Locked Moved Solved General and Desktop
qmlscene graphqgraphicsviewwidgetsqquickitem
3 Posts 2 Posters 1.4k 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.
  • M Offline
    M Offline
    mbise1993
    wrote on 9 Dec 2018, 20:44 last edited by mbise1993 12 Sept 2018, 20:45
    #1

    I'm working on a hobby project to create a music notation editor (similar to this). I've started on the UI using QML (since it seems to be the main direction in which Qt is moving) and so far, I really enjoy the productivity gain. However, I'm about to start implementing the actual music notation piece and I'm wondering if QtQuick is the right tool for the job. Some features I'm looking for are:

    • Using special fonts to render the musical symbols
    • Interacting with the notation using keyboard and mouse
    • Being able to layout the notation in various ways (1 page wide, 2 pages wide, using horizontal scrolling instead of pages, etc.)
    • Printing support

    I'd prefer to implement all of the rendering and interaction logic in C++ to avoid having to wrap up my entire data model in a way that can be exposed to QML. I've looked into implementing a custom QQuickItem and using the scene graph APIs, but I'm not clear if this would be the best tool for the job (seems overly complex for my use case, how do I handle user interactions and text/glyph rendering). So for my question: is QGraphicsView simply a better fit for my use case? I'd hate to abandon the productivity QML provides for the other parts of the app, but I assume I could still use it inside a Widgets-based app. Or should I just use a custom QQuickItem (or another option I might be missing)?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 9 Dec 2018, 21:27 last edited by
      #2

      Hi
      Its hard to say if QGraphicsView would be "better". It certainly would be good for it.
      Providing panning and zoom.
      But so would/could QML but will require some more boilerplate code to surface the data from the c++ back end.
      It is possible to mix QML and Widgets with
      http://doc.qt.io/qt-5/qquickwidget.html#details
      but again, it will need access to the model somehow.
      A custom QQuickItem could work but making the notation using scene graph api seems a bit
      hardcore. (but efficient)

      Maybe this can help you choose
      http://blog.qt.io/blog/2017/01/19/should-you-be-using-qgraphicsview/

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mbise1993
        wrote on 10 Dec 2018, 04:26 last edited by
        #3

        Thanks for the input! I think I'm going to go with QGraphicsView for the notation and use QQuickWidgets throughout the other pieces of the UI that don't need access to the entire model. I'm hoping that won't be too complicated and will give me the best of both worlds. But I do wonder: is there a specific piece of Qt Quick that's supposed to a "replacement" for QGraphicsView? It seems like the scene graph is a bit too low level, but it's also the only way to gain a lot of control and keep things mostly on the C++ side. It would be nice if the built-in QML elements are exposed via a C++ API at some point.

        1 Reply Last reply
        0

        3/3

        10 Dec 2018, 04:26

        • Login

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