Results 1 to 5 of 5

Thread: QProcess - quotes and spaces in parameters under Linux

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Question QProcess - quotes and spaces in parameters under Linux

    I'm trying to use ImageMagick with QProcess under Linux. The arguments are quite complicated, the whole command needed is for example:
    Qt Code:
    1. convert /tmp/temporaryPicture20.png -matte -virtual-pixel transparent -define distort:viewport=1105x3241+4572829+2684426 -distort Perspective '592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666 ' +repage /tmp/temporaryPicture20_out.png
    To copy to clipboard, switch view to plain text mode 
    Documentation suggests that such parameters may be tricky in Windows and Unix is piece of cake, but still I don't get how to use QProcess. What i tried was:
    a) puttin the whole command in QString and passing it to QProcess::start(QString) (without separate arguments)
    Qt Code:
    1. QString command = "convert";
    2. args
    3. <<"/tmp/mapin.png"
    4. <<"-matte"
    5. <<"-virtual-pixel"
    6. <<"transparent"
    7. <<"-define"
    8. <<"distort:viewport=1105x3241+4572829+2684426"
    9. <<"-distort"
    10. <<"Perspective"
    11. <<"'592,154 4572830,2684542 1408,54 4573934,2684426 654,2432 4572942,2687666'"
    12. <<"+repage"
    13. <<"/tmp/mapout.png";
    14. iProcess->start(command,args);
    To copy to clipboard, switch view to plain text mode 
    and some variations of b) (escaping spaces "\ ", escaping single quotes "\'", using double quotes instead of single ones and some other. In all cases finished(int,status) signal is emited with arguments 0,1 (1 is bad, right?), the output image is produced but not distorted according to -distort Perspective '(...)' , so (probably) some arguments are passed correctly, but this one is ignored as faulty.

    How do i pass it correctly?
    Last edited by mateuszzz88; 3rd July 2011 at 22:55. Reason: spelling corrections pointed out by SixDegrees

Similar Threads

  1. Replies: 8
    Last Post: 28th January 2015, 10:45
  2. qmake LIBS missing quotes
    By redoctober0 in forum General Programming
    Replies: 1
    Last Post: 12th January 2011, 17:05
  3. QSqlQuery and single quotes using bindValue
    By Luc4 in forum Qt Programming
    Replies: 4
    Last Post: 27th September 2010, 00:34
  4. Replies: 5
    Last Post: 4th February 2010, 00:50
  5. Replies: 1
    Last Post: 7th April 2008, 16:12

Tags for this Thread


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.