Yeah! This is the final working code (Qt 4.6):
#include <QtGui/QDesktopWidget>
#include <QtGui/QApplication>
MainWindow
::MainWindow(QWidget* parent
) : QmlView(parent) // or QGraphicsView...
{
this->setWindowFlags(Qt::FramelessWindowHint);
}
{
int x = this->x();
int y = this->y();
int w = this->width();
int h = this->height();
this
->setBackgroundBrush
(QPixmap::grabWindow(wid, x, y, w, h
));
QmlView::showEvent(event);
}
#include <QtGui/QDesktopWidget>
#include <QtGui/QApplication>
MainWindow::MainWindow(QWidget* parent)
: QmlView(parent) // or QGraphicsView...
{
this->setWindowFlags(Qt::FramelessWindowHint);
this->setCacheMode(QGraphicsView::CacheBackground);
}
void MainWindow::showEvent(QShowEvent* event)
{
WId wid = QApplication::desktop()->winId();
int x = this->x();
int y = this->y();
int w = this->width();
int h = this->height();
this->setBackgroundBrush(QPixmap::grabWindow(wid, x, y, w, h));
QmlView::showEvent(event);
}
To copy to clipboard, switch view to plain text mode
No "WA_TranslucentBackground" or "autoFillBackground(false)" are needed!
Bookmarks