The height of windowTitle?
-
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...
-
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
-
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] -
I think you can use setWindowFlags(Qt::FramelessWindowHint) to hide the frame. And than use a QLabel to show windowTitle.
-
@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.
-
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.
-
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]
-
@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. -
@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.
-
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)!