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

List:       pykde
Subject:    Re: Qt6: QUrl and UrlFormattingOption vs. ComponentFormattingOption
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2021-11-29 12:37:59
Message-ID: a9e7e4fe8b683475572daebad8410301 () riverbankcomputing ! com
[Download RAW message or body]

On 28/11/2021 16:21, Florian Bruhin wrote:
> Hi again,
> 
> On Thu, Aug 26, 2021 at 05:19:57PM +0100, Phil Thompson wrote:
> > 
> > On 26/08/2021 16:34, Florian Bruhin wrote:
> > > Hi,
> > > 
> > > Qt's QUrl.toString() (and other methods taking QUrl.UrlFormattingOption)
> > > are a bit weird, because they *also* can take
> > > QUrl.ComponentFormattingOption:
> > > https://doc.qt.io/qt-6/qurl.html#UrlFormattingOption-enum
> > > 
> > > However, combining the two doesn't seem to be possible anymore with
> > > PyQt6:
> > > 
> > > > > > from PyQt6.QtCore import QUrl
> > > > > > > > QUrl("https://example.org").toString(QUrl.UrlFormattingOption.RemovePassword > \
> > > > > > > > > | QUrl.ComponentFormattingOption.FullyEncoded)
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > TypeError: unsupported operand type(s) for |:
> > > 'UrlFormattingOption' and 'ComponentFormattingOption'
> > > 
> > > and converting won't work either:
> > > 
> > > > > > > > QUrl("https://example.org").toString(QUrl.UrlFormattingOption.RemovePassword
> > > > 
> > > QUrl.UrlFormattingOption(QUrl.ComponentFormattingOption.FullyEncoded))
> > > ValueError: <ComponentFormattingOption.FullyEncoded: 32505856> is
> > > not a valid QUrl.UrlFormattingOption
> > > 
> > > Florian
> > 
> > Fixed in the next PyQt6 snapshot.
> 
> After looking at this again I found another related issue: While
> combining the two now works as expected, only passing a
> ComponentFormattingOption fails, while working as expected with PyQt5:
> 
> $ python3 -c "from PyQt5.QtCore import QUrl; u =
> QUrl('https://example.org/');
> print(u.toString(QUrl.ComponentFormattingOption.PrettyDecoded))"
> 
> $ python3 -c "from PyQt6.QtCore import QUrl; u =
> QUrl('https://example.org/');
> print(u.toString(QUrl.ComponentFormattingOption.PrettyDecoded))"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> TypeError: toString(self, options: QUrl.UrlFormattingOption =
> QUrl.FormattingOptions(QUrl.PrettyDecoded)): argument 1 has unexpected
> type 'ComponentFormattingOption'
> 
> Florian

Hopefully fixed in the next snapshot.

Thanks,
Phil


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

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