1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Always using position from QContextMenuEvent when showing menus.

- so it will show menu on proper position even if you create context
  menu event eg. from keyboard
This commit is contained in:
nowrep 2012-04-11 18:06:50 +02:00
parent 0b98562c22
commit 73dce1d2d2
8 changed files with 11 additions and 11 deletions

View File

@ -68,7 +68,7 @@ AdBlockDialog::AdBlockDialog(QWidget* parent)
connect(reloadButton, SIGNAL(clicked()), this, SLOT(updateSubscription()));
connect(search, SIGNAL(textChanged(QString)), treeWidget, SLOT(filterString(QString)));
connect(m_manager->subscription(), SIGNAL(rulesUpdated()), this, SLOT(refreshAfterUpdate()));
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested()));
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint)));
// QTimer::singleShot(0, this, SLOT(firstRefresh()));
firstRefresh();
@ -97,13 +97,13 @@ void AdBlockDialog::deleteRule()
refresh();
}
void AdBlockDialog::customContextMenuRequested()
void AdBlockDialog::contextMenuRequested(const QPoint &pos)
{
QMenu menu;
menu.addAction(tr("Add Rule"), this, SLOT(addCustomRule()));
menu.addSeparator();
menu.addAction(tr("Delete Rule"), this, SLOT(deleteRule()));
menu.exec(QCursor::pos());
menu.exec(treeWidget->viewport()->mapToGlobal(pos));
}
void AdBlockDialog::firstRefresh()

View File

@ -68,7 +68,7 @@ private slots:
void addCustomRule();
void firstRefresh();
void refreshAfterUpdate();
void customContextMenuRequested();
void contextMenuRequested(const QPoint &pos);
void editRule();
void deleteRule();

View File

@ -244,7 +244,7 @@ void BookmarksManager::contextMenuRequested(const QPoint &position)
}
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
return;
@ -272,7 +272,7 @@ void BookmarksManager::contextMenuRequested(const QPoint &position)
menu.addAction(tr("Remove bookmark"), this, SLOT(deleteItem()));
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
}

View File

@ -110,7 +110,7 @@ void HistoryManager::contextMenuRequested(const QPoint &position)
menu.addAction(tr("Copy address"), this, SLOT(copyUrl()))->setData(link);
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = ui->historyTree->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
}

View File

@ -243,7 +243,7 @@ void RSSManager::customContextMenuRequested(const QPoint &position)
menu.addAction(tr("Open link in new tab"), this, SLOT(loadFeedInNewTab()))->setData(link);
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = treeWidget->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
}

View File

@ -119,7 +119,7 @@ void BookmarksSideBar::contextMenuRequested(const QPoint &position)
menu.addAction(tr("&Delete"), this, SLOT(deleteItem()));
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
}

View File

@ -102,7 +102,7 @@ void HistorySideBar::contextMenuRequested(const QPoint &position)
menu.addAction(tr("Copy address"), this, SLOT(copyAddress()))->setData(link);
//Prevent choosing first option with double rightclick
QPoint pos = QCursor::pos();
QPoint pos = ui->historyTree->viewport()->mapToGlobal(position);
QPoint p(pos.x(), pos.y() + 1);
menu.exec(p);
}

View File

@ -181,7 +181,7 @@ void SiteInfo::imagesCustomContextMenuRequested(const QPoint &p)
menu.addAction(tr("Copy Image Name"), this, SLOT(copyActionData()))->setData(item->text(0));
menu.addSeparator();
menu.addAction(QIcon::fromTheme("document-save"), tr("Save Image to Disk"), this, SLOT(downloadImage()));
menu.exec(QCursor::pos());
menu.exec(ui->treeImages->viewport()->mapToGlobal(p));
}
void SiteInfo::databaseItemChanged(QListWidgetItem* item)