Results 1 to 6 of 6

Thread: Trouble passing an argument

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4 PyQt3 PyQt4
    Platforms
    Unix/X11

    Default Trouble passing an argument

    Hi I have been working on this all day and it has me beat.
    I want to pass the contents of a Qtextedit as a argument in a connect statement.

    I tryed this.

    Qt Code:
    1. self.connect(self.pb1a,SIGNAL("clicked()"),(lambda s=[str(self.cboxa.toPlainText())] : self._edit_(s)))
    2.  
    3. def _edit_(self,inptname):
    4. print inptname
    To copy to clipboard, switch view to plain text mode 

    But all I seem to get with this is a empty string, but if i do this it works.

    Qt Code:
    1. self.connect(self.pb1a,SIGNAL("clicked()"),self._edit_()))
    2.  
    3. def _edit_(self,inptname):
    4. print str(self.cboxa.toPlainText())
    To copy to clipboard, switch view to plain text mode 

    Just to make it even more confusing this works

    Qt Code:
    1. self.connect(self.pb1a,SIGNAL("clicked()"),(lambda s="this is a string"] : self._edit_(s)))
    2.  
    3. def _edit_(self,inptname):
    4. print inptname
    To copy to clipboard, switch view to plain text mode 

    So way can't i pass the text from the Qtextedit.

    What am I missing..???
    Last edited by benlyboy; 9th May 2010 at 16:20.

Similar Threads

  1. QMap as function argument...
    By cydside in forum Qt Programming
    Replies: 5
    Last Post: 18th April 2009, 17:59
  2. QtScript : passing array as argument into function
    By derek_r in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2007, 10:46
  3. Character from argument disappears
    By Pepe in forum Qt Programming
    Replies: 13
    Last Post: 19th June 2007, 23:48
  4. default argument compiler warning
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 27th March 2007, 14:57
  5. Warning QString::arg() argument missing
    By quickNitin in forum Newbie
    Replies: 9
    Last Post: 16th November 2006, 19:13

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
  •  
Qt is a trademark of The Qt Company.