Re: QGraphicsItems Layers
hide() or show() respective items before saving data from the scene.
Re: QGraphicsItems Layers
Thanks for the answer. I think i should explain the problem better.
Hide()/Show() can be used while the image is currently loaded. But, when i save the image, the text/items are burned into the image.I can use hide() and save only the image, but subsequently when i reload the image, i need to have access to the created items.
I am hoping there would be a way to save the item layer as a separate format/file, and while recalling the original image if the user likes to view the items, load the item layer also, else load only the image.
Else, am i missing something ? Would really appreciate feedback.
Re: QGraphicsItems Layers
Quote:
Originally Posted by
qtuser20
I can use hide() and save only the image, but subsequently when i reload the image, i need to have access to the created items.
Save them in another file and reload when you need them.
Re: QGraphicsItems Layers
Hi
Instead of loading them as separate images, is there a way to overlay or combine them , so that this process is not transparent to the user .
Thanks
Re: QGraphicsItems Layers
Overlay or combine into what? You need a file to save to. You either save your image as image and the rest as a separate file or you save everything in one file, losing direct access to the image.
Re: QGraphicsItems Layers
For the save operation, i initially hide() the items and save out the image A.
Then, i show() the items and use setbackgroundbrush to white to save out only the items file. Lets call this image B.I do this because image files are larger and would be better to store only items.
When i load back image A, i would like to have a menu control that allows user to choose the items file. When the user loads image B , the contents of items should appear over image A.ie it should appear as if the items are drawn over image A .
I think i should not be using setbackgroundbrush(Qt:white) to store the items file.Is there an alternative suggestion?
Thankyou
Re: QGraphicsItems Layers
If you don't need to do anything with the items after reloading them then you can make the image an item as well and hide the item before saving other items. Graphics scene is by default transparent so you'll get a proper effect (alternatively set the background brush to transparent colour). When reloading, load the two saved images as items.
This only makes sense if you don't want to interact with the items after reloading them. I would suggest to do something else. Use your own binary format to save both the image and the items into a file so that you can later reload both the image and the items (as items, not as a bitmap) and in addition to that provide an export functionality to save the background (and possibly other items if the user wants to) as image file.