Qt Creator: add Qt module to project

前端 未结 4 1384
轮回少年
轮回少年 2020-12-21 07:19

So when I create a new Qt project inside Qt Creator I\'m only asked for some simple details like location of the project, build targets, the main window class name (along wi

相关标签:
4条回答
  • 2020-12-21 07:46

    Edit your .pro file. It should has one line like this:

    QT += core gui
    

    Append the desired modules in this line. To get the module's names, just remove the "Qt" part in this list. (e.g. QtSql turns "sql")

    0 讨论(0)
  • 2020-12-21 07:46

    As others have pointed out, you simply #include the module you want in the source and add the name of the module in the .pro file to the QT variable.

    However the actual documentation you need which no one else has mentioned is the qmake Project Files page. qmake is very powerful and it's well worth getting familiar with how it works and I think that's why they don't provide a complete GUI for it, as it can handle some very complex scenarios.

    0 讨论(0)
  • 2020-12-21 07:58

    I can't find that either.

    It seems that in older versions of the "New project" wizard you used to be able to specify which modules you wanted to use, but even then you were not able to alter your choice later. And this seems gone now, so your only choice is to manually edit the .pro file.

    0 讨论(0)
  • 2020-12-21 08:02

    You have to read the documentation to add the modules.

    Frankly speaking, I never really felt like that there needs to be a GUI for that.

    0 讨论(0)
提交回复
热议问题