I've installed QtCreator 5.2.1 in Ubuntu and am trying to build and run an existing project that a coworker is working on. When I try to build the .pro file I receive an error "QGroupBox: No such file or directory.". I know this probably has something to do with the proper header files not being found (specifically QGroupBox.h) but am unsure how to remedy this. I've found the proper header files, so they exist on my system I just can't figure out how to get the IDE to acknowledge them. I'll also admit that I'm new to Linux so please bear with me...
问问题
302 次
1 回答
1
您需要正确获取小部件模块,如下所示:
QT += widgets
如果您希望 Qt 5 和 Qt 4 也支持您的应用程序,则需要使用以下内容:
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
但是,如果您选择一个基于 Widgets 的应用程序,它应该已经在项目文件中为您添加了它。请仔细检查。
默认情况下,该QT
变量仅包含core
和gui
。在这种情况下,这对 Qt 4 来说很好,因为小部件被 QtGui 覆盖。但是,这在 Qt 5 中发生了变化,因此您通常可以从它们单独的小部件模块中获取此类和小部件。
您可以在此处阅读更多内容。
于 2014-05-19T17:39:23.690 回答