How do you add a button to the main window menu?
-
Is there any way in QML to add a button to the main window menu (that is, where the buttons turn, close, right next to them)
UPD: Any decisions will also be made to draw a new panel. The main condition is that the panel received must look like the main panel of the window. That is, when the windows change the topic, it is necessary to type the topic (including transparent)
-
Cleaning standard buttons is much easier than adding them (see). http://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html ) With the addition of its new elements, it's complicated.
We would like to point out that the annex is only made under Windows (on the text of the question). Nothing special in Qt to support these buttons, I don't know, so I'm gonna have to go to WIN API. Before the Aero era, the task was easy - we could draw anything on our own: just catch.
WM_NCPAINT
(sighs) https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd145212(v=vs.85).aspx Respond to window-heading eventsWM_NCHITTEST
♪WM_NCLBUTTONDOWN
etc.It's like processing.
WM_PAINT
, but we don't paint inside the window, but in all the windows.And since the beginning of the visual era, it's become much more complicated. As far as I understand, the only normal way is to repeat the button styles with your hands. I mean, in your code, we need to see what Windows version of the user and if Aero is on to choose which width the frame is to be used, etc. It's a bad approach, I'd be glad if someone showed a more human solution, so it'd be better to think if new buttons were to be added.
But since no one wants to do this, they usually just ignore Windows styles (e.g. Google Chrome uses his whole window style, so boldly fries what buttons want in any part of the window headline).