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]qmake does not write QT += widgets to *.pro file
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]qmake does not write QT += widgets to *.pro file

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 3.3k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    frost
    wrote on last edited by
    #1

    Hi, every one.
    I am new to Qt, and I find it fansinating to write Qt applications. Here is the question.
    @qmake -project@ and generates sample.pro, but there's no
    @QT += widgets@ and I have to add it to the .pro file. How can I make it generate this line automatically?

    thank you all.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MrMNight
      wrote on last edited by
      #2

      there is what I found in qmake help:
      @
      Mode:
      -project
      Put qmake into project file generation mode
      In this mode qmake interprets files as files to
      be built,
      defaults to *; *; *; *.ts; *.xlf; *.qrc
      Note: The created .pro file probably will
      need to be edited. For example add the QT variable to
      specify what modules are required.
      @

      so I think there is no built-in way to generate QT variable automatically

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        qmake can't to that for you because it doesn't know that you are going to use widgets in your project (Qt Creator can because you tell it so)

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MarianMMX
          wrote on last edited by
          #4

          echo QT += widgets>>sample.pro

          1 Reply Last reply
          0
          • F Offline
            F Offline
            frost
            wrote on last edited by
            #5

            thanks, maybe I should edit it maunally.
            [quote author="MrMNight" date="1395825165"]there is what I found in qmake help:
            @
            Mode:
            -project
            Put qmake into project file generation mode
            In this mode qmake interprets files as files to
            be built,
            defaults to *; *; *; *.ts; *.xlf; *.qrc
            Note: The created .pro file probably will
            need to be edited. For example add the QT variable to
            specify what modules are required.
            @

            so I think there is no built-in way to generate QT variable automatically[/quote]

            1 Reply Last reply
            0
            • F Offline
              F Offline
              frost
              wrote on last edited by
              #6

              Then is there any chance I can tell qmake that I am gonna use widgets? Perhaps it is an option or something. Accurally I am trying the samples in C++ GUI programming with Qt4, 2nd Edition. The earlier samples are written in plain text editors.
              [quote author="SGaist" date="1395871610"]Hi and welcome to devnet,

              qmake can't to that for you because it doesn't know that you are going to use widgets in your project (Qt Creator can because you tell it so)[/quote]

              1 Reply Last reply
              0
              • F Offline
                F Offline
                frost
                wrote on last edited by
                #7

                I wonder maybe I can modify the source file but leave the modified .pro file alone, and qmake sample.pro directely. I will give a shot.
                [quote author="MarianMMX" date="1395871982"]echo QT += widgets>>sample.pro[/quote]

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Currently no, there's not.

                  In Qt 4 the widgets where in the gui module which is one of the default module. That's why the generated pro file was enough.

                  However there's nothing wrong modifying the pro file by hand. qmake -project is generally called once to start using Qt with an existing code base then the file is modified to suite the needs of the project e.g. OpenGL, Sql, other libraries/frameworks you want to use.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

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