[PyQt] PyQt 4.6 QClipboard bug?

Phil Thompson phil at riverbankcomputing.com
Fri Oct 9 06:18:32 BST 2009


On Thu, 8 Oct 2009 21:11:45 -0400, Doug Bell <dougb at bellz.org> wrote:
> Hi,
> 
> In previous PyQt versions,  the QClipboard.text() method accepted a
> Python string as an argument:
> 
>    QtGui.QApplication.clipboard().text('xml')
> 
> With PyQt 4.6, this throws an exception:
> 
>    TypeError: argument 1 of QClipboard.text() has an invalid type
> 
> But it seems to work OK with a QString as an argument:
> 
>    QtGui.QApplication.clipboard().text(QtCore.QString('xml'))
> 
> Is this a bug in 4.6?

I'd call it a mis-guided bug fix. The method makes use of QString's
mutability, so allowing an ordinary (immutable) string appeared to be a
bug. However the string is only updated if passed an empty string, so your
usage (with hindsight) is perfectly reasonable.

Reverted in the next snapshot.

Phil


More information about the PyQt mailing list