Results 1 to 6 of 6

Thread: open a picture for editing

  1. #1
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post open a picture for editing

    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.

  2. #2
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post update(using Qt 4.4.3,Linux)

    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)

    Qt Code:
    1. void ImageViewer::edit()
    2. {
    3. QProcess *proc;
    4. proc=new QProcess(this);
    5. proc->start("./gthumb");
    6. }
    To copy to clipboard, switch view to plain text mode 

    please advice.
    Last edited by rishiraj; 27th January 2009 at 07:12. Reason: missing [code] tags

  3. #3
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post :) got the expected result

    Hi,
    got the code to work and am getting desired result.Was pretty simple
    Am pasting the working code below.
    Qt Code:
    1. void ImageViewer::edit() //added by avishek
    2. {
    3. QProcess *proc;
    4. proc=new QProcess(this);
    5. QStringList arguments;
    6. arguments<<fileName; //fileName is the path to the pic which is to be opened
    7. //for editing(displayed on a QLabel)
    8. proc->start("./gthumb",arguments); //./gthumb--> the graphics program I am
    9. //using to edit the pic
    10. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: open a picture for editing

    Here's a minor improvement for you:
    Qt Code:
    1. connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));
    To copy to clipboard, switch view to plain text mode 
    There is no need to keep the QProcess instance in memory once the process has finished, right?
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    rishiraj (27th January 2009)

  6. #5
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Smile Re: open a picture for editing

    yup,you are right.Thanks

  7. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: open a picture for editing

    Here's a minor improvement for you:
    Qt Code:
    1. connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), proc, SLOT(deleteLater()));
    To copy to clipboard, switch view to plain text mode 
    There is no need to keep the QProcess instance in memory once the process has finished, right?
    J-P Nurmi

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.