Maybe you should start from the beginning and tell us what exactly you are trying to do. I mean, something more detailed than that you're drawing a radar screen.
Maybe you should start from the beginning and tell us what exactly you are trying to do. I mean, something more detailed than that you're drawing a radar screen.
i say you, you imagine you have a svg map like worldmap that you want add that in the center of some circles like radar, you have some target added in this map and you can select or move them and some button outside of this circle for changing zooming and panning and adding target to this map.
danics (16th July 2012)
my goals?
so, loading a large svg file and creating some special map viewer for this file,
for not confusing anyone else i ask another questions and myself decide how implement that,
-how can i draw a svg file in background of a QGraphicsScene that cover whole scene?
-- when scaling a scene my background must scale too?
tnx for your attention again.
We won't make progress this way, you know...
But let's have it your way...
For example using QGraphicsScene::drawBackground()-how can i draw a svg file in background of a QGraphicsScene that cover whole scene?
It can, it doesn't have to.-- when scaling a scene my background must scale too?
but when i use paint method of QGraphicsSvgItem in drawpackground function its size isnt set with the size of scene how can i do this?
drawBackground() has nothing to do with items. You are supposed to paint directly on a given painter.
if i want draw svg file like raster files so why i must use svg? any other solution for changing scale and full view of a svg item in scene, and then clipping a rectangle of that
I dont think QGraphicsscene will be a good choice for you. You will need to re-draw the SVG at different scales...
so a simple paint method will do.
QGraphicsScene will help you only if you opt for opengl.
danics (18th July 2012)
You don't have to use SVG. Besides I have no idea what does it have to do with this situation.
There are lots of possible solutions but they all involve rasterizing the SVG at some point. Unfortunately physical devices have limited resolution so at some point they need to have a raster rather than mathematical representation.any other solution for changing scale and full view of a svg item in scene, and then clipping a rectangle of that
danics (18th July 2012)
i m handling this situation with using of create different tile in different zoom mode and loading them in application, but i have a periodic repaint in my widget and this function get so many cpu usage this is my paint
Qt Code:
if(backInvalidate){ backImage.fill(qRgba(0,0,0,0)); createBackground(&imagePainter); backInvalidate = false; } if(foreInvalidate){ foregroundImage.fill(qRgba(0,0,0,0)); createForeground(&imagePainter); foreinvalidate = false; } mainPainter->resetTransform(); mainPainter->drawImage(0, 0, foregroundImage); mainPainter->drawImage(0, 0, backImage); paintTargets(mainPainter); drawHand(mainPainter); delete mainPainter; }To copy to clipboard, switch view to plain text mode
how can i painting of my background and foreground only once?
speed of my program in current coding is so slow
The paintEvent will always get called when it needs an update.
Your paint event seems somewhat heavy. Try using a back and front image separately and simply draw them in paintEvent. Do not create them in paint Event.
You will need to simply update your member variable images from a function. This way the paintEvent will only paint, not create images.
if you see, i only created main two images when i change my background or foreground, so this event only paint drawitems method and drawhand in every 600 msec, however the first method only paint 2 circles and anotherone draw a clock hand animation,The paintEvent will always get called when it needs an update.
Your paint event seems somewhat heavy. Try using a back and front image separately and simply draw them in paintEvent. Do not create them in paint Event.
You will need to simply update your member variable images from a function. This way the paintEvent will only paint, not create images.
base class is QWidgetWhat's the superclass of RadarCircle?
Last edited by danics; 19th July 2012 at 19:33.
Bookmarks