[PyQt] DeprecationWarning using TextAlignmentRole in a QStandardItem subclass
Sibylle Koczian
nulla.epistola at web.de
Sun Jan 19 12:21:14 GMT 2020
Am 19.01.2020 um 12:42 schrieb Phil Thompson:
> On 18/01/2020 12:15, Sibylle Koczian wrote:
>> If I execute the following script I get this warning:
>>
>> Warning (from warnings module):
>> File "D:\Sibylle\Src\PythonVersuche\PyQt\test_warning.py", line 77
>> app.exec_()
>> DeprecationWarning: an integer is required (got type Alignment).
>> Implicit conversion to integers using __int__ is deprecated, and may be
>> removed in a future version of Python.
>
> It should be fixed in tonight's PyQt snapshot.
>
> In the meantime if you want to avoid the warning then do as it suggests
> and make the conversion explicit, ie. change the 'return' statement to...
>
> return int(h_align | QtCore.Qt.AlignVCenter)
>
Thank you. Because the warning just contained the "app.exec_()" I didn't
understand that this was suggested.
Sibylle
More information about the PyQt
mailing list