Results 1 to 4 of 4

Thread: Drawing a border around an image.

  1. #1
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Question Drawing a border around an image.

    I am looking to write a function which can be called into main which will draw a border around my image and then allow me to save this image to open later. I have all the code for saving and opening the image, i am however new to this and have no idea where to start with the function to draw the border.

    I am also required to invert the image under the same circumstances, and by this i mean change all the 1 values to a 0 and vice versa.

    Any help would be much appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a border around an image.

    Create a QPainter that works on the image and call its draw methods.

    Cheers,
    _

  3. #3
    Join Date
    Apr 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Drawing a border around an image.

    Thanks for the reply but i have no idea how to go about doing this.. would you be able to point me in the right direction?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Drawing a border around an image.

    Reading the Qt QPainter and QImage documentation and studying the examples would be a good place to start.

Similar Threads

  1. Replies: 1
    Last Post: 23rd March 2015, 08:54
  2. Replies: 4
    Last Post: 15th May 2013, 13:58
  3. StyleSheets: border-image performance
    By GuS in forum Qt Programming
    Replies: 3
    Last Post: 15th May 2013, 12:42
  4. About Border-image
    By Wong in forum Qt Programming
    Replies: 4
    Last Post: 29th March 2013, 13:04
  5. Border-image not working in QWidget?
    By astampor in forum Qt Programming
    Replies: 4
    Last Post: 3rd October 2011, 15:16

Tags for this Thread

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.