Results 1 to 6 of 6

Thread: QPixMap doesn't show one of two images !

  1. #1
    Join Date
    Aug 2010
    Location
    Chennai
    Posts
    21
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPixMap doesn't show one of two images !

    ( Lang : Python 3.1 )
    I have implemented two QPixmap widgets and intended to show images via them.
    The first one shows the input image the user has chosen & the second one will show the output file of an image processing tool . You will understand easily if u see the code :
    Qt Code:
    1. #First image - Input selected through a file dialog ( self.input is filename )
    2. self.item1=QtGui.QGraphicsPixmapItem(QtGui.QPixmap(self.input))
    3. self.scene1.addItem(self.item1)
    4. self.view1.show()
    5. #The processing Tool - a commandline utility
    6. subprocess.Popen(self.com,shell=True)
    7. #Second Image- Output After processing ( I get filename-self.output from LineEdit )
    8. self.item2=QtGui.QGraphicsPixmapItem(QtGui.QPixmap(self.output))
    9. self.scene2.addItem(self.item2)
    10. self.view2.show()
    To copy to clipboard, switch view to plain text mode 

    Problem:
    First Image Shows without any problem .
    Output image never shows . But it is generated by the processing tool as usual.

    Plz , help me . I can't figure it out

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPixMap doesn't show one of two images !

    What happens between lines 6 and 8? Do you allow the external tool to finish its job before trying to show the other pixmap? If not then simply the output pixmap is not there at the time Qt tries to show it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    ladiesfinger (10th January 2011)

  4. #3
    Join Date
    Aug 2010
    Location
    Chennai
    Posts
    21
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixMap doesn't show one of two images !

    For that case , i tried to use Timer to delay some 30 secs . But i can't . The inserted lines :
    Qt Code:
    1. t=Timer(30.0)
    2. t.start()
    To copy to clipboard, switch view to plain text mode 
    It gives error as :
    Qt Code:
    1. Traceback (most recent call last):
    2. File "gui.py", line 138, in processimg
    3. t=Timer(30.0)
    4. NameError: global name 'Timer' is not defined
    To copy to clipboard, switch view to plain text mode 

    Can you show me the right way to use Timer ? Or any other idea ?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPixMap doesn't show one of two images !

    Use QProcess to govern your subprocess. It has a finished() signal. Connect to that signal and run lines #8-9 of your original snippet after the method is triggered by the signal.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    ladiesfinger (10th January 2011)

  7. #5
    Join Date
    Aug 2010
    Location
    Chennai
    Posts
    21
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixMap doesn't show one of two images !

    I had it running . But through Timer .
    All i had to do is "import timeit " and run . ( I encountered some fearful errors in QProcess )
    Thank you Wysota....

  8. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPixMap doesn't show one of two images !

    What if it takes longer for the subprocess to finish its task?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 22nd March 2010, 08:54
  2. grabbed QPixmap doesn't look right on XP
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2009, 08:28
  3. Can't click menubar items / QPixMap doesn't show
    By richardander in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2008, 10:45
  4. Show QPixmap into QMenuBar
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2008, 11:03
  5. [QT3] QToolTip with Images (QPixMap) ?
    By BrainB0ne in forum Qt Programming
    Replies: 4
    Last Post: 27th January 2006, 08:31

Tags for this Thread

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.