QT5, linuxfb doesn't seem to work with tslib plugin.
-
I am working on porting a QT4 app to QT5.
Despite the fact that I am using a PhyCORE-AM335(GL ES2 ) board for testing, the only QPA platform option I have is linuxfb because the app is suppose to run also on some older board where only linuxfb is available.-
Using Codesorcery lite (24.5.2013) for compilation.
-
built QT with the following conf spec
@ ./configure -continue -verbose -qpa linuxfb -linuxfb -no-iconv -no-warnings-are-errors -opensource -no-optimized-qmake -release -no-icu -no-opengl -no-xcb -no-largefile -no-opengl -qt-zlib -qt-libpng -qt-libjpeg -openssl -nomake examples -nomake tests -confirm-license -prefix /opt/arm -xplatform linux-arm-gnueabi-g++@ -
tslib enviroment is already set ( the QT4 app is working fine)
-
I have applied "this":https://github.com/prabindh/qt-configs/blob/master/qt5_1.0_Feb13/tslib.patch patch.
-
I build qtslib plugin with the printf uncommented
@
void QTsLibMouseHandler::readMouseData()
{
...
QPoint pos(x, y);printf("handleMouseEvent %d %d %d %ld\n", m_x, m_y, pressed, sample.tv.tv_usec); QWindowSystemInterface::handleMouseEvent(0, pos, pos, pressed ? Qt::LeftButton : Qt::NoButton);
...
}
}@When launched the "handleMouseEvent" messages are shown but still the input is not taken.
This means the input is more or less not propagated properly through QWindowSystemInterface::handleMouseEvent...
After taking a look at the platform code I noticed that the linuxfb implements no window interface like other plugins (directfb, xcb) do.Here there are 2 scenarios
2.a It should work as it is and it's a bug( or a feature ofc) I haven't included
2.b. It's simply not implemented and in this case I would really apreciate some hints of about how to start implementing it.thank you in advance,
Daniel -
-
After some researchign I found out that the screen handling in linuxfb plugin was the issue. Basically , for the linuxfb platform, the screen was registered before its geometry was calculated resulting that the qpa controller will deal with a screen instance that has geometry of QRect(0,0,1,1) . This masks pretty much all the painting and the input.
Other than that I forced a default font size of at least 10 since on my system the default pixel size is 0 rendering all the layout based samples(most of them) to look really really small.
The changes that made the things work for me:
@QLinuxFbIntegration::QLinuxFbIntegration(const QStringList ¶mList)
: m_fontDb(new QGenericUnixFontDatabase()),m_paramList(paramList)
{
}void QLinuxFbIntegration::initialize()
{
initializeFont();
initializeScreen();
}
void QLinuxFbIntegration::initializeScreen()
{
m_primaryScreen = new QLinuxFbScreen(m_paramList);
m_primaryScreen->initialize();
screenAdded(m_primaryScreen);
}void QLinuxFbIntegration::initializeFont()
{
if(m_fontDb &&
m_fontDb->defaultFont().pixelSize() < 10)
{
m_fontDb->defaultFont().setPixelSize(10);
}}
QT_END_NAMESPACE
@and the header
@
#ifndef QLINUXFBINTEGRATION_H
#define QLINUXFBINTEGRATION_H#include <qpa/qplatformintegration.h>
QT_BEGIN_NAMESPACE
class QLinuxFbIntegrationPrivate;
class QAbstractEventDispatcher;
class QLinuxFbScreen;class QLinuxFbIntegration : public QPlatformIntegration
{........
protected:
virtual void initializeScreen();
virtual void initializeFont();
..............
private:
QStringList m_paramList;
............};
QT_END_NAMESPACE
#endif // QLINUXFBINTEGRATION_H
@ -
Also a minor change for tslib plugin.
Since most systems that use tslib have already defined TSLIB_TSDEVICE , I thought it makes sense to inherit this as the default value when available./base/src/plugins/generic/tslib/qtslib.cpp
@
QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
const QString &specification)
: m_notify(0), m_x(0), m_y(0), m_pressed(0), m_rawMode(false)
{
...
QByteArray device = qgetenv("TSLIB_TSDEVICE");
if(device.isEmpty())
{
device = "/dev/input/event0";
}
.....
}
@ -
Great, It solves also my problem
http://qt-project.org/forums/viewthread/36120/
Thank you very much daneilg!
-
Dear Daneilg,
I did the same but when i run the application,
@QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
const QString &specification)
: m_notify(0), m_x(0), m_y(0), m_pressed(0), m_rawMode(false)
{
qDebug() << "QTsLibMouseHandler" << key << specification;
@
Above qDebug statement is not getting called. This means the control is not going into the qtslib.cpp file.Please share your valuable advice.
Thanks