How to remove the window border (containing minimize, maximize and close buttons) from a Qt widget?

梦想与她 提交于 2019-12-18 11:17:45

问题


I would like to animate a widget (QPushButon) to move across my application screen. For that I create a new button and using the QPropertyAnimation class and the property "geometry" of the button, I move it from top to down. The problem is that the button comes with the close, minimize, maximize buttons, etc. I don't want them to be there, nor the border that comes with the widget. What should I do ?


回答1:


You want to use the function QWidget::setWindowFlags( Qt::WindowFlags ).

If you want to remove the maximize/minimize/close buttons, this should work for you:

setWindowFlags( Qt::CustomizeWindowHint );

Qt::CustomizeWindowHint turns off all the default window hints, like the maximize, minimize, close buttons, and the title bar.

Here's a list of all Qt::WindowFlags.



来源:https://stackoverflow.com/questions/3948441/how-to-remove-the-window-border-containing-minimize-maximize-and-close-buttons

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!