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. what is way to get transparent background with popup Window type flag ?

what is way to get transparent background with popup Window type flag ?

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 2.2k 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 Qt embedded developer

    In my case when i use below code

    Qt::WindowFlags flags;
    flags = Qt::Popup | Qt::WindowStaysOnTopHint;
    ObjShutdownCount->setWindowFlags(flags);
    ObjShutdownCount->show();

    my transparent ui screen transform to no transparent screen.

    why existing property get changed ? what is way to get it back with this Window type enum ?

    Any reference is there then please let me know then i can explore more about it.

    jsulmJ Online
    jsulmJ Online
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @Qt-embedded-developer You're losing already set flags with your code. You should get current flags and add flags you want to set:

    Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
    ObjShutdownCount->setWindowFlags(flags);
    ObjShutdownCount->show();
    

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    Q 1 Reply Last reply
    0
    • jsulmJ jsulm

      @Qt-embedded-developer You're losing already set flags with your code. You should get current flags and add flags you want to set:

      Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
      ObjShutdownCount->setWindowFlags(flags);
      ObjShutdownCount->show();
      
      Q Offline
      Q Offline
      Qt embedded developer
      wrote on last edited by
      #3

      @jsulm by writing same code i am not getting transparent background popup

      jsulmJ 1 Reply Last reply
      0
      • Q Qt embedded developer

        @jsulm by writing same code i am not getting transparent background popup

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @Qt-embedded-developer Of course not - you are not making it transparent.
        See https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum and https://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        Q 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Qt-embedded-developer Of course not - you are not making it transparent.
          See https://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum and https://stackoverflow.com/questions/18316710/frameless-and-transparent-window-qt5

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by
          #5

          @jsulm By commenting below part my popup comes transparent but i want same transparent with this flag

          /* Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
          ObjShutdownCount->setWindowFlags(flags); */
          ObjShutdownCount->show();

          jsulmJ 1 Reply Last reply
          0
          • Q Qt embedded developer

            @jsulm By commenting below part my popup comes transparent but i want same transparent with this flag

            /* Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
            ObjShutdownCount->setWindowFlags(flags); */
            ObjShutdownCount->show();

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @Qt-embedded-developer So, did you try to set Qt::WA_TranslucentBackground?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            Q 1 Reply Last reply
            0
            • jsulmJ jsulm

              @Qt-embedded-developer So, did you try to set Qt::WA_TranslucentBackground?

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #7

              @jsulm yes when i set this my background comes completely black

              jsulmJ 1 Reply Last reply
              0
              • Q Qt embedded developer

                @jsulm yes when i set this my background comes completely black

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @Qt-embedded-developer Try also

                setAttribute(Qt::WA_NoSystemBackground, true);
                

                as shown in the link I provided.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                Q 2 Replies Last reply
                0
                • jsulmJ jsulm

                  @Qt-embedded-developer Try also

                  setAttribute(Qt::WA_NoSystemBackground, true);
                  

                  as shown in the link I provided.

                  Q Offline
                  Q Offline
                  Qt embedded developer
                  wrote on last edited by
                  #9

                  @jsulm yes by writing as per your suggestion this comes black. i have done lots of different try yesterday and today but i not get it transparent popup .

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    Qt embedded developer
                    wrote on last edited by
                    #10

                    Current solution :

                    i have used setMask() which make my out side region transparent with windowFlags

                    Qt::WindowFlags flags = ObjShutdownCount->windowFlags() | Qt::Popup | Qt::WindowStaysOnTopHint;
                    ObjShutdownCount->setWindowFlags(flags);
                    ObjShutdownCount->setAttribute(Qt::WA_NoSystemBackground, true);
                    ObjShutdownCount->setAttribute(Qt::WA_TranslucentBackground, true);
                    QRegion maskedRegion(75, 308, 332,152, QRegion::Rectangle);
                    ObjShutdownCount->setMask(maskedRegion);
                    ObjShutdownCount->show();

                    1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @Qt-embedded-developer Try also

                      setAttribute(Qt::WA_NoSystemBackground, true);
                      

                      as shown in the link I provided.

                      Q Offline
                      Q Offline
                      Qt embedded developer
                      wrote on last edited by
                      #11

                      @jsulm THANKS FOR YOUR EFFORT FOR SOLVE IT

                      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