[Qt-interest] Plain window with Qt::Tool style frame
John Weeks
john at wavemetrics.com
Tue Aug 24 01:24:16 CEST 2010
I guess that the silence on this issue means that Qt really doesn't
have a ready solution.
I managed to solve the problem by creating a frameless window with
WindowFlags = Qt::Window | Qt::FramelessWindowHint |
Qt::CustomizeWindowHint. Then I draw my own title bar, and by writing
implementations for the various mouse events I can make it work just
like a real title bar. My main worry is that I can't match all the
variations in styles that Windows and Mac OS X are constantly throwing
at us.
I tried subclassing QStyle, re-implementing drawComplexControl for
CC_TitleBar, and pixelMetric for PM_TitleBarHeight. It worked fairly
well on Windows, but fails on Macintosh where the titlebar refuses to
draw at less than full height. This also has the problem of needing to
derive QStyle from QMacStyle or QWindowsStyle or QXPStyle, or
whatever, depending on the desired overall look.
So- took quite a bit of work, but it works pretty well!
On Aug 9, 2010, at 5:10 PM, John Weeks wrote:
> My application has panels that are "stuck" to document windows. They
> are like tool bars, but much larger and more complicated. They need
> to have the appearance of a Qt::Tool window, but not the behavior.
> That is, they should act like a plain QWidget in a window, not
> staying above other windows. I also need them to behave as MDI
> subwindows.
>
> From another discussion ("QMainWindow with QTool title bar" started
> by Israel Brewster) , it seems that using Qt::WindowFlags offers
> only Qt::Tool with no option to have the small title bar appearance
> without the Tool behavior.
>
> If I were willing to subclass something (what?) could I override the
> title bar and frame drawing?
Regards,
John Weeks
WaveMetrics, Inc.
Phone (503) 620-3001
Fax (503) 620-6754
email support at WaveMetrics.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100823/2e1e2370/attachment.html
More information about the Qt-interest-old
mailing list