Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Qt 4.8 library project with QWidget?
Forum Update on Monday, May 27th 2025

[SOLVED] Qt 4.8 library project with QWidget?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 958 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    postb99
    wrote on 5 Feb 2014, 09:24 last edited by
    #1

    Hello,

    I was given some C++ code from another team and have to write a tutorial from it.
    They start with a C++ library project that contains Qt plugins implementations. I have troubles getting the following include to work:

    @#include <QWidgets>@

    I use MSVC 2010, Qt Creator 5.2.0, Qt 4.8.5. A Qt console app works.

    In my .pro file, adding the folllowing doesn't help resolving the include:

    @QT += widgets@

    or

    @QT += gui@

    or both.

    I've tested the following: create a library project and checking "QtWidgets" when asked which modules to include.

    Then it adds to .pro file "QT += widgets" as first try above.

    I strongly guess Qt Creator based itself on Qt5 modules names, since they're different in Qt 4.8 and 5. Because I've read here and there this code:

    @greaterThan(QT_MAJOR_VERSION, 4): QT += widgets@

    Thanks for pointers.

    Edited: I'd like to avoid:
    @#include <QtGui>@ as stated here: http://qt-project.org/doc/qt-4.8/mainwindows-dockwidgets.html
    because I undestood it means loading a lot of maybe unneeded libs.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      postb99
      wrote on 5 Feb 2014, 09:56 last edited by
      #2

      OK this thread helped me: http://qt-project.org/forums/viewthread/26070

      So it's working with:

      @QT += core gui@

      @#include <QWidget>@ without final "s"!!

      while for Qt5 you have to
      @QT += core gui widgets@

      @#include <QtWidgets>@ with additional "t" and "s"!

      Why did they change so many things that newbies easily get confused? ^^

      1 Reply Last reply
      0

      1/2

      5 Feb 2014, 09:24

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved