QT4 Drag Window Without Title Bar

前端 未结 3 2095
一向
一向 2020-12-28 21:17

The application I\'m working on has a custom UI that required me to remove the title bar from the main window. Unfortunately, I can\'t figure out how to make it so I can mo

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-28 21:55

    I don't remenber very well, but you can register a custom event handler, is easy there are so many examples on google. check for mouse event, before that you can use QObject::sender() and get the metaobject to know the class of the object tha is pressed if the object is a qframe or qwidget or another class that you want to use to move the window. then you can apply a logic to drag the window. the pros is that you can use with all window and frame without reimplement each one of them with mouse events

提交回复
热议问题