Results 1 to 2 of 2

Thread: How to draw bitmap from external file on the form?

  1. #1
    Join Date
    Feb 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default How to draw bitmap from external file on the form?

    I am using QT Creator 3.5.0 on Ubuntu 15.10. I have one form (mainwindow.ui) and I draw one GraphicView object (QGraphicsView) and one button (QPushButton). Signal on_pushButton_clicked() is created.

    How to draw image from external file (BMP/ JPG/ PNG) on GraphicView object (that already exists) on the specific coordinates inside GraphicView object (x, y) when I click on the QPushButton?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,366
    Thanks
    36
    Thanked 1,537 Times in 1,488 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to draw bitmap from external file on the form?

    Create a QPixmap object, let it load the file, put it into a new QGraphicsPixmapItem, put that into the view's scene, move it to the position you want it to be.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 2nd November 2015, 11:20
  2. free hand draw in qgraphicsview
    By wagmare in forum Newbie
    Replies: 0
    Last Post: 22nd November 2013, 06:02
  3. Replies: 6
    Last Post: 20th January 2011, 01:47
  4. Qt form to bitmap image .. How to
    By Ratheendrans in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2010, 13:22
  5. Bitmap Memory location to read and draw in Qt
    By augusbas in forum Qt Programming
    Replies: 1
    Last Post: 2nd September 2010, 21:21

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.