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. Right way to include Qtxxx/private headers in Qt5 ?

Right way to include Qtxxx/private headers in Qt5 ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 6.9k 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.
  • D Offline
    D Offline
    Dana Yan
    wrote on last edited by Dana Yan
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        No there's no global private nor qpa include.

        What private API do you need ? Especially from QPA ?

        D Offline
        D Offline
        Dana Yan
        wrote on last edited by Dana Yan
        #3

        @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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0
          • SGaistS SGaist

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

            D Offline
            D Offline
            Dana Yan
            wrote on last edited by
            #5

            @SGaist Thanks. I will have a try.

            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