QMenu----QT鼠標右鍵彈出菜單

在用QT編程時,有時候要實現鼠標右鍵彈出菜單的功能.下面代碼演示鼠標右鍵彈出菜單. 1.新建一個QT工程,點擊MainWindow.ui,鼠標右鍵Go to slot.....,添加customContextMenuRequested(const QPoint &pos)事件 2.找到屬性頁中的contextMenuPolicy,把DefaultContextMenu改成CustomContext
相關文章
相關標籤/搜索