예제 #1
0
void FxLineLcdSpinBox::contextMenuEvent(QContextMenuEvent* event)
{
	// for the case, the user clicked right while pressing left mouse-
	// button, the context-menu appears while mouse-cursor is still hidden
	// and it isn't shown again until user does something which causes
	// an QApplication::restoreOverrideCursor()-call...
	mouseReleaseEvent(nullptr);

	QPointer<CaptionMenu> contextMenu = new CaptionMenu(model()->displayName(), this);

	if (QMenu *fxMenu = m_tv->createFxMenu(
		tr("Assign to:"), tr("New FX Channel")))
	{
		contextMenu->addMenu(fxMenu);

		contextMenu->addSeparator();
	}
	addDefaultActions(contextMenu);
	contextMenu->exec(QCursor::pos());
}
		virtual void contextMenuEvent( QContextMenuEvent* event )
		{
			// for the case, the user clicked right while pressing left mouse-
			// button, the context-menu appears while mouse-cursor is still hidden
			// and it isn't shown again until user does something which causes
			// an QApplication::restoreOverrideCursor()-call...
			mouseReleaseEvent( NULL );

			QPointer<CaptionMenu> contextMenu = new CaptionMenu( model()->displayName(), this );

			// This condition is here just as a safety check, fxLineLcdSpinBox is aways
			// created inside a TabWidget inside an InstrumentTrackWindow
			if ( InstrumentTrackWindow* window = dynamic_cast<InstrumentTrackWindow*>( (QWidget *)this->parent()->parent() ) )
			{
				QMenu *fxMenu = window->instrumentTrackView()->createFxMenu( tr( "Assign to:" ), tr( "New FX Channel" ) );
				contextMenu->addMenu( fxMenu );

				contextMenu->addSeparator();
			}
			addDefaultActions( contextMenu );
			contextMenu->exec( QCursor::pos() );
		}