0

I created QMdiArea in the main window, then I want to right click on the MDI area to get pop-up menu. To do this, I placed the following code in the constructor in the main window.

this->ui->mdiArea->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->ui->mdiArea, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotRtClickContextMenu(const QPoint&)))

The ContextMenu event happened as I checked it in the eventFilter.

However, there is no any response when I click at the MDI area. Then I replaced this->ui->mdiArea with this, it worked well and showed the pop-up menu.

Any suggestions?

Daniel Hedberg
  • 5,677
  • 4
  • 36
  • 61
yongqiang
  • 21
  • 3

1 Answers1

1

I had the similar issue but with QTreeWidget.Then setting the value of QtreeWidget->setContextMenuPolicy to Qt::CustomContextMenu resolved the problem. u could try the same.

user967400
  • 53
  • 5