PDA

View Full Version : open a picture for editing



rishiraj
27th January 2009, 05:01
Hi,
I need to implement this-
When I click on the 'Edit photo' button,the photo currently displayed on top of QLabel 'Picture' is opened for editing in 'KolourPaint' (a paint application in Linux).I believe I will have to use 'QProcess' for it.Could someone please give me some idea of how to write the code?
Thanks in advance.

rishiraj
27th January 2009, 07:06
I got the image viewer to open(using 'gthumb Image Viewer) but now,the question is 'How do I get the 'pic' on top of the QLabel to be displayed by default when the editor opens.' I can't think of how to proceed.

The code till now is as follows.(I copied the gthumb exe in the folder which contains my .cpp,.h and .pro files for the Qt program)



void ImageViewer::edit()
{
QProcess *proc;
proc=new QProcess(this);
proc->start("./gthumb");
}


please advice.

rishiraj
27th January 2009, 09:13
Hi,
got the code to work and am getting desired result.Was pretty simple :o
Am pasting the working code below.


void ImageViewer::edit() //added by avishek
{
QProcess *proc;
proc=new QProcess(this);
QStringList arguments;
arguments<<fileName; //fileName is the path to the pic which is to be opened
//for editing(displayed on a QLabel)
proc->start("./gthumb",arguments); //./gthumb--> the graphics program I am
//using to edit the pic
}

jpn
27th January 2009, 10:55
Here's a minor improvement for you:


connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));

There is no need to keep the QProcess instance in memory once the process has finished, right?

rishiraj
27th January 2009, 11:09
yup,you are right.Thanks :)

jpn
27th January 2009, 11:22
Here's a minor improvement for you:


connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));

There is no need to keep the QProcess instance in memory once the process has finished, right?