Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to add additional controls to window title bar
QtWS25 Last Chance

How to add additional controls to window title bar

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 7 Posters 3.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.
  • R Offline
    R Offline
    rock wang
    wrote on last edited by
    #1

    0_1530756259738_dcfbba72-15a2-4564-8893-7463d61ca44c-image.png

    How to implement effective like above image?
    I want add additional controls to window title bar when use qml

    raven-worxR S 2 Replies Last reply
    0
    • R rock wang

      0_1530756259738_dcfbba72-15a2-4564-8893-7463d61ca44c-image.png

      How to implement effective like above image?
      I want add additional controls to window title bar when use qml

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @rock-wang
      this is only possible if you draw the frame yourself.
      For that you need to set the window flags to a frameless window and handle the resizing and moving of the window yourself.
      In your custom title bar element you then can place any elements your like.

      --- 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

      R 1 Reply Last reply
      3
      • raven-worxR raven-worx

        @rock-wang
        this is only possible if you draw the frame yourself.
        For that you need to set the window flags to a frameless window and handle the resizing and moving of the window yourself.
        In your custom title bar element you then can place any elements your like.

        R Offline
        R Offline
        rock wang
        wrote on last edited by
        #3

        @raven-worx How to handle resizeing and moving myself? Do you have some examples?

        1 Reply Last reply
        0
        • KillerSmathK Offline
          KillerSmathK Offline
          KillerSmath
          wrote on last edited by KillerSmath
          #4

          @rock-wang
          Read this little article about how to implement the move and resize events inside of QML:
          https://evileg.com/en/post/280/

          You can do many things with QML
          Gif demonstratation

          @Computer Science Student - Brazil
          Web Developer and Researcher
          “Sometimes it’s the people no one imagines anything of who do the things that no one can imagine.” - Alan Turing

          1 Reply Last reply
          4
          • K Offline
            K Offline
            kkyzivat
            wrote on last edited by
            #5

            With Qt 5.15 a new feature was added to aid in the handling of resize and move logic in this situation where you set your window with the Qt.FramelessWindowHint flag.
            Now you can instruct the window manager to start a system resize or move on the window, instead of implementing the logic yourself:

            https://www.qt.io/blog/custom-window-decorations

            1 Reply Last reply
            2
            • fcarneyF Offline
              fcarneyF Offline
              fcarney
              wrote on last edited by
              #6

              I was playing with this. Started on this path because I wanted rounded window corners. Saw the extra work required for this and opted for regular windows. Lots of cool things you can do with frameless windows.

              C++ is a perfectly valid school of magic.

              V S 2 Replies Last reply
              0
              • fcarneyF fcarney

                I was playing with this. Started on this path because I wanted rounded window corners. Saw the extra work required for this and opted for regular windows. Lots of cool things you can do with frameless windows.

                V Offline
                V Offline
                Vijaykarthikeyan
                wrote on last edited by
                #7

                @fcarney what are they?

                1 Reply Last reply
                0
                • fcarneyF fcarney

                  I was playing with this. Started on this path because I wanted rounded window corners. Saw the extra work required for this and opted for regular windows. Lots of cool things you can do with frameless windows.

                  S Offline
                  S Offline
                  SamiV123
                  wrote on last edited by
                  #8

                  @fcarney

                  I think on Windows starting with Win10 or 11 you can add a compositor flag and windows will do this for you.

                  https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmsetwindowattribute

                  Also way back when all the cool kids on Win32 were doing custom clipping regions with the HDCs in order to create windows with custom regions or whatever for creating odd window shapes.

                  1 Reply Last reply
                  0
                  • R rock wang

                    0_1530756259738_dcfbba72-15a2-4564-8893-7463d61ca44c-image.png

                    How to implement effective like above image?
                    I want add additional controls to window title bar when use qml

                    S Offline
                    S Offline
                    SamiV123
                    wrote on last edited by
                    #9

                    @rock-wang

                    Have you consider whether you should do this?

                    The title bar has a consistent function that users expect on the platform, one of them being able to double click on it to go full screen, click and hold to drag etc.

                    Adding custom widgets will simply make it harder to use and your users will hate you for your bad UX when they miss click on some silly widget accidentally.

                    I'd suggest you put your widgets in the status bar which is typically at the bottom of the main window. This use case is also already well covered by Qt and is simple to do.

                    1 Reply Last reply
                    1

                    • Login

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