Quantcast
Viewing all articles
Browse latest Browse all 13965

WA_TranslucentBackground doesn't work on Qt 5.2 Windows

Hi, The code below opens a borderless window with qml UI and black background. #include <QQuickView> #include "mainwindow.h"   MainWindow::MainWindow(QWidget *parent) :     QMainWindow(parent) {     setFixedSize(300, 300);     setWindowFlags(Qt::FramelessWindowHint);     setStyleSheet("background :transparent;");     //setAttribute(Qt::WA_TranslucentBackground, true);       view = new QQuickView();     view->setSource(QUrl("main.qml"));     view->setColor(QColor(Qt::transparent));       container = QWidget::createWindowContainer(view, this);     container->setFixedSize(300, 300);     container->setGeometry(10, 10, 30, 30);     container->setFocusPolicy(Qt::TabFocus); }   MainWindow::~MainWindow() {     delete container;     delete view; } But, if I remove the remark of below line, the window becomes completely invisible. setAttribute(Qt::WA_TranslucentBackground, true); Is it a bug? How can I have a irregular-shaped window with Qt 5.2? Thank you, Cid

Viewing all articles
Browse latest Browse all 13965

Trending Articles