How can I add widgets to title bars in QMainWindow?
Is any posibility to add widgets in titlebar of QMainWindow?
I try to avoid "emulate" a title bar by making a custom widget for that and hiding the default title bar (from Qt::Windo开发者_如何学GowFlags).
I am using QT 4.5 or 4.6 beta.
You cannot. What you can do is to create a completely custom window by hinting that you don't want a title bar using a Qt::WindowFlag. Notice - these flags are hints and not settings. Then you can create your own title bar and add whatever you like to it.
Also, notice, this will make your application harder to move between platforms. On the X11 side, you will even have to test against different window managers as they sometimes treat hints differently.
You can create your custom widget with the Qt::WindowFlag::ToolTip flag and handle the position manually.
精彩评论