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. How to make QDialog transparent in windows 7/10 ?
Forum Updated to NodeBB v4.3 + New Features

How to make QDialog transparent in windows 7/10 ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.4k Views 1 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.
  • Q Offline
    Q Offline
    QtNovie
    wrote on last edited by
    #1

    I have below code
    setStyleSheet("background:transparent;");
    setAttribute(Qt::WA_TranslucentBackground);
    ui->setupUi(this);
    which gives me transparent window in linux. But the same gives black background in windows. How to achieve the transparency in windows also ?

    D 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      It would only work for me on win 7 if i set
      setWindowFlag(Qt::FramelessWindowHint,true);
      but then it looses its border/caption.

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QtNovie
        wrote on last edited by
        #3

        I don't know how we will solve this. I tried many solutions but all fails and partially fixed. Finally i reported an issue QTBUG-65969

        mrjjM 1 Reply Last reply
        0
        • Q QtNovie

          I don't know how we will solve this. I tried many solutions but all fails and partially fixed. Finally i reported an issue QTBUG-65969

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          ok super.
          I moved to linux so didn't try a lot but i also tried
          palette but had no luck with Dialogs.

          1 Reply Last reply
          0
          • Q QtNovie

            I have below code
            setStyleSheet("background:transparent;");
            setAttribute(Qt::WA_TranslucentBackground);
            ui->setupUi(this);
            which gives me transparent window in linux. But the same gives black background in windows. How to achieve the transparency in windows also ?

            D Offline
            D Offline
            Devopia53
            wrote on last edited by
            #5

            @QtNovie

            Hi.
            Now you can only use Win32 api with Qt for that.

            1 Reply Last reply
            1
            • 6thC6 Offline
              6thC6 Offline
              6thC
              wrote on last edited by
              #6

              I gave up.
              https://bugreports.qt.io/browse/QTBUG-55955

              https://bugreports.qt.io/browse/QTBUG-28214

              I got this from support.

              I wonder how I have never noticed that before. It seems to not clear the
              buffer after moving. Strange flickering that occurs while moving is because
              there is double (or triple) buffering where each buffer seems to have separate
              copy of the view.
              
              Note that transparency does not always work. Windows does not support
              transparent OpenGL windows and Qt achieves this through DWM effects. DWM
              effects can be disabled on some machines, which would lead to just a solid
              black background. I am thinking this could even be a side effect of DWM and
              maybe has nothing to do with Qt actually.
              
              How ever, is there a reason why you want frames and a transparent background?
              This does not happen if you do this to the Window (/ApplicationWindow and for
              widget, there is similar flag):
              
              flags: Qt.FramelessWindowHint
              

              It got me thinking - no. I didn't need it that much.
              It's a windows thing - I'm used to it disappointing me now.

              I plan on supporting windows but pushing linux or linux/boot2qt solution.

              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