[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Creating a QUrl out of a string
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2017-05-05 5:23:00
Message-ID: 20170505052300.abeira2rxob4azzz () hooch ! localdomain
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wed, May 03, 2017 at 04:18:27PM -0400, Christopher Probst wrote:
> Hi,
> 
> Sorry for the newbie question. I am trying to create a QUrl out of a
> string. The sample code is here:
> 
> string = QInputDialog.getText(self, "Download URL", "Enter URL to download")
> url = QUrl( str(string) )
> print ("the url is ", url)
> 
> the output gives me
> the url is  PyQt5.QtCore.QUrl('')
> 
> What am I doing wrong?

Hard to say without knowing what you're entering, but you're probably
entering an invalid URL (like example.com instead of
http://example.com).

You might want QUrl.fromUserInput instead:
http://doc.qt.io/qt-5/qurl.html#fromUserInput

Florian

-- 
https://www.qutebrowser.org  | me@the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/

["signature.asc" (application/pgp-signature)]
[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic