How to Enable Python Type Hints in Qt Creator?
-
Hi everyone,
I’m new to developing applications with Qt and I’d like to use Python (via PyQt/PySide) inside Qt Creator. My main issue is that Qt Creator doesn’t show me any type hints or autocomplete for Python code.
Could anyone walk me through the steps required to set up proper type‑hint support in Qt Creator? Any tips on configuring the IDE, installing the necessary plugins, or adjusting project settings would be greatly appreciated.
Thanks in advance!
-
Hi everyone,
I’m new to developing applications with Qt and I’d like to use Python (via PyQt/PySide) inside Qt Creator. My main issue is that Qt Creator doesn’t show me any type hints or autocomplete for Python code.
Could anyone walk me through the steps required to set up proper type‑hint support in Qt Creator? Any tips on configuring the IDE, installing the necessary plugins, or adjusting project settings would be greatly appreciated.
Thanks in advance!
@MariX
I wait to see whether anyone can tell you this. My understanding (from when I used Creator + Python/PySide) was that it did not. But I could be mistaken. Otherwise I think you might read through IDE for PyQt/PySide in Reddit's r/QtFramework from a couple of years ago. I used PyCharm for a more pleasurable developing/debugging experience, and Creator/Designer just for.uifiles.UPDATE: For anybody reading this. Per @cristian-adam's posts and pictures below, the reddit posts from only two years ago and my own experience with trying to use Creator with Python several years back notwithstanding, it does appear that Creator has done a lot more work integrating with PySide/Python than in my time! So it would only be fair to give Creator/Python a go now without necessarily moving to PyCharm.
-
Hi everyone,
I’m new to developing applications with Qt and I’d like to use Python (via PyQt/PySide) inside Qt Creator. My main issue is that Qt Creator doesn’t show me any type hints or autocomplete for Python code.
Could anyone walk me through the steps required to set up proper type‑hint support in Qt Creator? Any tips on configuring the IDE, installing the necessary plugins, or adjusting project settings would be greatly appreciated.
Thanks in advance!
@MariX Is the screenshot below the thing that you wanted?

In oder to achieve this I've:
-
Went to Preferences > Python where I clicked on Python 3.13.12 then on the right the buttons: Make Default and then Generate Kit.
-
New Project and then in Application (Qt for Python) selected Empty Application
-
Pasted the content provided by gpt-oss with the prompt create a pyside6 application that has a window with a label "Hello 🐍" with a text size 18.
After step 2 I've been asked by Qt Creator if I want to install Pyside6 and clicked yes, and it did its magic.
I have little knowledge about Python, but it seems like code completion works.
Here are the Python LSP settings:

The debugging helpers are not that ... helpful:

-
-
@MariX Is the screenshot below the thing that you wanted?

In oder to achieve this I've:
-
Went to Preferences > Python where I clicked on Python 3.13.12 then on the right the buttons: Make Default and then Generate Kit.
-
New Project and then in Application (Qt for Python) selected Empty Application
-
Pasted the content provided by gpt-oss with the prompt create a pyside6 application that has a window with a label "Hello 🐍" with a text size 18.
After step 2 I've been asked by Qt Creator if I want to install Pyside6 and clicked yes, and it did its magic.
I have little knowledge about Python, but it seems like code completion works.
Here are the Python LSP settings:

The debugging helpers are not that ... helpful:

@cristian-adam
Hi Christian. Since my time it seems that you are showing Python autocompletion, which is a start. But the OP asked for "type hints", a couple of times. Your screenshot shows nothing about that. Does it offer that? E.g. after you selectsetAlignmentfrom the dropdown do you get any type hints (parameter type), like you would for C++? -
-
@MariX Is the screenshot below the thing that you wanted?

In oder to achieve this I've:
-
Went to Preferences > Python where I clicked on Python 3.13.12 then on the right the buttons: Make Default and then Generate Kit.
-
New Project and then in Application (Qt for Python) selected Empty Application
-
Pasted the content provided by gpt-oss with the prompt create a pyside6 application that has a window with a label "Hello 🐍" with a text size 18.
After step 2 I've been asked by Qt Creator if I want to install Pyside6 and clicked yes, and it did its magic.
I have little knowledge about Python, but it seems like code completion works.
Here are the Python LSP settings:

The debugging helpers are not that ... helpful:

After re-opening the project Qt Creator asked me if I want to configure the LSP with type hints.

The code completion looks different now.
-
-
After re-opening the project Qt Creator asked me if I want to configure the LSP with type hints.

The code completion looks different now.
@cristian-adam
It looks like your latest post crossed with mine! That again is an improvement to show the parameters, good. But still no type hint (the type expected for theonparameter), is that supported? :) And I don't know whether all the Qt calls are annotated in the PySide with their types, that may require a manual step? -
After re-opening the project Qt Creator asked me if I want to configure the LSP with type hints.

