Qt Creator module learning-2D drawing (irregular window)

Irregular window

In fact, for windows, including borders, menu bars, toolbars, core controls, status bars, etc., irregular windows can hide the border or even the window background.

    //去窗口边框
  setWindowFlags(Qt::FramelessWindowHint | windowFlags());
  //窗口背景透明
  setAttribute(Qt::WA_TranslucentBackground);

Very simple code can do it, but what we have to do in addition to this is, when we hide the window, how do we close the window, or move the window, here in addition to writing buttons, we can also use mouse events. Simple mouse events to realize the left button to move the right button to close.
Take the mouse to click the ground as a coordinate, and use the upper left corner of the window as the coordinate, and then convert it to get it.

Guess you like

Origin blog.csdn.net/m0_50210478/article/details/108559549