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. The height of windowTitle?
Qt 6.11 is out! See what's new in the release blog

The height of windowTitle?

Scheduled Pinned Locked Moved General and Desktop
14 Posts 5 Posters 11.1k 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.
  • H Offline
    H Offline
    hchzhg
    wrote on last edited by
    #1

    I'm learning QT now.
    I have a question.How to change the height of windowTitle Bar.
    Just as the installation of QT(qt-windows-opensource-5.1.1-mingw48_opengl-x86-offline.exe).
    its windowTitle Bar looks very high.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hchzhg
      wrote on last edited by
      #2

      [[blank-post-content-placeholder]]

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

        I don't think this is under the control of Qt. It is under the control of the window manager. That's because an application just renders the content of a window, not the "decoration" (border and titlebar) around the window. If changing the height of the titlebar is possible at all, this will probably require platform-specific hacks, like using X-Window stuff or Win32 API functions...

        __

        One workaround might be to create a "frameless" window (with no "decoration" at all) and implement your own titlebar, using Qt widgets. But this will certainly break the "look & feel" of the operating system...

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          On windows this is done by extending window frame into client area.

          Up to Qt 5.1.1 this needs to be done with the "DwmExtendFrameIntoClientArea ":http://msdn.microsoft.com/en-us/library/windows/desktop/aa969512.aspx api directly.

          In Qt5.2 there is a new "Qt Windows Extras":http://doc-snapshot.qt-project.org/qt5-stable/qtwinextras-overview.html module that has support for this via "QtWin::extendFrameIntoClientArea":http://doc-snapshot.qt-project.org/qt5-stable/qtwin.html#extendFrameIntoClientArea

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hchzhg
            wrote on last edited by
            #5

            Good answer! Now I have download Qt5.2 And, eh... How do I use it?
            [quote author="Chris Kawa" date="1385149200"]On windows this is done by extending window frame into client area.

            Up to Qt 5.1.1 this needs to be done with the "DwmExtendFrameIntoClientArea ":http://msdn.microsoft.com/en-us/library/windows/desktop/aa969512.aspx api directly.

            In Qt5.2 there is a new "Qt Windows Extras":http://doc-snapshot.qt-project.org/qt5-stable/qtwinextras-overview.html module that has support for this via "QtWin::extendFrameIntoClientArea":http://doc-snapshot.qt-project.org/qt5-stable/qtwin.html#extendFrameIntoClientArea
            [/quote]

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi

              add

              @QT += winextras@

              to your pro file. Then you can use it like any Qt module

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lingyun9833
                wrote on last edited by
                #7

                I think you can use setWindowFlags(Qt::FramelessWindowHint) to hide the frame. And than use a QLabel to show windowTitle.

                As a tree, I have my own posture.

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Lankln That's no good since you loose all the window handling like moving, resizing, aero snap etc. You also loose the glass on Vista and Win7. Extending the frame is the way to go.

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

                    But DwmExtendFrameIntoClientArea doesn't help either. It just extends the window's "frame", i.e. the "glassy" area on Windows Vista and Windows 7, into the window's client area. It can give you an effect like in this example:

                    !http://3.bp.blogspot.com/-avAhxHCkGFc/TZSBmajnBUI/AAAAAAAABZw/d4CWsccEi9E/s1600/frameintoclientarea.PNG(Glassy Window)!

                    But it doesn't really change the height of the title bar. It just makes additional room on the glassy area, so you can add you own controls. Also, if I read hchzhg's post correctly, he thinks the titlebar is too big and would like to have to titlebar smaller, not make it even bigger.

                    _

                    Actually, using a "tool window" instead of a dialog may be the solution here:

                    !http://i.imgur.com/MvrIAL4.jpg(Tool Window)!

                    Use setWindowFlags() with Qt::Tool value.

                    My OpenSource software at: http://muldersoft.com/

                    Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                    Go visit the coop: http://youtu.be/Jay...

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hchzhg
                      wrote on last edited by
                      #10

                      Hi, Can you show the code of your "Frame into client area demo"
                      Up to now, I still don't know how to use the function
                      "
                      QtWin::extendFrameIntoClientArea
                      "
                      [quote author="MuldeR" date="1385218541"]But DwmExtendFrameIntoClientArea doesn't help either. It just extends the window's "frame", i.e. the "glassy" area on Windows Vista and Windows 7, into the window's client area. It can give you an effect like in this example:

                      !http://3.bp.blogspot.com/-avAhxHCkGFc/TZSBmajnBUI/AAAAAAAABZw/d4CWsccEi9E/s1600/frameintoclientarea.PNG(Glassy Window)!

                      But it doesn't really change the height of the title bar. It just makes additional room on the glassy area, so you can add you own controls. Also, if I read hchzhg's post correctly, he thinks the titlebar is too big and would like to have to titlebar smaller, not make it even bigger.

                      _

                      Actually, using a "tool window" instead of a dialog may be the solution here:

                      !http://i.imgur.com/MvrIAL4.jpg(Tool Window)!

                      Use setWindowFlags() with Qt::Tool value.[/quote]

                      1 Reply Last reply
                      0
                      • Chris KawaC Offline
                        Chris KawaC Offline
                        Chris Kawa
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @MuldeR You took it to the extreme, but you don't have to cover the whole window with glass. You can just slightly extend the top border and then give the actual widget a top margin of the same height.
                        No, it doesn't actually change the size of the tittle bar, but it looks that way - as is the case with any app that does it. You can just paint something there in the paintEvent to look more convincing.

                        @hchzhg You just call the function eg. in the constructor of your widget:
                        extendFrameIntoClientArea(this, 0, 10, 0, 0); or whatever and then set the Qt::WA_NoSystemBackground window attribute on it.

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          MuldeR
                          wrote on last edited by
                          #12

                          @Chris Kawa
                          Again, DwmExtendFrameIntoClientArea extends the border into the client area. Yes, you don't have to add the "glass" effect to the complete window. But still, you can only make the borders (including the upper border, aka the titlebar) larger this way. The OP, however, said that the title bar looks "very high". So he wants to make it smaller, not bigger. Also, you can not pass negative values to DwmExtendFrameIntoClientArea, because a negative value has a special meaning. It enables "sheet of glass effect", which is what you actually see on the screenshot I posted above...

                          At the same time, a tool window does have a thinner title bar. Also it's more straight forward to use, with standard Qt flags. Finally, it works on any Windows version (and other platforms), not just on Windows Vista and later.

                          My OpenSource software at: http://muldersoft.com/

                          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                          Go visit the coop: http://youtu.be/Jay...

                          1 Reply Last reply
                          0
                          • Chris KawaC Offline
                            Chris KawaC Offline
                            Chris Kawa
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            Sorry if I misunderstood.
                            Frm the first post I was under the impression we're talking about something like this:
                            !http://imageshack.us/a/img855/5836/pf03.png(qt sdk installer)!

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              MuldeR
                              wrote on last edited by
                              #14

                              Not quite sure what we're talking about ;-)

                              I was assuming he wants to make the title bar thinner - not even bigger.

                              [quote]I have a question.How to change the height of windowTitle Bar.

                              its windowTitle Bar looks very high.[/quote]

                              My OpenSource software at: http://muldersoft.com/

                              Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                              Go visit the coop: http://youtu.be/Jay...

                              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