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. Can't access QBluetoothDeviceInfo and QBluetoothDeviceDiscoveryAgent in qt 5.15
Forum Updated to NodeBB v4.3 + New Features

Can't access QBluetoothDeviceInfo and QBluetoothDeviceDiscoveryAgent in qt 5.15

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 2 Posters 701 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.
  • R Offline
    R Offline
    Raviteja0101
    wrote on last edited by
    #1

    I'm trying to reproduce a BLE code to receive chunks but can't seem to access the QBluetooth libraries in QT. Any leads please?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bludger
      wrote on last edited by
      #2

      Please give us more info. On what platform are you, compilers, QML/Quick or widgets etc.
      As a start you must add the bluetooth module into your project file:

      QT += bluetooth
      
      1 Reply Last reply
      0
      • R Offline
        R Offline
        Raviteja0101
        wrote on last edited by
        #3

        @bludger said in Can't access QBluetoothDeviceInfo and QBluetoothDeviceDiscoveryAgent in qt 5.15:

        QT += bluetooth

        Thank you, it worked! but I have this specific error, attached the snip below. Could you please help?

        25fbb644-e805-4ed3-87c0-f6f1553f9ac4-error.PNG

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bludger
          wrote on last edited by
          #4

          Please show me your include statement. It must be:

          #include <QBluetoothDeviceDiscoveryAgent>
          
          R 1 Reply Last reply
          0
          • B bludger

            Please show me your include statement. It must be:

            #include <QBluetoothDeviceDiscoveryAgent>
            
            R Offline
            R Offline
            Raviteja0101
            wrote on last edited by
            #5

            @bludger Hi , thanks again. it's like below.

            8822e5c0-d51c-4056-b81a-29fc1d182827-image.png

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bludger
              wrote on last edited by bludger
              #6

              Alright, that seems to be fine. Some things you can do:

              1. Clean out your build directory (remove it from disk) and rebuild your project. This makes sure all makefiles will be regenerated (by qmake) so they're up to date and all include directories are being updated properly
              2. Check if the file does exists on your harddrive. It must be located in the include folder of Qt [QT_BASE]/include/QtBluetooth
              3. Check if your Qt version in the current kit is >= 5.2
              4. If you put the QBluetoothDeviceInfo include before QBluetoothDeviceDiscoveryAgent, do you still get the same error on the QBluetoothDeviceDiscoveryAgent include?
              R 1 Reply Last reply
              0
              • B bludger

                Alright, that seems to be fine. Some things you can do:

                1. Clean out your build directory (remove it from disk) and rebuild your project. This makes sure all makefiles will be regenerated (by qmake) so they're up to date and all include directories are being updated properly
                2. Check if the file does exists on your harddrive. It must be located in the include folder of Qt [QT_BASE]/include/QtBluetooth
                3. Check if your Qt version in the current kit is >= 5.2
                4. If you put the QBluetoothDeviceInfo include before QBluetoothDeviceDiscoveryAgent, do you still get the same error on the QBluetoothDeviceDiscoveryAgent include?
                R Offline
                R Offline
                Raviteja0101
                wrote on last edited by
                #7

                @bludger Thank you very much but strangely when I reorder, the error is with QBluetoothDeviceInfo
                84bd1866-fc8d-4ae0-a0ad-599e241e8c00-image.png

                B 1 Reply Last reply
                0
                • R Raviteja0101

                  @bludger Thank you very much but strangely when I reorder, the error is with QBluetoothDeviceInfo
                  84bd1866-fc8d-4ae0-a0ad-599e241e8c00-image.png

                  B Offline
                  B Offline
                  bludger
                  wrote on last edited by
                  #8

                  @Raviteja0101 Did you check step 2 in my previous post?

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Raviteja0101
                    wrote on last edited by
                    #9

                    I did check and it's there. Also my qt version is Qt 5.15.2 (MSVC 2019, 64 bit)

                    51eef170-dc23-44f5-9a3a-b037b54ff068-image.png

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Raviteja0101
                      wrote on last edited by
                      #10

                      I did clean and build and it worked :) Thank you so much! I was wondering if you could help with one last issue. I'm getting this error in plot.cpp but I've used ui -> plot in mainwindow.cpp where it works but gives me a declaration error in plot.cpp

                      5d9403e8-12d6-48d0-b629-fd099acc68f2-image.png

                      c0fb5642-c508-4b1f-8172-684a913d7aff-image.png

                      B 1 Reply Last reply
                      0
                      • R Raviteja0101

                        I did clean and build and it worked :) Thank you so much! I was wondering if you could help with one last issue. I'm getting this error in plot.cpp but I've used ui -> plot in mainwindow.cpp where it works but gives me a declaration error in plot.cpp

                        5d9403e8-12d6-48d0-b629-fd099acc68f2-image.png

                        c0fb5642-c508-4b1f-8172-684a913d7aff-image.png

                        B Offline
                        B Offline
                        bludger
                        wrote on last edited by
                        #11

                        @Raviteja0101 The error you're getting is pretty clear. The plot class doesn't have a variable named ui. I'm not familiar with the code in plot class, but probably by removing ui->plot-> it might work.

                        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