Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Transparent widgets are not moving with their parent
Qt 6.11 is out! See what's new in the release blog

Transparent widgets are not moving with their parent

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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 );
    
    }
    

    @

    1 Reply Last reply
    1
    • T Offline
      T Offline
      tataeress
      wrote on last edited by tataeress
      #2

      can anyone help please ?
      i'm having the exact same problem
      except that i wanna move the widgets separately

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved