How to fix QDialog transparent background afterimage issue in qt embedded (QT4.7.3)?

65 Views Asked by At

I am using embedded system and I'm testing transparent QWS server where is my Qt4.7.3.

I faced the afterimage in the QDialog when moving cursor in test program which as the QWS client, but it didn't happen in the QMainWindow which in QWS server program.

Can anyone help me to fix the issue?

There is the issue

Here is test program source code.

#include "mainwindow.h"

#include <QApplication>
#include<QWSServer>
#include <QDialog>
#include <fcntl.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
#include "qscreenlinuxfb_qws.h"
#include "qscreendriverfactory_qws.h"
#include <errno.h>
extern "C" {
extern int Test();
}
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QDialog w;

    QWSServer::setBackground(QColor(0,0,0,0));
    QWSServer::setCursorVisible(false);

    w.setStyleSheet("background-color:transparent;");
    w.show();
    return a.exec();
}
1

There are 1 best solutions below

0
azswsxdeTW On

OK I found the issue. In QT source code.

src\gui\embedded\qscreen_qws.cpp

        if (!blendSize.isNull()) {
            *blendbuffer = new QImage(blendSize, d_ptr->preferredImageFormat());
        }

to

        if (!blendSize.isNull()) {
            *blendbuffer = new QImage(blendSize, d_ptr->preferredImageFormat());
            QPixmap temp = QPixmap(blendSize);
            temp.fill(Qt::transparent);
            **blendbuffer = temp.toImage();
        }