QTreeWidget right click menu

后端 未结 4 1749
离开以前
离开以前 2021-02-03 11:31

I looked around and it seems that the problem is present not only for tree widget but also for other widgets. But in my case, I found a solution, although an incomplete one. I a

4条回答
  •  隐瞒了意图╮
    2021-02-03 12:33

    First you should set the context menu policy to CustomContextMenu:

    treeView->setContextMenuPolicy(Qt::CustomContextMenu);
    

    Then you can connect to the QWidget::customContextMenuRequested(const QPoint&) signal and show your context menu.

提交回复
热议问题