Qt World Summit: Submit your Presentation

QtCreator shows fixed white background behind identifiers in python

  • Hi everyone!

    I have a problem that's been bothering me in QtCreator for a while. I thought it might be just insufficient python support in the old version I used to use but now I upgraded (to 4.5.2 with Ubuntu 18.04) and it's still there. As you can see on the screenshot below, code outside of the current scope has a darker grey background, but not for identifiers (vars, funcs etc.), those stay white. This happens only for python, other languages I sometimes touch (C++, JS, HTML) are fine.

    I went through my Editor settings and checked if I have the background colour hard-coded in any of the settings, but it doesn't seem like I do. Checked on the internet, no results. Anybody would know? Thanks!


    Note: might be related, but maybe not, python is also "special" in that it doesn't quite "work" like other languages in QtCreator for me, besides the syntax and scope highlighting I don't have any features - no errors/warning by the editor, no "follow symbol" functionality, no matching bracket highlighting, etc...

  • Moderators

    hi @karel_l and welcome

    you should consider upgrading again, the current latest release of QtCreator is 4.10.2

    I believe, the official Qt for Python support was added after 4.5, so you should see significant changes, when you use the latest one.

  • Lifetime Qt Champion

    Hi @karel_l,

    as @j.hilk said, you should update. 4.11 is around the corner, and Python support is gradually improving.


  • Wait: Qt Creator (which I don't use) is now tackling Python syntax?! What about Python debugging??

  • Moderators

    @JonB said in QtCreator shows fixed white background behind identifiers in python:

    What about Python debugging

    Is there such a thing?

    As far as I know, you can add (in QtC) the "-m trace —trace" as argument to the python call

  • @J-Hilk
    Don't know if you're being serious? PyCharm, which I used before, and VSCode Python, which I use now, have full interactive debugging in the IDEs, just like Qt Creator does for C++/gdb etc.

    I'm talking about for developing Qt stuff via PySide2 & Python, in case there's any misunderstanding.

    Python is bad enough as it is. You (I) certainly want full-featured visual debugging as for C++...!

  • Moderators

    @JonB You have to excuse me, but my contact with python is limited to a horrible time during university and a (somewhat) working environment on my Mac to test stuff.

    Never bothered with actual debugging.

    But hitting the debug run in QtCreator actually starts a Python debugger and holds on the first line, with information etc.


  • @J-Hilk
    Of course I excuse you, I genuinely didn't know if you were messing about in your reply like I do :)

    Then it does look like Creator has debugging support, as well as syntax. That's all new to me.

    Hmmm. Because Creator didn't do Python a while back (probably pre PySide2), I had to do all work in PyCharm, and now for new project VSCode Python. These are good for editing & debugging, but if you want to use the Qt Designer for the UI you have to do pyuic step separately, not integrated. Which is a pain.

    From Creator it would all be integrated. Unfortunately I don't think its support for Python editing/debugging will be good enough yet for me/this project, but it's interesting to know it's heading that way...

  • Beautiful, not everything is perfect (bracket highlighting, symbol following, etc.) but the highlighting is functional now, as well as code completion, thanks a lot! And as a bonus I now have also much better support of JavaScript, yay! :)

Log in to reply