1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Showing context menus on event's position.

- some keyboards (usually in laptops) have special key for
  showing context menu
- context menu events from keyboard will now be shown on
  correct position (not on mouse position)
This commit is contained in:
nowrep 2012-03-09 16:02:27 +01:00
parent 2582fff163
commit 291468a9ab
6 changed files with 7 additions and 7 deletions

View File

@ -89,7 +89,7 @@ void BookmarksToolbar::customContextMenuRequested(const QPoint &pos)
menu.addAction(tr("&Hide Toolbar"), this, SLOT(hidePanel())); menu.addAction(tr("&Hide Toolbar"), this, SLOT(hidePanel()));
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
QPoint position = QCursor::pos(); QPoint position = mapToGlobal(pos);
QPoint p(position.x(), position.y() + 1); QPoint p(position.x(), position.y() + 1);
menu.exec(p); menu.exec(p);
} }
@ -113,7 +113,7 @@ void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos)
menu.addAction(IconProvider::fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer); menu.addAction(IconProvider::fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer);
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
QPoint position = QCursor::pos(); QPoint position = button->mapToGlobal(pos);
QPoint p(position.x(), position.y() + 1); QPoint p(position.x(), position.y() + 1);
menu.exec(p); menu.exec(p);
} }

View File

@ -312,7 +312,7 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty()); m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos(); QPoint pos = mapToGlobal(event->pos());
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p); m_menu->popup(p);
} }

View File

@ -276,7 +276,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty()); m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos(); QPoint pos = mapToGlobal(event->pos());
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p); m_menu->popup(p);
} }

View File

@ -85,7 +85,7 @@ void PopupWebView::contextMenuEvent(QContextMenuEvent* event)
if (!m_menu->isEmpty()) { if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
const QPoint &pos = QCursor::pos(); const QPoint &pos = mapToGlobal(event->pos());
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p); m_menu->popup(p);
return; return;

View File

@ -154,7 +154,7 @@ void TabBar::contextMenuRequested(const QPoint &position)
} }
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
const QPoint &pos = QCursor::pos(); const QPoint &pos = mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
menu.exec(p); menu.exec(p);

View File

@ -329,7 +329,7 @@ void TabbedWebView::contextMenuEvent(QContextMenuEvent* event)
if (!m_menu->isEmpty()) { if (!m_menu->isEmpty()) {
//Prevent choosing first option with double rightclick //Prevent choosing first option with double rightclick
const QPoint &pos = QCursor::pos(); const QPoint &pos = mapToGlobal(event->pos());
QPoint p(pos.x(), pos.y() + 1); QPoint p(pos.x(), pos.y() + 1);
m_menu->popup(p); m_menu->popup(p);