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 ?

How to make QDialog transparent in windows 7/10 ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.3k Views
  • 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 24 Jan 2018, 14:55 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 25 Jan 2018, 02:08
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 24 Jan 2018, 15:45 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 24 Jan 2018, 16:09 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

        M 1 Reply Last reply 24 Jan 2018, 16:24
        0
        • Q QtNovie
          24 Jan 2018, 16:09

          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

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 24 Jan 2018, 16:24 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
            24 Jan 2018, 14:55

            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 25 Jan 2018, 02:08 last edited by
            #5

            @QtNovie

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

            1 Reply Last reply
            1
            • 6 Offline
              6 Offline
              6thC
              wrote on 25 Jan 2018, 03:49 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

              2/6

              24 Jan 2018, 15:45

              topic:navigator.unread, 4
              • Login

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