View Full Version : Image format without bounding rect
dreamer
30th April 2008, 16:29
I note that some image format such as .png and .gif have not a bounding rect(not all kind of images in this format has not a bounding rect).....
How can i give them one bounding rect?
I import them such QImage file, then I resized them and use the static function QPixmap::fromImage() to transform them into Qpixmap object.....
aamer4yu
30th April 2008, 21:24
What do u mean a bounding rect for an image ??
if u mean border, u can use frame and set its border width to give effect of bounding rect ;)
am i getting u right ?
dreamer
30th April 2008, 21:45
I'm talking about the the bounding rect of a QGraphicsItem that is always rectangular.....
For example I instantiate a QgraphicsPixmapItem Object and associate to it a QPixmap.....so with some images, the bounding rect doesn't exist(it isn't rectangular but it follows the image shape.....)
aamer4yu
30th April 2008, 21:50
How do u know it is not rectangular ?
can we see the code ??
also are u using the shape() function ?
dreamer
30th April 2008, 22:21
I understand the problem.................
In my implementation i use the manhattanhlength to understand how near i am to a point.
Now, I calculate this distance, only and only if the item is selected and the mouse is moving over the item.....
Every Item has a rectangular bounding rect, so the problem isn't the bounding rect.
I find out that the mouse can be into a bounding rect without to be into an item......
if(item){
if(item->isSelected()){
/*Calculate the distance*/
dreamer
30th April 2008, 23:25
(:eek::eek:problem drawing the next image....:eek::eek:)
-------> -----------------
| |
| X |
| _______ |
| | | |
| | | |
| |______| |
| |
| |
|______________|
In this case, the mouseEvent->scenePos() is the X on the print.
The call itemAt(X) return 0, because no item is under the mouse cursor....
How can i do, to have the item returned by the function itemAt in this case???
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.