Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Right way to include Qtxxx/private headers in Qt5 ?

    General and Desktop
    2
    5
    5610
    Loading More Posts
    • 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.
    • D
      Dana Yan last edited by Dana Yan

      I am trying to move a project from Qt4.x to Qt5.x. The project is built with Visual Studio 2013.
      At present, I met a problem. Since Qt 5, some APIs/classes are changed. I need to use some classes in QtGui/private, QtGui/qpa, QtCore/private. Like these

      #include <QtGui/private/qguiapplication_p.h>
      #include <QtGui/qpa/qplatformintegration.h>
      #include <QtGui/qpa/qplatforminputcontext.h>
      

      For this purpose, I need to add these to Include path

      $(QTDIR)/include/QtCore/5.5.1
      $(QTDIR)/include/QtGui/5.5.1
      

      Some people say that add QT += gui-private to the .pro would work. This makes me confused, Because my project is built with Visual Studio.
      What's more, we can include all QtWidgets header by using

      #include <QtWidgets/QtWidgets>
      

      Is there a way to include all private headers. Is there a configure param( If I build Qt from source myself). Such as

      #include <QtGui/private>
      #include <QtGui/qpa>
      

      Or I need to make the file private/qpa myselft ?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi and welcome to devnet,

        No there's no global private nor qpa include.

        What private API do you need ? Especially from QPA ?

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

        D 1 Reply Last reply Reply Quote 0
        • D
          Dana Yan @SGaist last edited by Dana Yan

          @SGaist Thanks for reply.
          I have code like this

          // inputContext is from QWidget
          QInputContext* ic = inputContext();
          if (ic)
          {
              ic->reset();
              ic->update();
          }
          

          In Qt5, inputContext seems being removed, and QInputContext either.
          After making the changes, the code as below

          QPlatformInputContext* ic = QGuiApplicationPrivate::platformIntegration()->inputContext();
          if (ic)
          {
              ic->reset();
             // some other code
             ic->update(Qt::ImAbsolutePosition);  // In order to Adjust position of IME
          }
          

          API from QtGui/private and QtGui/qpa.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            What about QGuiApplication::inputMethod and QInputMethod::update ? Both are public API

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

            D 1 Reply Last reply Reply Quote 0
            • D
              Dana Yan @SGaist last edited by

              @SGaist Thanks. I will have a try.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post