How to create a TransparentWindow, using Qt5, with QtQuick1
I'm now using Qt5, but for some reasons I want to use QtQuick1, because there are some problems in my program when using QtQuick2.(mainly because of OpenGL)
But eventually I still faced problems using QtQuick1. If I set Qt::WA_TranslucentBackground to a QDeclarativeView, the program crashes when executing at app->exec(). My Code is:
int main(int argc, char *argv)
QScopedPointer<QApplication> app(new QApplication(argc, argv));
QPalette palette = view.palette();
//view.setStyleSheet("background:transparent"); //uncomment this line will make the whole window invisible
//view.setAttribute(Qt::WA_TranslucentBackground); //uncomment this line will make the program crash
And my QML file(main.qml):
import QtQuick 1.1
source: "some_pic.png" //it is less than 600 * 400
My system is Win Xp. Similar code works well when I'm using Qt4.8..
Any ideas? Thank you :)
I have test your example using Qt5 on Ubuntu, and I have no issue to compile and run such a implementation.
are working fine for me.
What is we use QGLWidget as viewport. It will be failed