forked from qt-creator/qt-creator
Use setClipboardAndSelection more broadly
Basically everywhere besides the EmacsKeys plugin. Change-Id: Iaf2a0a5d791b5b3dd6df2c05c1b862516630d3f8 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "helpplugin.h"
|
||||
|
||||
#include "bookmarkmanager.h"
|
||||
#include "contentwindow.h"
|
||||
#include "docsettingspage.h"
|
||||
#include "filtersettingspage.h"
|
||||
#include "generalsettingspage.h"
|
||||
@@ -38,23 +39,21 @@
|
||||
#include "helptr.h"
|
||||
#include "helpviewer.h"
|
||||
#include "helpwidget.h"
|
||||
#include "indexwindow.h"
|
||||
#include "localhelpmanager.h"
|
||||
#include "openpagesmanager.h"
|
||||
#include "searchtaskhandler.h"
|
||||
#include "searchwidget.h"
|
||||
#include "topicchooser.h"
|
||||
|
||||
#include <bookmarkmanager.h>
|
||||
#include <contentwindow.h>
|
||||
#include <indexwindow.h>
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/find/findplugin.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/helpitem.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -62,17 +61,19 @@
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/rightpane.h>
|
||||
#include <coreplugin/sidebar.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/find/findplugin.h>
|
||||
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/theme/theme.h>
|
||||
#include <utils/tooltip/tooltip.h>
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QDialog>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@@ -644,8 +645,7 @@ void HelpPluginPrivate::slotSystemInformation()
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject);
|
||||
layout->addWidget(buttonBox);
|
||||
connect(dialog, &QDialog::accepted, info, [info]() {
|
||||
if (QApplication::clipboard())
|
||||
QApplication::clipboard()->setText(info->toPlainText());
|
||||
setClipboardAndSelection(info->toPlainText());
|
||||
});
|
||||
connect(dialog, &QDialog::rejected, dialog, [dialog]{ dialog->close(); });
|
||||
dialog->resize(700, 400);
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
#include <QHelpEngine>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Help::Internal;
|
||||
|
||||
namespace Help::Internal {
|
||||
|
||||
// -- OpenPagesManager
|
||||
|
||||
@@ -252,5 +253,7 @@ void OpenPagesManager::openPagesContextMenu(const QPoint &point)
|
||||
QMenu menu;
|
||||
menu.addAction(Tr::tr("Copy Full Path to Clipboard"));
|
||||
if (menu.exec(m_comboBox->mapToGlobal(point)))
|
||||
QApplication::clipboard()->setText(fileName);
|
||||
Utils::setClipboardAndSelection(fileName);
|
||||
}
|
||||
|
||||
} // Help::Internal
|
||||
|
||||
@@ -24,11 +24,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "searchwidget.h"
|
||||
|
||||
#include "helpconstants.h"
|
||||
#include "helpplugin.h"
|
||||
#include "helptr.h"
|
||||
#include "localhelpmanager.h"
|
||||
#include "openpagesmanager.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -40,7 +39,6 @@
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QHelpEngine>
|
||||
#include <QHelpSearchEngine>
|
||||
#include <QHelpSearchQueryWidget>
|
||||
@@ -56,7 +54,7 @@
|
||||
#include <QTextBrowser>
|
||||
#include <QToolButton>
|
||||
|
||||
using namespace Help::Internal;
|
||||
namespace Help::Internal {
|
||||
|
||||
SearchWidget::SearchWidget() = default;
|
||||
|
||||
@@ -264,7 +262,7 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
|
||||
else if (usedAction == openLinkInNewTab)
|
||||
emit linkActivated(link, currentSearchTerms(), true/*newPage*/);
|
||||
else if (usedAction == copyAnchorAction)
|
||||
QApplication::clipboard()->setText(link.toString());
|
||||
Utils::setClipboardAndSelection(link.toString());
|
||||
}
|
||||
|
||||
QStringList SearchWidget::currentSearchTerms() const
|
||||
@@ -291,3 +289,5 @@ QList<QToolButton *> SearchSideBarItem::createToolBarWidgets()
|
||||
static_cast<SearchWidget *>(widget()), &SearchWidget::reindexDocumentation);
|
||||
return {reindexButton};
|
||||
}
|
||||
|
||||
} // Help::Internal
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#include "localhelpmanager.h"
|
||||
|
||||
#include <coreplugin/find/findplugin.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
@@ -43,8 +43,7 @@
|
||||
#include <QToolTip>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
namespace Help::Internal {
|
||||
|
||||
// -- HelpViewer
|
||||
|
||||
@@ -342,7 +341,7 @@ void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
}
|
||||
|
||||
if (copyAnchorAction == menu.exec(event->globalPos()))
|
||||
QApplication::clipboard()->setText(link.toString());
|
||||
Utils::setClipboardAndSelection(link.toString());
|
||||
}
|
||||
|
||||
bool TextBrowserHelpWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
@@ -409,3 +408,5 @@ void TextBrowserHelpWidget::resizeEvent(QResizeEvent *e)
|
||||
QTextBrowser::resizeEvent(e);
|
||||
scrollToTextPosition(topTextPosition);
|
||||
}
|
||||
|
||||
} // Help::Internal
|
||||
|
||||
Reference in New Issue
Block a user