Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [SOLVED] Widet and menu transparency on windows 7

    General and Desktop
    1
    2
    1064
    Loading More Posts
    • 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.
    • S
      sol_aries last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • S
        sol_aries last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post