Infinite boundless Canvas
-
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
FlickableandCanvas.I have an idea of how to create an infinite canvas in C++:
- Store every draw operation in a database.
- In every
paintEvent(), request from the database the drawn operations inside the viewable window and redraw them.
However, both
CanvasandFlickabledo 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
FlickableandCanvasand 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-implementCanvasbut notFlickablethat would be great.) -
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
FlickableandCanvas.I have an idea of how to create an infinite canvas in C++:
- Store every draw operation in a database.
- In every
paintEvent(), request from the database the drawn operations inside the viewable window and redraw them.
However, both
CanvasandFlickabledo 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
FlickableandCanvasand 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-implementCanvasbut notFlickablethat would be great.)@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
Canvasshould 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__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
Canvasshould 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.@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.
-
@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.
@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
Canvasor you choose the C++QGraphicsViewFramework.For this you could have a look into the
Graphics View ExamplesQML Canvas Example
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) -
@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
Canvasor you choose the C++QGraphicsViewFramework.For this you could have a look into the
Graphics View ExamplesQML Canvas Example
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)