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. Compilation error when using QBalloonTip private class in the project
Qt 6.11 is out! See what's new in the release blog

Compilation error when using QBalloonTip private class in the project

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 626 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.
  • faiszalkhanF Offline
    faiszalkhanF Offline
    faiszalkhan
    wrote on last edited by
    #1

    I want to use QBallonTip to display a tooltip with a tail. As per this stack overflow answer, I can use or modify it but it is a private class meaning I have to be careful about it being moved elsewhere in future. I want to use this class because it solves my problem and I plan to modify it to make the tail point to a QPoint in the Mainwidow.

    The Stack overflow answer mentions modifying the QBallonTip class and includes it directly in the source code. I tried to simply include in my project but I'm running into compilation errors before making any modifications.

    I am currently getting "undefined reference to QBalloonTip class" error which as I understand means that the compiler cannot find the implementation of the class.

    Now, the class is defined in the file qsystemtrayicon_p.h.

    When I use QBalloonTip, qsystemtrayicon_p.h header at the following location is used. Also, I cannot respective cpp file there which I believe is causing the error:

    C:\Qt\Qt5.9.0\5.9\mingw53_32\include\QtWidgets\5.9.0\QtWidgets\private\qsystemtrayicon_p.h

    Here is the header mentioned in the stack overflow answer. Apparently, this location also has the source file in the same directory but is not picked up by the compiler:

    C:\Qt\Qt5.9.0\5.9\Src\qtbase\src\widgets\util\qsystemtrayicon_p.h

    What could be the best approach to resolve this issue?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Since QBallonTip is a private class it's not exported and therefore not visible from the outside.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

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

        Hi,

        You have to explicitly state in your .pro file that you want to use the Qt widgets private API knowing that it may change completely or even disappear in the next version of Qt.

        [edit]: not everything in the private implementation is exported and thus available 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

        faiszalkhanF 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          You have to explicitly state in your .pro file that you want to use the Qt widgets private API knowing that it may change completely or even disappear in the next version of Qt.

          [edit]: not everything in the private implementation is exported and thus available to use.

          faiszalkhanF Offline
          faiszalkhanF Offline
          faiszalkhan
          wrote on last edited by
          #4

          @SGaist I have already done with QT += widgets-private.

          Do I need to do anything else?

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Again: QBallonTip is not exported. You can not create an instance of this class by yourself!

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

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

              @faiszalkhan @Christian-Ehrlicher is correct, I missed the export part so it's indeed a class you cannot 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
              1

              • Login

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