Konrad
Konrad

Reputation: 7198

Qt widgets custom QMainWindow title bar

I have removed original title bar with Qt::FramelessWindowHint. I'm trying to re-implement it now. I have created a widget and I would like to put it above menuBar but it allows me to put widgets only inside centralWidget. What's the best way to accomplish this?

enter image description here

Upvotes: 1

Views: 3318

Answers (1)

Jepessen
Jepessen

Reputation: 12415

You can create a widget with a QVBoxLayout, in which as first element you insert your custom title bar that will appear on the top, and as second element the menubar widget. Then in the QMainWindow instance instead of using setMenuBar you can use setMenuWidget in order to put your widget in the menu bar position.

Upvotes: 1

Related Questions