.h里定义:
private slots:
void TreeRightMenu(const QPoint &pos);
.cpp里:
添加信号:
connect(foldersTreeWidget,
SIGNAL(customContextMenuRequested(QPoint)),
this,
SLOT(TreeRightMenu(const QPoint&)));
void SetTool::TreeRightMenu(const QPoint &pos)
{
QMessageBox::information(this,tr("create directory"),
tr("create directory failed!"));
}
为什么右键foldersTreeWidget区域后不进入TreeRightMenu自定义函数
------解决方案--------------------
呵呵,你没设置contextMenuPolicy