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. adding new class in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

adding new class in Qt Creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 492 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.
  • H Offline
    H Offline
    herrgross
    wrote on last edited by
    #1

    Hi everyone,
    as quite a newbee I feel especially stupid now:
    wanting to work with QSerialPort I find that Qt Creator does not know it. When I try to #include, I get "file not found".
    Searching the web did not lead me to a solution.
    Can anybody help me on how to include that module into my setup?
    Thank you
    Michael

    Sebastiano ZamberlanS 1 Reply Last reply
    0
    • H herrgross

      Hi everyone,
      as quite a newbee I feel especially stupid now:
      wanting to work with QSerialPort I find that Qt Creator does not know it. When I try to #include, I get "file not found".
      Searching the web did not lead me to a solution.
      Can anybody help me on how to include that module into my setup?
      Thank you
      Michael

      Sebastiano ZamberlanS Offline
      Sebastiano ZamberlanS Offline
      Sebastiano Zamberlan
      wrote on last edited by Sebastiano Zamberlan
      #2

      @herrgross
      yo need to include the package to the project

      to use the #include <QSerialPort>

      if you are using CMake:
      you need to add the:

      find_package(Qt6 REQUIRED COMPONENTS SerialPort)
      target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
      

      if you are using qmake
      you need to add

      qmake:	QT += serialport
      

      you can see what you need in the initial table of every class description

      https://doc.qt.io/qt-6/qserialport.html

      H 1 Reply Last reply
      1
      • Sebastiano ZamberlanS Sebastiano Zamberlan

        @herrgross
        yo need to include the package to the project

        to use the #include <QSerialPort>

        if you are using CMake:
        you need to add the:

        find_package(Qt6 REQUIRED COMPONENTS SerialPort)
        target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
        

        if you are using qmake
        you need to add

        qmake:	QT += serialport
        

        you can see what you need in the initial table of every class description

        https://doc.qt.io/qt-6/qserialport.html

        H Offline
        H Offline
        herrgross
        wrote on last edited by
        #3

        @Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:

        QT       += core gui serialport
        

        gives me "Project ERROR: Unknown module"

        jsulmJ Sebastiano ZamberlanS 2 Replies Last reply
        0
        • H herrgross

          @Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:

          QT       += core gui serialport
          

          gives me "Project ERROR: Unknown module"

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @herrgross said in adding new class in Qt Creator:

          Project ERROR: Unknown module"

          and the unknown module is serialport?
          How did you install Qt?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          H 1 Reply Last reply
          0
          • H herrgross

            @Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:

            QT       += core gui serialport
            

            gives me "Project ERROR: Unknown module"

            Sebastiano ZamberlanS Offline
            Sebastiano ZamberlanS Offline
            Sebastiano Zamberlan
            wrote on last edited by
            #5

            @herrgross

            check with Qt Maintenance tool if you add the library "Serial Port" of your current Qt release, you find it under "additional libraries"

            1 Reply Last reply
            2
            • jsulmJ jsulm

              @herrgross said in adding new class in Qt Creator:

              Project ERROR: Unknown module"

              and the unknown module is serialport?
              How did you install Qt?

              H Offline
              H Offline
              herrgross
              wrote on last edited by
              #6

              @jsulm yes, unknown module serialport.
              What do you mean by "how did you install"?
              I'm on a Mac, installed from the Qt webpage

              jsulmJ 1 Reply Last reply
              0
              • H herrgross

                @jsulm yes, unknown module serialport.
                What do you mean by "how did you install"?
                I'm on a Mac, installed from the Qt webpage

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @herrgross said in adding new class in Qt Creator:

                What do you mean by "how did you install"?

                I mean exactly what I asked.
                There are different ways to install Qt.
                If you installed using the online installer then follow what @Sebastiano-Zamberlan suggested.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                H 1 Reply Last reply
                2
                • jsulmJ jsulm

                  @herrgross said in adding new class in Qt Creator:

                  What do you mean by "how did you install"?

                  I mean exactly what I asked.
                  There are different ways to install Qt.
                  If you installed using the online installer then follow what @Sebastiano-Zamberlan suggested.

                  H Offline
                  H Offline
                  herrgross
                  wrote on last edited by
                  #8

                  @jsulm @Sebastiano-Zamberlan
                  ok, thank you, I found it... strange, that there's no hint in the helpfiles how to do such a simple thing.....

                  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