connect(d_custom_plot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(slot_show_region_context_menu(QMouseEvent*)));
void
ChartView::slot_show_region_context_menu(QMouseEvent*event)
{
if(event->button()==Qt::RightButton)
{
QMenu contextMenu(d_custom_plot);
contextMenu.addAction(d_actions[act_scatter]);
contextMenu.addAction(d_actions[act_broken_line]);
contextMenu.addAction(d_actions[act_curve]);
contextMenu.addAction(d_actions[act_spline]);
contextMenu.addAction(d_actions[act_red_point]);
contextMenu.addAction(d_actions[act_blue_point]);
contextMenu.addAction(d_actions[act_black_point]);
contextMenu.addAction(d_actions[act_ssCircle]);
contextMenu.addAction(d_actions[act_ssDisc]);
contextMenu.addAction(d_actions[act_ssCross]);
contextMenu.addAction(d_actions[act_ssPlus]);
contextMenu.exec(QCursor::pos());
}
}
QCustomPlot右键菜单
最新推荐文章于 2024-06-18 17:48:35 发布