Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links


Displaying an image with Qt

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-12-2009
Member
 
Join Date: Apr 2009
Posts: 87
Displaying an image with Qt

Sponsored Links
i am doing a project in QT, Can any one tell me how to make a images (.jpeg) using QT.... ,I cant find how to place a QLabel in the mainwindow thought Graphics View.

Thank you in advance

Reply With Quote
  #2  
Old 08-12-2009
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,278
Re: Displaying an image with Qt

Code:
QLabel * label_img = new QLabel (this);
 QPixmap * pic_img = new QPixmap ( "d1/d2/img.jpg");
	  label_img -> setPixmap (pixmap_img *);

 QGridLayout gridLayout * = new QGridLayout;
 gridLayout -> addWidget (label_img);
 setLayout (gridLayout);
Reply With Quote
  #3  
Old 08-12-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Displaying an image with Qt

Code:
#include ...

int main(int arg, char *arg[])
{
    QApplication a(arg, arg);
    QGraphicsScene scene;
    QGraphicsView view(&scene);
    QGraphicsPixmapItem item(QPixmap("d:\\image.png"));
    scene.addItem(&item);
    view.show();
    return b.exec();
}
Reply With Quote
  #4  
Old 08-12-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Displaying an image with Qt

Code:
QWidget * widget = new QWidget;
 QLabel * label = new QLabel;
 QPixmap * pic_img = new QPixmap ( "1.jpg");
 / / 1 is in the directory that contains exe

 label -> setPixmap (pic_img *);

 QGridLayout gridLayout * = new QGridLayout (widget);
 gridLayout -> addWidget (label, 0, 0);
 setLayout (gridLayout);    

 widget -> show ();
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Displaying an image with Qt"
Thread Thread Starter Forum Replies Last Post
Showing grey image instead of the Google TV in full screen and not getting image while setting up my TV source in New Logitech Revue Diedrick Technology & Internet 7 15-02-2012 04:29 AM
problem with displaying image ibiangalex Software Development 1 27-10-2010 03:31 AM
Nokia 6303, problem displaying image(s) Ganaka Portable Devices 4 19-04-2010 10:28 AM
Displaying an image and text in a JSP samualres Software Development 7 20-03-2010 10:43 AM
Displaying an Image In a JSP With a Access database Henryosa Software Development 5 12-03-2010 02:52 PM


All times are GMT +5.5. The time now is 05:01 AM.