I am trying to make a context menu, whenever the user right click on my plot.
{
this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,
SIGNAL(customContextMenuRequested
(const QPoint & )),
this,
SLOT(popUpMenu
(const QPoint &)));
MyPlot::MyPlot( QWidget* parent) : QwtPlot(parent)
{
this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,SIGNAL(customContextMenuRequested(const QPoint & )),this,SLOT(popUpMenu(const QPoint &)));
To copy to clipboard, switch view to plain text mode
and for sure
void MyPlot
::popUpMenu(const QPoint &pos
) {
qDebug()<<"meu aperto?"<<pos;
menu.addAction(a_print);
menu.popup(pos);
}
void MyPlot::popUpMenu(const QPoint &pos)
{
qDebug()<<"meu aperto?"<<pos;
QMenu menu;
menu.addAction(a_print);
menu.popup(pos);
}
To copy to clipboard, switch view to plain text mode
But nothing appear.
I forgot something?
Bookmarks