void toPieChart::createPopupMenu(const QPoint &pos) { if (!Menu) { Menu = new QMenu(this); Menu->addAction(QIcon(QPixmap(print_xpm)), tr("&Print..."), this, SLOT(editPrint())); Menu->addAction(tr("&Open in new window"), this, SLOT(openCopy())); } Menu->exec(QCursor::pos()); }
void toPieChart::mousePressEvent ( QMouseEvent *e ) { if ( e->button() == RightButton ) { if ( !Menu ) { Menu = new QPopupMenu ( this ); Menu->insertItem ( QPixmap ( ( const char * ) print_xpm ), "&Print", this, SLOT ( editPrint() ) ); Menu->insertItem ( "&Open in new window", this, SLOT ( openCopy() ) ); } Menu->popup ( e->globalPos() ); } }