Results 1 to 2 of 2

Thread: Insert Picture

  1. #1

    Default Re: Insert Picture

    I want to insert a photo into a label on QT

    Qt Code:
    1. QPixmap pix("C:\Users\haral\OneDrive\Documents\NY\Nyeveier.jpg");
    2. ui->label_Pic->setPixmap(pix.scaled(100,100,Qt::KeepAspectRatio));
    To copy to clipboard, switch view to plain text mode 
    I use this code
    but get an error U used with no following hex digtis in line 1


    Added after 5 minutes:


    Quote Originally Posted by Johnsen View Post
    I want to insert a photo into a label on QT

    Qt Code:
    1. QPixmap pix("C:\Users\haral\OneDrive\Documents\NY\Nyeveier.jpg");
    2. ui->label_Pic->setPixmap(pix.scaled(100,100,Qt::KeepAspectRatio));
    To copy to clipboard, switch view to plain text mode 
    I use this code
    but get an error U used with no following hex digtis in line 1
    I found a solution to the error, but image will not appear.
    Last edited by Johnsen; 5th March 2019 at 11:56.

  2. #2
    Join Date
    Jul 2008
    Posts
    386
    Thanks
    9
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Insert Picture

    Hi, in C/C++ you need to escape backslashes (or use a forward slash /).

    Ginsengelf

Similar Threads

  1. Replies: 1
    Last Post: 15th March 2014, 12:15
  2. Insert picture into MS Word Document
    By UndeadDragon in forum Newbie
    Replies: 4
    Last Post: 4th November 2012, 11:54
  3. Insert picture in a form using label
    By cwnelatury in forum Newbie
    Replies: 14
    Last Post: 19th March 2010, 00:43
  4. Replies: 4
    Last Post: 13th January 2010, 18:05
  5. How to insert an animated picture (GIF) in a QLabel
    By AngiSad in forum Qt Programming
    Replies: 1
    Last Post: 13th January 2010, 17:31

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.