Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Transparent effect is not working in Qt5
An application I wrote with C++, Qt4, works fine on ARM board of Linux operating system. But when I try to run it in Qt5( after modification and re-compilation of course ), the parts where there are transparent effects is not working.
The pixmap used in a drag-drop, has a transparent part. But during a draging, the pixmap's transparent part is black, instead of transparent.
I want to set a widget's transparency in paintEvent with painter.fillRect( QRect( 0, 0, 800, 480 ), QColor( 0, 0, 0, 40 ) ). But it shows black regardless of my setting.
Has anyone dealt with this before? Or anyone has any ideas, please let me know. I will appreciate that. Thanks a lot.
Hi and welcome to devnet,
Which plugin are you using ? And which version of Qt 5 ?
@SGaist Thank you very much. Uh, the plugin is tslib? Does that count? And it's Qt5.2.1.
There is another thing though, when it comes to QML, only the QtQuick 1.x can work properly, QtQuick 2.x will only show a black area. Just so you know. I don't know if this is relevant.
PhTe last edited by
Maybe it has to do with the window manager.
As far as i know, Qt4 uses its own window manager and Qt5 needs an external one for composing.
@PhTe Well, I don't know about Qt's window manager. But the same pixmap that used during a dragging, if it is used in a widget like QListWidget, QToolButton, the transparent part looks normal. What's the difference between these two situations?
tslib is the input plugin for touchscreen handling.
Are you using linuxfb ? eglfs ?
@SGaist Yes. It's linuxfb.
Ok, then there's your problem: linuxfb is not enough for QtQuick2. You should use the eglfs plugin for Qt Quick 2 since OpenGL is a hard requirement for this module.
@SGaist So that's the problem, thanks a lot. To solve this, I have to re-transplant Qt with elgfs platform, right?
But the transparent thing I talked about, the code I used is pure C++, no qml at all. It still has something to do with elgfs platform?
Recompile ? Yes
So transparency on a pure QWidget project ?
Yes, no QtQuick involved, just QWidget.
Check that thread it might help
@SGaist Thanks. I'll give it a look.