Exemplo n.º 1
0
QMenu * ViewWindow::getContextMenu( const QUrl & link, QWidget * parent )
{
	if ( link.isEmpty() )
	{
		// standard context menu
		if ( !m_contextMenu )
			m_contextMenu = createStandardContextMenu( parent );
		
		return m_contextMenu;
	}
	else
	{
		// Open in New Tab context menu
		// standard context menu
		if ( !m_contextMenuLink )
		{
			m_contextMenuLink = createStandardContextMenu( parent );
			m_contextMenuLink->addSeparator();
			
			m_contextMenuLink->addAction( "&Open this link in a new tab", ::mainWindow, SLOT(onOpenPageInNewTab()), QKeySequence("Shift+Enter") );
			
			m_contextMenuLink->addAction( "&Open this link in a new background tab", ::mainWindow, SLOT(onOpenPageInNewBackgroundTab()), QKeySequence("Ctrl+Enter") );
		}
		
		setTabKeeper( link );
		return m_contextMenuLink;
	}
}
Exemplo n.º 2
0
void ContactListEdit::contextMenuEvent ( QContextMenuEvent * event )
{
    QMenu *menu = createStandardContextMenu();

    QAction* sep = new QAction(this);
    sep->setSeparator(true);
    menu->addAction(sep);

    QAction*  action_add_contact = new QAction(tr("Add Contact"), this);
    menu->addAction(action_add_contact);
    connect(action_add_contact, &QAction::triggered, this, &ContactListEdit::onActiveAddContact);
    action_add_contact->setDisabled(true);

    QAction*  action_find_contact = new QAction(tr("Find Contact"), this);
    menu->addAction(action_find_contact);
    connect(action_find_contact, &QAction::triggered, this, &ContactListEdit::onActiveFindContact);
    action_find_contact->setDisabled(true);

    if(textCursor().selection().isEmpty())
    {
        bool isExistingContact = false;
        if(validateClickPosition(event->pos(), &isExistingContact, &_clicked_contact))
        {
            if(isExistingContact)
                action_find_contact->setEnabled(true);
            else
                action_add_contact->setEnabled(true);
        }
    }

    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 3
0
void ASpellTextEdit::contextMenuEvent (QContextMenuEvent* event)
{
	QMenu* menu = createStandardContextMenu();

	if (m_spellchecker != NULL)
	{
		QString selected_text = textCursor().selectedText();

		if (selected_text.length() > 0)
		{
			m_suggest_list.clear();

			if (m_spellchecker->spellWord(selected_text, &m_suggest_list) == 1)
			{
				if (m_suggest_list.count() > 0)
				{
					menu->addSeparator();

					for (int i = 0; i < m_suggest_list.count() && i < 10; i++)
					{
						QAction* action = menu->addAction(m_suggest_list[i]);
						action->setMenuRole(QAction::ApplicationSpecificRole);
					}

					connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_triggered(QAction*)));

					menu->addSeparator();

					QAction* action = menu->addAction(QString::fromUtf8("Добавить в словарь"));
					connect(action, SIGNAL(triggered()), this, SLOT(menu_add_triggered()));
				}
			}
Exemplo n.º 4
0
QMenu*
SpinBox::getRightClickMenu()
{
    QMenu* menu =  createStandardContextMenu();
    menu->setFont(QApplication::font()); // necessary
    return menu;
}
Exemplo n.º 5
0
void ScriptingWidget::contextMenuEvent(QContextMenuEvent* pEvent)
{
   Interpreter* pInterpreter = NULL;
   InterpreterManager* pInterMgr = dynamic_cast<InterpreterManager*>(mInterpreter.get());
   if (pInterMgr != NULL)
   {
      pInterpreter = pInterMgr->getInterpreter();
   }
   if (pInterpreter == NULL)
   {
      mpGlobalOutputAction->setDisabled(true);
      mpGlobalOutputAction->setChecked(false);
   }
   else
   {
      bool globalOutput = pInterpreter->isGlobalOutputShown();
      mpGlobalOutputAction->setEnabled(true);
      mpGlobalOutputAction->setChecked(globalOutput);
   }
   QMenu* pMenu = createStandardContextMenu(pEvent->globalPos());
   pMenu->addSeparator();
   pMenu->addAction(mpClearAction);
   pMenu->addAction(mpGlobalOutputAction);
   pMenu->exec(pEvent->globalPos());
   delete pMenu;
}
Exemplo n.º 6
0
void FindLineEdit::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu *menu = createStandardContextMenu();

    /* This version check is implemented, because using this function leads to using
     * a regular expression for search in follow_stream_dialog.cpp as well as
     * show_packet_bytes_dialog.cpp. Both instances are not compatible with < 5.3 */
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
    QAction *action;

    menu->addSeparator();

    action = menu->addAction(tr("Textual Find"));
    action->setCheckable(true);
    action->setChecked(!use_regex_);
    connect(action, SIGNAL(triggered()), this, SLOT(setUseTextual()));

    action = menu->addAction(tr("Regular Expression Find"));
    action->setCheckable(true);
    action->setChecked(use_regex_);
    connect(action, SIGNAL(triggered()), this, SLOT(setUseRegex()));
#endif

    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 7
0
void MyLineEdit::contextMenuEvent(QContextMenuEvent *event)
{
	QMenu *menu = createStandardContextMenu();

	QString type = GetType(objectName());
	if (type == QString("vect3") || type == QString("vect4") || type == QString("logvect3"))
	{
		menu->addSeparator();
		actionCopyVectorToClipboard = menu->addAction(tr("Copy vector"));
		actionPasteVectorFromClipboard = menu->addAction(tr("Paste vector"));
		actionResetVectorToDefault = menu->addAction(tr("Reset vector to default"));

		QIcon iconReset = QIcon(":system/icons/edit-undo.png");
		actionResetVectorToDefault->setIcon(iconReset);
		QIcon iconCopy = QIcon::fromTheme("edit-copy");
		actionCopyVectorToClipboard->setIcon(iconCopy);
		QIcon iconPaste = QIcon::fromTheme("edit-paste");
		actionPasteVectorFromClipboard->setIcon(iconPaste);

		connect(actionCopyVectorToClipboard, SIGNAL(triggered()), this, SLOT(slotCopyVector()));
		connect(actionPasteVectorFromClipboard, SIGNAL(triggered()), this, SLOT(slotPasteVector()));
		connect(actionResetVectorToDefault, SIGNAL(triggered()), this, SLOT(slotResetVector()));
	}
	CommonMyWidgetWrapper::contextMenuEvent(event, menu);
}
Exemplo n.º 8
0
void PsiTextView::contextMenuEvent(QContextMenuEvent *e)
{
	QMenu *menu = createStandardContextMenu(e->pos());
	menu->exec(e->globalPos());
	e->accept();
	delete menu;
}
Exemplo n.º 9
0
void TextBrowser::contextMenuEvent(QContextMenuEvent * event)
{
    QMenu* menu = createStandardContextMenu();
    menu->addMenu(m_contextMenu);
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 10
0
void LogWidget::contextMenuEvent(QContextMenuEvent* event)
{
    QMenu* context_menu = createStandardContextMenu();
    context_menu->addAction(m_action_clear_all);
    context_menu->exec(event->globalPos());
    delete context_menu;
}
Exemplo n.º 11
0
void MimeTextEdit::contextMenuEvent(QContextMenuEvent *e)
{
    emit calculateContextMenuActions();

    QMenu *contextMenu = createStandardContextMenu(e->pos());

    /* Add actions for pasting links */
    contextMenu->addAction( tr("Paste as plain text"), this, SLOT(pastePlainText()));
    QAction *spoilerAction =  contextMenu->addAction(tr("Spoiler"), this, SLOT(spoiler()));
    spoilerAction->setToolTip(tr("Select text to hide, then push this button"));
    contextMenu->addSeparator();
    QAction *pasteLinkAction = contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
    contextMenu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));

    if (RSLinkClipboard::empty()) {
        pasteLinkAction->setDisabled(true);
    }

    QList<QAction*>::iterator it;
    for (it = mContextMenuActions.begin(); it != mContextMenuActions.end(); ++it) {
        contextMenu->addAction(*it);
    }

    contextMenu->exec(QCursor::pos());

    delete(contextMenu);
}
Exemplo n.º 12
0
void AddressWidget::contextMenuEvent(QContextMenuEvent *event)
{
	const QString shortcut = QKeySequence(QKeySequence::Paste).toString(QKeySequence::NativeText);
	QMenu *menu = createStandardContextMenu();
	bool found = false;

	if (!shortcut.isEmpty())
	{
		for (int i = 0; i < menu->actions().count(); ++i)
		{
			if (menu->actions().at(i)->text().endsWith(shortcut))
			{
				menu->insertAction(menu->actions().at(i + 1), ActionsManager::getAction(PasteAndGoAction));

				found = true;

				break;
			}
		}
	}

	if (!found)
	{
		menu->insertAction(menu->actions().at(6), ActionsManager::getAction(PasteAndGoAction));
	}

	menu->exec(event->globalPos());
	menu->deleteLater();
}
Exemplo n.º 13
0
void TextInputWidget::showContextMenu(const QPoint &pt)
{
    QMenu *menu = createStandardContextMenu();
    QList<QAction *> actions=menu->actions();

    //hack menu
    for(int i=0;i<actions.size();i++)
    {
        //qDebug()<<actions[i]->text();
        if(actions[i]->text().contains("undo",Qt::CaseInsensitive))
        {
            menu->removeAction(actions[i]);
        }
        if(actions[i]->text().contains("redo",Qt::CaseInsensitive))
        {
            menu->removeAction(actions[i]);
        }
        if(actions[i]->text().contains("delete",Qt::CaseInsensitive))
        {
            menu->removeAction(actions[i]);
        }
        if(actions[i]->text().contains("cu",Qt::CaseInsensitive))
        {
            actions[i]->disconnect(SIGNAL(triggered(bool)));
            connect(actions[i],SIGNAL(triggered(bool)),this,SLOT(cut()));
        }
        if(actions[i]->text().contains("paste",Qt::CaseInsensitive))
        {
            actions[i]->disconnect(SIGNAL(triggered(bool)));
            connect(actions[i],SIGNAL(triggered(bool)),this,SLOT(paste()));
        }
Exemplo n.º 14
0
void ScriptEditorWidget::contextMenuEvent(QContextMenuEvent * e)
{
	QMenu * pMenu = createStandardContextMenu();
	pMenu->addAction(__tr2qs_ctx("Context Sensitive Help","editor"),this,SLOT(slotHelp()),Qt::CTRL+Qt::Key_H);
	pMenu->addAction(__tr2qs_ctx("&Replace","editor"),this,SLOT(slotReplace()),Qt::CTRL+Qt::Key_R);
	pMenu->exec(e->globalPos());
	delete pMenu;
}
void SongInfoTextView::contextMenuEvent(QContextMenuEvent* e) {
  QMenu* menu = createStandardContextMenu(e->pos());
  menu->setAttribute(Qt::WA_DeleteOnClose);

  menu->addAction(tr("Change font size..."), this, SIGNAL(ShowSettingsDialog()));

  menu->popup(e->globalPos());
}
Exemplo n.º 16
0
void LogViewer::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu *menu = createStandardContextMenu();
    QAction *action = menu->addAction(tr("Clear"));
    connect(action, SIGNAL(triggered()), this, SLOT(clear()));
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 17
0
QMenu *XMLTextEdit::createOwnStandardContextMenu() 
{
QMenu *TContext = createStandardContextMenu();
TContext->addAction(QIcon(QString::fromUtf8(":/img/zoomin.png")),tr( "Zoom In CTRL/+" ), this , SLOT( zoomIn() ) );
TContext->addAction(QIcon(QString::fromUtf8(":/img/zoomout.png")),tr( "Zoom Out CTRL/-" ), this , SLOT( zoomOut() ) );
TContext->addAction(tr("Check xml syntax" ), this , SLOT( Syntaxcheck() ) );
return TContext;
}
Exemplo n.º 18
0
void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu *menu = createStandardContextMenu();
    menu->addAction(tr("Comment"),this,SLOT(commentText()));
    menu->addAction(tr("Uncomment"),this,SLOT(unCommentText()));
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 19
0
//! [0]
void MyTextEdit::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu *menu = createStandardContextMenu();
    menu->addAction(tr("My Menu Item"));
    //...
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 20
0
void CmdPromptHistory::contextMenuEvent(QContextMenuEvent* event)
{
    QMenu* menu = createStandardContextMenu();
    menu->addSeparator();
    //TODO: Extra stuff
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 21
0
void QOolTextEdit::contextMenuEvent(QContextMenuEvent *e)
{
    QMenu *menu = createStandardContextMenu();
    menu->addSeparator();
    menu->addAction(actionAdd);
    menu->addAction(actionAddBookmark);
    menu->exec(e->globalPos());
}
Exemplo n.º 22
0
void QueryWidget::contextMenuEvent(QContextMenuEvent *e)
{
    QScopedPointer<QMenu> menu(createStandardContextMenu());

    menu->addSeparator();
    menu->addAction(m_executeAction);

    menu->exec(e->globalPos());
}
Exemplo n.º 23
0
void ChatBrowser::showContextMenu(QPoint pos)
{
    QMenu* menu = createStandardContextMenu(pos);
    menu->addAction(m_bgColorAct);
    menu->addAction(m_detachedDialog);
    menu->addSeparator();
 //   menu->addAction(m_anyWhereWarp);
    menu->addAction(m_wordWarp);
    menu->exec(mapToGlobal(pos));
}
Exemplo n.º 24
0
void LogWindow::contextMenuEvent(QContextMenuEvent *event) {
    QMenu *menu = createStandardContextMenu();
    QAction *a = new QAction("Clear", this);
    a->setEnabled(!document()->isEmpty());
    connect(a, SIGNAL(triggered()), this, SLOT(clear()));
    QList<QAction*> L = menu->actions();
    menu->insertAction(L[0], a);
    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 25
0
//	CTextBrowserMessageLog::QTextEdit::contextMenuEvent()
void
CTextBrowserMessageLog::contextMenuEvent(QContextMenuEvent * pEvent)
	{
	const QPoint ptMenu = pEvent->globalPos();
	QMenu * paMenu = createStandardContextMenu(ptMenu);
	QAction * pActionClearLog = paMenu->addAction("Clear Log");
	connect(pActionClearLog, SIGNAL(triggered()), this, SLOT(clear()));
	paMenu->exec(ptMenu);
	delete paMenu;
	}
Exemplo n.º 26
0
    void PropertyLineEdit::contextMenuEvent(QContextMenuEvent *event) {
        QMenu  *menu = createStandardContextMenu ();

        if (m_wantNewLine) {
            menu->addSeparator();
            menu->addAction(tr("Insert line break"), this, &PropertyLineEdit::insertNewLine);
        }

        menu->exec(event->globalPos());
    }
void QScrollDownTextBrowser::contextMenuEvent(QContextMenuEvent *event)
{
    if (menu) {
        menu->deleteLater();
    }
    menu = createStandardContextMenu(event->pos());
    menu->setParent(this);
    QAction *action = menu->addAction(tr("Clear"));
    connect(action, SIGNAL(triggered()), this, SLOT(clear()));
    menu->exec(event->globalPos());
}
Exemplo n.º 28
0
 void TOPPASLogWindow::contextMenuEvent(QContextMenuEvent * e)
 {
   QMenu * menu = createStandardContextMenu();
   menu->addAction("Clear");
   QAction * selected = menu->exec(e->globalPos());
   if (selected && selected->text() == "Clear")
   {
     clear();
   }
   delete menu;
 }
Exemplo n.º 29
0
void SearchLineEdit::contextMenuEvent(QContextMenuEvent *event)
{
    QMenu *menu = createStandardContextMenu();

    menu->addSeparator();
    QAction *action = menu->addAction(tr("Clear Search History"));
    connect(action, SIGNAL(triggered()), this, SLOT(onClearHistory()));

    menu->exec(event->globalPos());
    delete menu;
}
Exemplo n.º 30
0
    void PropertyLineEdit::contextMenuEvent(QContextMenuEvent *event) {
        QMenu  *menu = createStandardContextMenu ();

        if (m_wantNewLine) {
            menu->addSeparator();
            QAction* nlAction = menu->addAction(tr("Insert line break"));
            connect(nlAction, SIGNAL(triggered()), this, SLOT(insertNewLine()));
        }

        menu->exec(event->globalPos());
    }