Transulcent widget ignore click



  • Hi, using QT 4.8 I have 2 windows (2 different QT applications). They are overlapped and the application on top is a QWidget with the attribute @Qt::WA_TranslucentBackground @
    I want to make the background of this widget (NOT the children like QPushButtons) transparent to click because I need to interact with the other window which is behind this.

    Any suggestion?

    Thanks guys ;)



  • set widget background color using rgba code (255,255,255,0);
    where a should be 0 if u want that there should be clicked behind the widget.

    otherwise a put 1 to 10 any value.
    a represents here opacity



  • I solved the problem splitting my main widget in several widgets.. in this way I don't need the widget to be transparent in the middle.
    Anyway if I try the following in the widget's constructor:

    @this->setStyleSheet("QWidget{background:rgba(0,0,0,0);}");@

    I only obtain a full black widget and not a transparent widget



  • I think following properties should be set for making a widget transparent:

    setWindowFlags (Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_TranslucentBackground, true);

    and one more thing:

    • It works on windows platform. I m not sure about other platform that it will work or not.

Log in to reply
 

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