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. Draw on other program
Qt 6.11 is out! See what's new in the release blog

Draw on other program

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 2 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.
  • M Offline
    M Offline
    Mehodin
    wrote on last edited by
    #1

    Hello,

    I'm trying to draw a window of QT on a different window (same application basically), how would i make sure the window doesnt leave the bounds of the other application, and if it does, how do i "cut off" the qt app?

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

      Hi
      Im not sure what you mean ?
      You try to draw on top of another window in same application ?
      When you say draw, do you mean put the actual window on top of other window ?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mehodin
        wrote on last edited by
        #3

        yes, so say i have a window, which isnt exactly mine, but a DLL gets injected into the process.

        This dll spawns a UI and it basically has to be drawn on top of the window that already existed, as if it is a member, and when you try to drag it outside of the window that already existed it wont go outside of it, it'll just only partially draw it.

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

          Hi
          That sounds a bit kinky :)
          is the other window also a Qt app?

          Since the DLL window is not really inside the other windows, im not sure we can clip it in any easy way.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Mehodin
            wrote on last edited by
            #5

            It's not, sadly.

            mrjjM 1 Reply Last reply
            0
            • M Mehodin

              It's not, sadly.

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

              @Mehodin
              Hi. ok. that makes it very hard.
              i did try fast with
              QWidget::createWindowContainer
              and grab notepad window and place it under Qt control but
              sadly the stacking order makes it impossible to move any other Widget on top of it.
              The foreign window would always be top.

              So sadly i know no way to clip your window to the foreign window so
              only option is maybe to detect when your window is moved and reduce with or height.

              1 Reply Last reply
              1
              • M Offline
                M Offline
                Mehodin
                wrote on last edited by
                #7

                hmm, how about SetForegroundWindow when it's not foreground window? Wouldn't that allow you to?

                mrjjM 1 Reply Last reply
                0
                • M Mehodin

                  hmm, how about SetForegroundWindow when it's not foreground window? Wouldn't that allow you to?

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

                  Hi
                  Nope, not with createWindowContainer it seems.
                  just tried.

                  Just wondering, is you DLL window some sort of
                  extra info or why is it important to clip it other the foreign window?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Mehodin
                    wrote on last edited by
                    #9

                    so it looks good, lol.

                    Right now i just set it to frameless borderless window hint thingy, and then grab the sizes of the other window and draw it over it, so yeah.

                    I guess this is a temporary solve.

                    mrjjM 1 Reply Last reply
                    0
                    • M Mehodin

                      so it looks good, lol.

                      Right now i just set it to frameless borderless window hint thingy, and then grab the sizes of the other window and draw it over it, so yeah.

                      I guess this is a temporary solve.

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

                      @Mehodin
                      Yep, seems best way to avoid it sticking outside.

                      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