The code completion looks different now.
Then
F2onsetAlignmentjumped to a file that has some declarations:
Equivalent to jumping to a header file in C++.
-
Then
F2onsetAlignmentjumped to a file that has some declarations:
Equivalent to jumping to a header file in C++.
@cristian-adam Yep, getting better :)
-
-
@cristian-adam
It looks like your latest post crossed with mine! That again is an improvement to show the parameters, good. But still no type hint (the type expected for theonparameter), is that supported? :) And I don't know whether all the Qt calls are annotated in the PySide with their types, that may require a manual step?@JonB said in How to Enable Python Type Hints in Qt Creator?:
@cristian-adam
It looks like your latest post crossed with mine! That again is an improvement to show the parameters, good. But still no type hint (the type expected for theonparameter), is that supported? :) And I don't know whether all the Qt calls are annotated in the PySide with their types, that may require a manual step?
It did mention that
onis abool, was that it? -
@JonB said in How to Enable Python Type Hints in Qt Creator?:
@cristian-adam
It looks like your latest post crossed with mine! That again is an improvement to show the parameters, good. But still no type hint (the type expected for theonparameter), is that supported? :) And I don't know whether all the Qt calls are annotated in the PySide with their types, that may require a manual step?
It did mention that
onis abool, was that it?@cristian-adam said in How to Enable Python Type Hints in Qt Creator?:
It did mention that
onis abool, was that it?That is indeed the chappie :) It also shows the function call returns
None, which is a type hint too.Python decided not to have types initially. Then someone came to their senses and said "well we don't want mandatory types, but if you are finicky enough to want to type in types as hints we will let you do that". And then presumably someone said "these are really useful when editing, so we'll introduce warnings when they're wrong and editors can show them if they help people". :)
-
@cristian-adam said in How to Enable Python Type Hints in Qt Creator?:
I've opened up QTCREATORBUG-34195: Python debugging not having pretty printers for Pyside6 Qt types.
And as workaround for the missing debugger, is the
qDebug()trace:from PySide6.QtCore import Qt, qDebug # ... qDebug("Label text: " + label.text()) -
@cristian-adam said in How to Enable Python Type Hints in Qt Creator?:
I've opened up QTCREATORBUG-34195: Python debugging not having pretty printers for Pyside6 Qt types.
And as workaround for the missing debugger, is the
qDebug()trace:from PySide6.QtCore import Qt, qDebug # ... qDebug("Label text: " + label.text())@cristian-adam
Alternatively as a workaround and still using the debugger panes rather than putting in aqDebug()statement, did you try puttinglabel.text()into the bottom right Expressions pane? -
@cristian-adam
Alternatively as a workaround and still using the debugger panes rather than putting in aqDebug()statement, did you try puttinglabel.text()into the bottom right Expressions pane?@JonB said in How to Enable Python Type Hints in Qt Creator?:
@cristian-adam
Alternatively as a workaround and still using the debugger panes rather than putting in aqDebug()statement, did you try puttinglabel.text()into the bottom right Expressions pane?
Worked. I didn't give me
Hello 🐍butHello =\dbut I guess that's due to the missing UTF-8 encoding. -
I didn't notice you were printing a duck/swan thing, wth is that? :)
Since (unlike C++) you can put pretty much any Python expression into Expressions, you might get it with something like
label.text().encode('utf-8'), orlabel.text().decode('utf-8')if it's decoding rather than encoding, don't ask me about encodings!). In both PyQt and PySide allQStrings are translated into Pythonstrs, which are those 16-bit encoding thingies.Just while we are here, I would give a limb if gdb/C++ Creator debugging would allow expressions to be evaluated in the Expressions pane. I understand the issue with C++ versus Python for expression evaluation, but it's the single most irritating thing when debugging C++.... :(
-
I didn't notice you were printing a duck/swan thing, wth is that? :)
Since (unlike C++) you can put pretty much any Python expression into Expressions, you might get it with something like
label.text().encode('utf-8'), orlabel.text().decode('utf-8')if it's decoding rather than encoding, don't ask me about encodings!). In both PyQt and PySide allQStrings are translated into Pythonstrs, which are those 16-bit encoding thingies.Just while we are here, I would give a limb if gdb/C++ Creator debugging would allow expressions to be evaluated in the Expressions pane. I understand the issue with C++ versus Python for expression evaluation, but it's the single most irritating thing when debugging C++.... :(
@JonB said in How to Enable Python Type Hints in Qt Creator?:
I didn't notice you were printing a duck/swan thing, wth is that? :)
-
I didn't notice you were printing a duck/swan thing, wth is that? :)
Since (unlike C++) you can put pretty much any Python expression into Expressions, you might get it with something like
label.text().encode('utf-8'), orlabel.text().decode('utf-8')if it's decoding rather than encoding, don't ask me about encodings!). In both PyQt and PySide allQStrings are translated into Pythonstrs, which are those 16-bit encoding thingies.Just while we are here, I would give a limb if gdb/C++ Creator debugging would allow expressions to be evaluated in the Expressions pane. I understand the issue with C++ versus Python for expression evaluation, but it's the single most irritating thing when debugging C++.... :(
@JonB said in How to Enable Python Type Hints in Qt Creator?:
Since (unlike C++) you can put pretty much any Python expression into Expressions, you might get it with something like
label.text().encode('utf-8'), orlabel.text().decode('utf-8')if it's decoding rather than encoding, don't ask me about encodings!). In both PyQt and PySide allQStrings are translated into Pythonstrs, which are those 16-bit encoding thingies.label.text().decode('utf-8')results in<unavailable>.🤷🏻♂️
-
@JonB said in How to Enable Python Type Hints in Qt Creator?:
Since (unlike C++) you can put pretty much any Python expression into Expressions, you might get it with something like
label.text().encode('utf-8'), orlabel.text().decode('utf-8')if it's decoding rather than encoding, don't ask me about encodings!). In both PyQt and PySide allQStrings are translated into Pythonstrs, which are those 16-bit encoding thingies.label.text().decode('utf-8')results in<unavailable>.🤷🏻♂️
@cristian-adam
encodeworks on strings,strorQString.decodeworks on bytes,bytesorQByteArray. That may explain<unavailable>ontext().decode(). I told you I didn't understand :) If you had stuck toHello world!we wouldn't be having this discussion ;-)