1

I would like to add a button to the title bar of my C++/Qt application, like the one for Visual Studio notifications (I've seen other programs using it too, like SourceTree).

enter image description here

I have been searching around for a while but many pages redirect to this or this broken links. I've only found this CodeProject tutorial but my whole project is powered by Qt, not MFC.

Is there any standard/native way to do it using Qt or in C++?

PS: third-party window decoration replacements looks promising, but I would like not to make such replacement on standard Windows frame.

cbuchart
  • 10,847
  • 9
  • 53
  • 93
  • You can do this by removing the title bar and putting buttons yourself there. – The Quantum Physicist Nov 19 '18 at 12:32
  • @TheQuantumPhysicist, thanks, I've tried that before for other kind of requirements and I've ended up with too much manual overwriting of standard behaviors: window moving/sizing/snapping, global shortcut for minimizing... it is an option but I'd prefer a "less invasive" one ;) – cbuchart Nov 19 '18 at 12:35
  • 1
    It is not possible with Qt alone. You will have to use native stuff to add it there or use a custom titlebar. There are already projects like [this one](https://github.com/deimos1877/BorderlessWindow) that handle all the borderless stuff, including snapping etc. You can use those and extend them to add your buttons – Felix Nov 19 '18 at 13:10
  • Or maybe QML does this? – The Quantum Physicist Nov 19 '18 at 13:11
  • @Felix thanks! it seems such project can work, definitely I'll take a look at it – cbuchart Nov 19 '18 at 13:47
  • 1
    @cbuchart: I made my own implementation of a border less window called `QGoodWindow`, it's goal is to be simple to implement and Qt 5 friendly, no native code required from you and you can port your code to where the border less window are unavailable like Linux and Android. [See here](https://github.com/antonypro/QGoodWindow)! – Antonio Dias Nov 20 '18 at 03:35

0 Answers0