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. Infinite boundless Canvas

Infinite boundless Canvas

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.1k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    n__c
    wrote on last edited by n__c
    #1

    Hello,

    Apologies if this is not the correct subforum to post to.

    I want to make a drawing app with an infinite canvas (not really infinite, but dynamically resizable when zooming out.) So far I have a simple app in QML using Flickable and Canvas.

    I have an idea of how to create an infinite canvas in C++:

    1. Store every draw operation in a database.
    2. In every paintEvent(), request from the database the drawn operations inside the viewable window and redraw them.

    However, both Canvas and Flickable do not support an infinite canvas, as they both have parameters for the size. I can't imagine exactly how to tie this into QML.

    My plan so far is to look into the actual C++ implementation of Flickable and Canvas and try to figure out the details myself, but I wanted to ask here as well because any knowledge shared would help me a lot, I'd like to avoid any unforeseen pitfalls & do as little work as possible (for example if I only need to re-implement Canvas but not Flickable that would be great.)

    Pl45m4P 1 Reply Last reply
    0
    • N n__c

      Hello,

      Apologies if this is not the correct subforum to post to.

      I want to make a drawing app with an infinite canvas (not really infinite, but dynamically resizable when zooming out.) So far I have a simple app in QML using Flickable and Canvas.

      I have an idea of how to create an infinite canvas in C++:

      1. Store every draw operation in a database.
      2. In every paintEvent(), request from the database the drawn operations inside the viewable window and redraw them.

      However, both Canvas and Flickable do not support an infinite canvas, as they both have parameters for the size. I can't imagine exactly how to tie this into QML.

      My plan so far is to look into the actual C++ implementation of Flickable and Canvas and try to figure out the details myself, but I wanted to ask here as well because any knowledge shared would help me a lot, I'd like to avoid any unforeseen pitfalls & do as little work as possible (for example if I only need to re-implement Canvas but not Flickable that would be great.)

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @n__c said in Infinite boundless Canvas:

      I want to make a drawing app with an infinite canvas.

      Two things are infinite: the universe and human stupidity... and I'm not sure about the universe.
      (Albert Einstein)

      Memory is limited ;-)

      Even if your Canvas should be very very huge... you only draw and update the visible elements and not all of them at all time.
      This is the same approach you would chose when having millions of items or data points in a chart.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      N 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @n__c said in Infinite boundless Canvas:

        I want to make a drawing app with an infinite canvas.

        Two things are infinite: the universe and human stupidity... and I'm not sure about the universe.
        (Albert Einstein)

        Memory is limited ;-)

        Even if your Canvas should be very very huge... you only draw and update the visible elements and not all of them at all time.
        This is the same approach you would chose when having millions of items or data points in a chart.

        N Offline
        N Offline
        n__c
        wrote on last edited by n__c
        #3

        @Pl45m4 the canvas wouldn't be infinite, it would be dynamically resizable by zooming out, for example how google maps does it. I edited my post to make this explicit. Indeed memory is limited, which is why I'm thinking of using a database to only load from disk the part that is visible. I don't want my app to be all in C++, I want these new types to fit into the QML framework so I have the added trouble of thinking of how it should be put together.

        Pl45m4P 1 Reply Last reply
        0
        • N n__c

          @Pl45m4 the canvas wouldn't be infinite, it would be dynamically resizable by zooming out, for example how google maps does it. I edited my post to make this explicit. Indeed memory is limited, which is why I'm thinking of using a database to only load from disk the part that is visible. I don't want my app to be all in C++, I want these new types to fit into the QML framework so I have the added trouble of thinking of how it should be put together.

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @n__c said in Infinite boundless Canvas:

          I don't want my app to be all in C++, I want these new types to fit into the QML framework so I have the added trouble of thinking of how it should be put together.

          These are two different things. Either you paint on QML Canvas or you choose the C++ QGraphicsView Framework.

          For this you could have a look into the Graphics View Examples

          • https://doc.qt.io/qt-6/examples-graphicsview.html

          QML Canvas Example

          • https://doc.qt.io/qt-6/qtquick-canvas-example.html

          Here is the source for QML Flickable
          (but keep in mind, that many thing there are not public API and therefore hidden from general access)

          • https://codebrowser.dev/qt5/qtdeclarative/src/quick/items/qquickflickable.cpp.html

          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          N 1 Reply Last reply
          0
          • Pl45m4P Pl45m4

            @n__c said in Infinite boundless Canvas:

            I don't want my app to be all in C++, I want these new types to fit into the QML framework so I have the added trouble of thinking of how it should be put together.

            These are two different things. Either you paint on QML Canvas or you choose the C++ QGraphicsView Framework.

            For this you could have a look into the Graphics View Examples

            • https://doc.qt.io/qt-6/examples-graphicsview.html

            QML Canvas Example

            • https://doc.qt.io/qt-6/qtquick-canvas-example.html

            Here is the source for QML Flickable
            (but keep in mind, that many thing there are not public API and therefore hidden from general access)

            • https://codebrowser.dev/qt5/qtdeclarative/src/quick/items/qquickflickable.cpp.html
            N Offline
            N Offline
            n__c
            wrote on last edited by
            #5

            @Pl45m4 Thank you, I should definitely look into Graphics View. I'm going to leave this thread open and update with solutions as I come across them.

            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