Changeset View
Changeset View
Standalone View
Standalone View
documentation/qthelp/qthelpdocumentation.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | |||||
261 | } | 261 | } | ||
262 | 262 | | |||
263 | void QtHelpDocumentation::viewContextMenuRequested(const QPoint& pos) | 263 | void QtHelpDocumentation::viewContextMenuRequested(const QPoint& pos) | ||
264 | { | 264 | { | ||
265 | StandardDocumentationView* view = qobject_cast<StandardDocumentationView*>(sender()); | 265 | StandardDocumentationView* view = qobject_cast<StandardDocumentationView*>(sender()); | ||
266 | if (!view) | 266 | if (!view) | ||
267 | return; | 267 | return; | ||
268 | 268 | | |||
269 | QMenu menu(view); | 269 | auto menu = view->createStandardContextMenu(); | ||
270 | QAction* copyAction = view->copyAction(); | | |||
271 | copyAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"))); | | |||
272 | menu.addAction(copyAction); | | |||
273 | 270 | | |||
274 | if (m_info.count() > 1) { | 271 | if (m_info.count() > 1) { | ||
275 | menu.addSeparator(); | 272 | if (!menu->isEmpty()) { | ||
273 | menu->addSeparator(); | ||||
274 | } | ||||
276 | 275 | | |||
277 | QActionGroup* actionGroup = new QActionGroup(&menu); | 276 | QActionGroup* actionGroup = new QActionGroup(menu); | ||
278 | foreach(const QString& name, m_info.keys()) { | 277 | foreach(const QString& name, m_info.keys()) { | ||
279 | QtHelpAlternativeLink* act=new QtHelpAlternativeLink(name, this, actionGroup); | 278 | QtHelpAlternativeLink* act=new QtHelpAlternativeLink(name, this, actionGroup); | ||
280 | act->setCheckable(true); | 279 | act->setCheckable(true); | ||
281 | act->setChecked(name==m_current.key()); | 280 | act->setChecked(name==m_current.key()); | ||
282 | menu.addAction(act); | 281 | menu->addAction(act); | ||
283 | } | 282 | } | ||
284 | } | 283 | } | ||
285 | 284 | | |||
286 | menu.exec(view->mapToGlobal(pos)); | 285 | menu->setAttribute(Qt::WA_DeleteOnClose); | ||
286 | menu->exec(view->mapToGlobal(pos)); | ||||
287 | } | 287 | } | ||
288 | 288 | | |||
289 | 289 | | |||
290 | void QtHelpDocumentation::jumpedTo(const QUrl& newUrl) | 290 | void QtHelpDocumentation::jumpedTo(const QUrl& newUrl) | ||
291 | { | 291 | { | ||
292 | Q_ASSERT(lastView); | 292 | Q_ASSERT(lastView); | ||
293 | m_provider->jumpedTo(newUrl); | 293 | m_provider->jumpedTo(newUrl); | ||
294 | setUserStyleSheet(lastView, newUrl); | 294 | setUserStyleSheet(lastView, newUrl); | ||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |