user3365834
user3365834

Reputation:

Widgets in window title Qt

Is in Qt something like GTK.headerbar or any other possibility to add wiget (button for example) in window title?

Thanks in advance.

Upvotes: 0

Views: 957

Answers (1)

svlasov
svlasov

Reputation: 10456

Short answer is 'no', Qt doesn't implement any kind of window decorations (except QWS which is a different story).

In Linux the title bars (window decorations) are carried by Window Managers, like Metacity or Compiz. Windows and OSX use their own window decorations. Qt has almost no control over what happens on the window title bars.

Gnome3/GTK3 (and not Gnome2) allows you to use widgets in the title bar but it's not the case for many other Desktop Environments / Window Managers. Your options are:

  • Use the API provided by the window manager / OS
    • Pros: native look.
    • Cons: you need to maintain separate implementation for each OS / DE. Not all support doing such.
  • Hide window decorations and implement you own
    • Pros: code once, use everywhere. Google Chrome and Vivaldi do that, for example.
    • Cons: you need to implement window resize and move
  • Use an overlay widget on top of the system title bar that will always follow the window
    • Pros: pretty much straightforward to do but I don't recommend it.
    • Cons: the widget will always lag when moving the main window. Native look still has to be implemented. Take into account that user can switch the theme and the widget will look odd.

Upvotes: 2

Related Questions