Right way to include Qtxxx/private headers in Qt5 ?
-
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 ?
-
Hi and welcome to devnet,
No there's no global private nor qpa include.
What private API do you need ? Especially from QPA ?
-
Hi and welcome to devnet,
No there's no global private nor qpa include.
What private API do you need ? Especially from QPA ?
@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 belowQPlatformInputContext* 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.
-
What about QGuiApplication::inputMethod and QInputMethod::update ? Both are public API
-
What about QGuiApplication::inputMethod and QInputMethod::update ? Both are public API