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. Qt::WindowCloseButtonHint on a certain window
Forum Updated to NodeBB v4.3 + New Features

Qt::WindowCloseButtonHint on a certain window

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.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.
  • S Offline
    S Offline
    Seajmoon
    wrote on last edited by
    #1

    Hello,

    i have a Program that starts a QT (QMainWindow) when one clicks on a button.

    I want the QT Program just to stay on top of this other window.

    Qt::WindowCloseButtonHint makes a window stay on top all windows
    @
    w.setWindowFlags( Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint);
    @

    I have the HWND to the window that starts the QT Program.

    Thanks.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      whats your question after all?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Seajmoon
        wrote on last edited by
        #3

        My question is how to place my qt main window on top a certain window.
        I only have the Hinstance (NOT HWND) to this window.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          ok, sry did got what you wanted.

          In Qt you would do this: listen to the window activation event (e.g. with an event filter) on the base window and call QWidget::raise() for the widget/window you want to place above.

          So in case your main application is not written in Qt you need to struggle with WinAPI accomplishing the same mechanism i described.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Seajmoon
            wrote on last edited by
            #5

            Am thinking i could set the HWND from the program that opens the QT as the parent to the QT program.
            Then set the window flag of the qt program to QT::Tool ;-)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Seajmoon
              wrote on last edited by
              #6

              Solved:

              using the SetParent win32 API and the Qt::Tool
              @
              HWND newParent = SetParent((HWND)w.winId(), p_hwnd);
              w.setWindowFlags( Qt::Tool);
              @

              where p_hwnd is the Program that starts my Qt.

              Thanks

              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