Transparent widgets are not moving with their parent



  • I have created a qt application which brings up a transparent widget.
    I have one another already running qt application which brings up a form , this qt application will act as a
    parent for my transparent widget.
    After changing the parent of my transparent widget, now when I move my parent qt window, my transparent widet(now child of second qt application), is not moving at all with repect to its parent.

    NOTE :- If I remove transparency code then my child widget follows its parent and move along with it.
    Please help me where I am going wrong in the below mention code.

    @
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {

     ui->setupUi(this);
    
    setWindowFlags(Qt::FramelessWindowHint);
    setStyleSheet("background:transparent;");
    setAttribute(Qt::WA_TranslucentBackground);
    
    this->setGeometry(200,200,500,500);
    
    
    WId hMSTSCWindow = NULL;
    
    //hMSTSCWindow = FindWindow(TEXT("TSSHELLWND"), NULL);
    hMSTSCWindow = FindWindow(TEXT("QWidget"), TEXT("MainParent"));
    if(hMSTSCWindow != NULL)
    {
        SetParent(this->winId(),hMSTSCWindow );
    
    }
    

    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.