[SOLVED] Widet and menu transparency on windows 7



  • Menu transparency doesn't seem to work on windows.
    @
    QApplication a(argc, argv);
    QMenu menu;
    menu.addAction("about", &a, SLOT(aboutQt()));
    menu.addAction("exit", &a, SLOT(quit()));
    menu.setWindowFlags(Qt::FramelessWindowHint);
    menu.setAttribute(Qt::WA_TranslucentBackground);

    // this
    menu.setStyleSheet("QMenu{background:rgba(255, 0, 0, 20%);}");
    // or this
    menu.setWindowOpacity(0.2);
    // doesn't work

    menu.popup(QCursor::pos());
    

    @
    Brings up a solid black box. When I move the cursor through it, it becomes what is expected (some alpha), but quickly becomes opaque when I run the cursor through it a few times.

    To put this in perspective, I'm trying to display an openGl window in my Qt app. I'd like menus (and perhaps other widgets) drawn over the openGl window to be see-through so that the openGl scene doesn't get fully obscured.

    Any ideas?



  • In case anyone runs into this, it got fixed when I uninstalled and installed it again from source configuring to use nmake rather than MinGW.


Log in to reply
 

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