QT: QTListWidget右键点击条目 弹出菜单框、网上说的方法我怎么实现不了。谁会 , 加QQ 1340478036
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);//设定listWidgetcontextMenu...
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);//设定listWidget contextMenu模式
// connect(ui->listWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(contextMenu(const QPoint &)));
popMenu = new QMenu(ui->listWidget);
action = new QAction("Copy",this);
void MessageInBox::on_listWidget_customContextMenuRequested(const QPoint &pos)//右键弹出菜单框
{
popMenu->addAction(action);
popMenu->exec(QCursor::pos());
} 展开
// connect(ui->listWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(contextMenu(const QPoint &)));
popMenu = new QMenu(ui->listWidget);
action = new QAction("Copy",this);
void MessageInBox::on_listWidget_customContextMenuRequested(const QPoint &pos)//右键弹出菜单框
{
popMenu->addAction(action);
popMenu->exec(QCursor::pos());
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询