Results 1 to 6 of 6

Thread: Image format without bounding rect

  1. #1
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Image format without bounding rect

    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.....

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Image format without bounding rect

    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 ?

  3. #3
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: Image format without bounding rect

    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.....)

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Image format without bounding rect

    How do u know it is not rectangular ?
    can we see the code ??

    also are u using the shape() function ?

  5. #5
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: Image format without bounding rect

    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......

    Qt Code:
    1. if(item){
    2. if(item->isSelected()){
    3. /*Calculate the distance*/
    To copy to clipboard, switch view to plain text mode 
    Last edited by dreamer; 30th April 2008 at 21:31. Reason: updated contents

  6. #6
    Join Date
    Feb 2008
    Posts
    102
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Re: Image format without bounding rect

    (problem drawing the next image....)


    -------> -----------------
    | |
    | 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???
    Last edited by dreamer; 30th April 2008 at 22:36.

Similar Threads

  1. QGraphicsSvgItem, problem with scaling (invalid bounding rect)
    By Józef Paczenko in forum Qt Programming
    Replies: 3
    Last Post: 8th June 2010, 08:58
  2. how to load a Qt non-supported Image format
    By Nithya in forum Qt Programming
    Replies: 5
    Last Post: 3rd April 2008, 12:57
  3. Some very weird compilation warnings
    By MarkoSan in forum Qt Programming
    Replies: 21
    Last Post: 23rd January 2008, 16:48
  4. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.