Merge "Merge remote-tracking branch 'origin/6.0'"

This commit is contained in:
The Qt Project
2021-11-22 13:50:12 +00:00
41 changed files with 177 additions and 129 deletions

View File

@@ -364,13 +364,20 @@ jobs:
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" github_workspace)
include(${github_workspace}/cmake/QtCreatorIDEBranding.cmake)
string(REPLACE "." ";" IDE_VERSION_LIST ${IDE_VERSION_DISPLAY})
list(GET IDE_VERSION_LIST 0 IDE_VERSION_MAJOR)
message("::set-output name=ide_major_version::${IDE_VERSION_MAJOR}")
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: .ccache
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.ide_major_version }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.config.name }}-ccache-
${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.ide_major_version }}
- name: Install system libs
shell: cmake -P {0}
@@ -415,10 +422,10 @@ jobs:
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
set(ENV{CCACHE_SLOPPINESS} "pch_defines,time_macros")
set(ENV{CCACHE_COMPRESS} "true")
set(ENV{CCACHE_COMPRESSLEVEL} "6")
set(ENV{CCACHE_MAXSIZE} "800M")
set(ENV{CCACHE_COMPRESSLEVEL} "9")
set(ENV{CCACHE_MAXSIZE} "400M")
if ("${{ matrix.config.cxx }}" STREQUAL "cl")
set(ENV{CCACHE_MAXSIZE} "1200M")
set(ENV{CCACHE_MAXSIZE} "600M")
endif()
execute_process(
@@ -491,10 +498,10 @@ jobs:
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache")
set(ENV{CCACHE_SLOPPINESS} "pch_defines,time_macros")
set(ENV{CCACHE_COMPRESS} "true")
set(ENV{CCACHE_COMPRESSLEVEL} "6")
set(ENV{CCACHE_MAXSIZE} "800M")
set(ENV{CCACHE_COMPRESSLEVEL} "9")
set(ENV{CCACHE_MAXSIZE} "400M")
if ("${{ matrix.config.cxx }}" STREQUAL "cl")
set(ENV{CCACHE_MAXSIZE} "1200M")
set(ENV{CCACHE_MAXSIZE} "600M")
endif()
execute_process(COMMAND ccache -s)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -104,6 +104,9 @@
\list 1
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol {C++}.
\note The settings displayed here depend on which plugins you have
enabled. If the Clang Format plugin is enabled, you'll see the
settings described in \l{Automatic Formatting and Indentation}.
\li In the \uicontrol {Current settings} field, select the settings to
modify and click \uicontrol Copy.
\image qtcreator-options-code-style-cpp.png "C++ Code Style options"
@@ -233,7 +236,7 @@
select \uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor} >
\uicontrol Behavior > \uicontrol Typing.
To disable automatic indentation, deselect the
To disable automatic indentation, deselect the
\uicontrol {Enable automatic indentation} check box.
You can specify how the indentation is decreased when you press
@@ -250,6 +253,10 @@
the cursor is located within leading white space, select \uicontrol {In
Leading White Space}.
Your highlight definition file can contain definitions for both multi and
single line comments. To apply the single line comment definition when
commenting out a selection, select \uicontrol {Prefer single line comments}.
\if defined(qtcreator)
\section1 Specifying Settings for Content
@@ -298,13 +305,5 @@
pointers to functions and pointers to arrays.
\image qtcreator-pointers-references.png "Pointers and References options"
\section1 Naming Getters
To prefer getter names without the string \e get, select the
\uicontrol {Prefer getter names without "get"} check box in the
\uicontrol {Getter and Setter} tab.
\image qtcreator-code-style-getter-setter.png
\endif
*/

View File

@@ -57,7 +57,7 @@ Item {
_zoomFactor = cameraState[1];
camera.position = cameraState[2];
camera.rotation = cameraState[3];
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
@@ -70,7 +70,7 @@ Item {
_zoomFactor = 1;
camera.position = _defaultCameraPosition;
camera.eulerRotation = _defaultCameraRotation;
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
@@ -114,21 +114,21 @@ Item {
if (!camera)
return;
_zoomFactor = _generalHelper.zoomCamera(camera, distance, _defaultCameraLookAtDistance,
_zoomFactor = _generalHelper.zoomCamera(view3d, camera, distance, _defaultCameraLookAtDistance,
_lookAtPoint, _zoomFactor, true);
}
onCameraChanged: {
if (camera && _prevCamera) {
// Reset zoom on previous camera to ensure it's properties are good to copy to new cam
_generalHelper.zoomCamera(_prevCamera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, _prevCamera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
1, false);
camera.position = _prevCamera.position;
camera.rotation = _prevCamera.rotation;
// Apply correct zoom to new camera
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
_prevCamera = camera;

View File

@@ -57,7 +57,7 @@ Item {
_zoomFactor = cameraState[1];
camera.position = cameraState[2];
camera.rotation = cameraState[3];
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
@@ -70,7 +70,7 @@ Item {
_zoomFactor = 1;
camera.position = _defaultCameraPosition;
camera.eulerRotation = _defaultCameraRotation;
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
@@ -114,21 +114,21 @@ Item {
if (!camera)
return;
_zoomFactor = _generalHelper.zoomCamera(camera, distance, _defaultCameraLookAtDistance,
_zoomFactor = _generalHelper.zoomCamera(view3d, camera, distance, _defaultCameraLookAtDistance,
_lookAtPoint, _zoomFactor, true);
}
onCameraChanged: {
if (camera && _prevCamera) {
// Reset zoom on previous camera to ensure it's properties are good to copy to new cam
_generalHelper.zoomCamera(_prevCamera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, _prevCamera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
1, false);
camera.position = _prevCamera.position;
camera.rotation = _prevCamera.rotation;
// Apply correct zoom to new camera
_generalHelper.zoomCamera(camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_generalHelper.zoomCamera(view3d, camera, 0, _defaultCameraLookAtDistance, _lookAtPoint,
_zoomFactor, false);
}
_prevCamera = camera;

View File

@@ -176,14 +176,7 @@ void CameraGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexDat
QRectF rect = m_viewPortRect;
if (rect.isNull())
rect = QRectF(0, 0, 1000, 1000); // Let's have some visualization for null viewports
if (qobject_cast<QQuick3DOrthographicCamera *>(m_camera)) {
// For some reason ortho cameras show double what projection suggests,
// so give them doubled viewport to match visualization to actual camera view
camera->calculateGlobalVariables(QRectF(0, 0, rect.width() * 2.0,
rect.height() * 2.0));
} else {
camera->calculateGlobalVariables(rect);
}
camera->calculateGlobalVariables(rect);
m = camera->projection.inverted();
}

View File

@@ -130,8 +130,9 @@ QVector3D GeneralHelper::panCamera(QQuick3DCamera *camera, const QMatrix4x4 star
return startLookAt + delta;
}
float GeneralHelper::zoomCamera(QQuick3DCamera *camera, float distance, float defaultLookAtDistance,
const QVector3D &lookAt, float zoomFactor, bool relative)
float GeneralHelper::zoomCamera(QQuick3DViewport *viewPort, QQuick3DCamera *camera, float distance,
float defaultLookAtDistance, const QVector3D &lookAt,
float zoomFactor, bool relative)
{
// Emprically determined divisor for nice zoom
float multiplier = 1.f + (distance / 40.f);
@@ -140,7 +141,16 @@ float GeneralHelper::zoomCamera(QQuick3DCamera *camera, float distance, float de
if (qobject_cast<QQuick3DOrthographicCamera *>(camera)) {
// Ortho camera we can simply scale
camera->setScale(QVector3D(newZoomFactor, newZoomFactor, newZoomFactor));
float orthoFactor = newZoomFactor;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (viewPort) {
if (const QQuickWindow *w = viewPort->window())
orthoFactor *= w->devicePixelRatio();
}
#else
Q_UNUSED(viewPort)
#endif
camera->setScale(QVector3D(orthoFactor, orthoFactor, orthoFactor));
} else if (qobject_cast<QQuick3DPerspectiveCamera *>(camera)) {
// Perspective camera is zoomed by moving camera forward or backward while keeping the
// look-at point the same
@@ -249,7 +259,8 @@ QVector4D GeneralHelper::focusNodesToCamera(QQuick3DCamera *camera, float defaul
float divisor = closeUp ? 900.f : 725.f;
float newZoomFactor = updateZoom ? qBound(.01f, maxExtent / divisor, 100.f) : oldZoom;
float cameraZoomFactor = zoomCamera(camera, 0, defaultLookAtDistance, lookAt, newZoomFactor, false);
float cameraZoomFactor = zoomCamera(viewPort, camera, 0, defaultLookAtDistance, lookAt,
newZoomFactor, false);
return QVector4D(lookAt, cameraZoomFactor);
}

View File

@@ -65,7 +65,7 @@ public:
const QVector3D &startPosition, const QVector3D &startLookAt,
const QVector3D &pressPos, const QVector3D &currentPos,
float zoomFactor);
Q_INVOKABLE float zoomCamera(QQuick3DCamera *camera, float distance,
Q_INVOKABLE float zoomCamera(QQuick3DViewport *viewPort, QQuick3DCamera *camera, float distance,
float defaultLookAtDistance, const QVector3D &lookAt,
float zoomFactor, bool relative);
Q_INVOKABLE QVector4D focusNodesToCamera(QQuick3DCamera *camera, float defaultLookAtDistance,

View File

@@ -1623,14 +1623,20 @@ void ClangdClient::Private::handleFindUsagesResult(quint64 key, const QList<Loca
for (const Location &loc : locations)
refData->fileData[loc.uri()].rangesAndLineText << qMakePair(loc.range(), QString());
for (auto it = refData->fileData.begin(); it != refData->fileData.end(); ++it) {
const QStringList lines = SymbolSupport::getFileContents(it.key().toFilePath());
for (auto it = refData->fileData.begin(); it != refData->fileData.end();) {
const Utils::FilePath filePath = it.key().toFilePath();
if (!filePath.exists()) { // https://github.com/clangd/clangd/issues/935
it = refData->fileData.erase(it);
continue;
}
const QStringList lines = SymbolSupport::getFileContents(filePath);
it->fileContent = lines.join('\n');
for (auto &rangeWithText : it.value().rangesAndLineText) {
const int lineNo = rangeWithText.first.start().line();
if (lineNo >= 0 && lineNo < lines.size())
rangeWithText.second = lines.at(lineNo);
}
++it;
}
qCDebug(clangdLog) << "document count is" << refData->fileData.size();

View File

@@ -398,7 +398,7 @@ bool ClangdTextMark::addToolTipContent(QLayout *target) const
return c && c->reachable() && c->hasDiagnostic(DocumentUri::fromFilePath(fp), diag);
};
target->addWidget(ClangDiagnosticWidget::createWidget({m_diagnostic},
ClangDiagnosticWidget::ToolTip, canApplyFixIt, "clangd"));
ClangDiagnosticWidget::ToolTip, canApplyFixIt, m_client ? m_client->name() : "clangd"));
return true;
}

View File

@@ -636,7 +636,7 @@ void ClangdTestTooltips::test()
helpItem = h;
loop.quit();
};
connect(client(), &ClangdClient::helpItemGathered, handler);
connect(client(), &ClangdClient::helpItemGathered, &loop, handler);
QTextCursor cursor(doc->document());
const int pos = Utils::Text::positionInText(doc->document(), line, column);

View File

@@ -420,6 +420,8 @@ const QList<Client *> LanguageClientManager::clientsForProject(
void LanguageClientManager::openDocumentWithClient(TextEditor::TextDocument *document, Client *client)
{
if (!document)
return;
Client *currentClient = clientForDocument(document);
if (client == currentClient)
return;

View File

@@ -202,6 +202,18 @@ void updateCodeActionRefactoringMarker(Client *client,
}
}
static const char clientExtrasName[] = "__qtcreator_client_extras__";
class ClientExtras : public QObject
{
public:
ClientExtras(QObject *parent) : QObject(parent) { setObjectName(clientExtrasName); };
QPointer<QAction> m_popupAction;
QPointer<Client> m_client;
QPointer<QAction> m_outlineAction;
};
void updateEditorToolBar(Core::IEditor *editor)
{
auto *textEditor = qobject_cast<BaseTextEditor *>(editor);
@@ -214,70 +226,67 @@ void updateEditorToolBar(Core::IEditor *editor)
TextDocument *document = textEditor->textDocument();
Client *client = LanguageClientManager::clientForDocument(textEditor->textDocument());
static QHash<QWidget *, QAction *> actions;
if (actions.contains(widget)) {
auto action = actions[widget];
ClientExtras *extras = widget->findChild<ClientExtras *>(clientExtrasName,
Qt::FindDirectChildrenOnly);
if (!extras) {
if (!client)
return;
extras = new ClientExtras(widget);
}
if (extras->m_popupAction) {
if (client) {
action->setText(client->name());
extras->m_popupAction->setText(client->name());
} else {
widget->toolBar()->removeAction(action);
actions.remove(widget);
delete action;
widget->toolBar()->removeAction(extras->m_popupAction);
delete extras->m_popupAction;
}
} else if (client) {
const QIcon icon = Utils::Icon({{":/languageclient/images/languageclient.png",
Utils::Theme::IconsBaseColor}})
.icon();
actions[widget] = widget->toolBar()->addAction(
icon, client->name(), [document]() {
auto menu = new QMenu;
auto clientsGroup = new QActionGroup(menu);
clientsGroup->setExclusive(true);
for (auto client : LanguageClientManager::clientsSupportingDocument(document)) {
auto action = clientsGroup->addAction(client->name());
auto reopen = [action, client = QPointer<Client>(client), document]() {
if (!client)
return;
LanguageClientManager::openDocumentWithClient(document, client);
action->setChecked(true);
};
action->setCheckable(true);
action->setChecked(client == LanguageClientManager::clientForDocument(document));
QObject::connect(action, &QAction::triggered, reopen);
}
menu->addActions(clientsGroup->actions());
menu->addAction("Inspect Language Clients", []() {
LanguageClientManager::showInspector();
});
menu->addAction("Manage...", []() {
Core::ICore::showOptionsDialog(Constants::LANGUAGECLIENT_SETTINGS_PAGE);
});
menu->popup(QCursor::pos());
Utils::Theme::IconsBaseColor}}).icon();
extras->m_popupAction = widget->toolBar()->addAction(
icon, client->name(), [document = QPointer(document)] {
auto menu = new QMenu;
auto clientsGroup = new QActionGroup(menu);
clientsGroup->setExclusive(true);
for (auto client : LanguageClientManager::clientsSupportingDocument(document)) {
auto action = clientsGroup->addAction(client->name());
auto reopen = [action, client = QPointer(client), document] {
if (!client)
return;
LanguageClientManager::openDocumentWithClient(document, client);
action->setChecked(true);
};
action->setCheckable(true);
action->setChecked(client == LanguageClientManager::clientForDocument(document));
QObject::connect(action, &QAction::triggered, reopen);
}
menu->addActions(clientsGroup->actions());
if (!clientsGroup->actions().isEmpty())
menu->addSeparator();
menu->addAction("Inspect Language Clients", [] {
LanguageClientManager::showInspector();
});
QObject::connect(widget, &QWidget::destroyed, [widget]() {
actions.remove(widget);
menu->addAction("Manage...", [] {
Core::ICore::showOptionsDialog(Constants::LANGUAGECLIENT_SETTINGS_PAGE);
});
menu->popup(QCursor::pos());
});
}
static QHash<QWidget *, QPair<Client *, QAction *>> outlines;
if (outlines.contains(widget)) {
auto outline = outlines[widget];
if (outline.first != client
|| !LanguageClientOutlineWidgetFactory::clientSupportsDocumentSymbols(client,
document)) {
auto oldAction = outline.second;
widget->toolBar()->removeAction(oldAction);
delete oldAction;
outlines.remove(widget);
if (!extras->m_client || extras->m_client != client ||
!LanguageClientOutlineWidgetFactory::clientSupportsDocumentSymbols(client, document)) {
if (extras->m_outlineAction) {
widget->toolBar()->removeAction(extras->m_outlineAction);
delete extras->m_outlineAction;
}
extras->m_client.clear();
}
if (!outlines.contains(widget)) {
if (!extras->m_client) {
if (QWidget *comboBox = LanguageClientOutlineWidgetFactory::createComboBox(client, editor)) {
outlines[widget] = {client,
widget->insertExtraToolBarWidget(TextEditorWidget::Left, comboBox)};
extras->m_client = client;
extras->m_outlineAction = widget->insertExtraToolBarWidget(TextEditorWidget::Left,
comboBox);
}
}
}

View File

@@ -892,14 +892,14 @@ bool isPositioner(const SelectionContext &context)
bool layoutOptionVisible(const SelectionContext &context)
{
return multiSelectionAndInBaseState(context)
return selectionCanBeLayoutedAndQtQuickLayoutPossible(context)
|| singleSelectionAndInQtQuickLayout(context)
|| isLayout(context);
}
bool positionOptionVisible(const SelectionContext &context)
{
return multiSelectionAndInBaseState(context)
return selectionCanBeLayouted(context)
|| isPositioner(context);
}

View File

@@ -83,9 +83,11 @@ ChooseFromPropertyListDialog *ChooseFromPropertyListDialog::createIfNeeded(
// Common base types cause too many rarely valid matches, so they are ignored
const QSet<TypeName> ignoredTypes {"<cpp>.QObject",
"<cpp>.QQuickItem",
"<cpp>.QQuick3DObject",
"QtQuick.Item",
"QtQuick3D.Object3D",
"QtQuick3D.Node"};
"QtQuick3D.Node",
"QtQuick3D.Particles3D.ParticleSystem3D"};
for (const auto &propName : propNames) {
const TypeName testType = metaInfo.propertyTypeName(propName);

View File

@@ -320,7 +320,7 @@ QList<ModelNode> filteredList(const NodeListProperty &property, bool filter, boo
if (arg.hasAuxiliaryData(auxProp))
return arg.auxiliaryData(auxProp).toBool();
const bool value = QmlItemNode::isValidQmlItemNode(arg) || NodeHints::fromModelNode(arg).visibleInNavigator();
arg.setAuxiliaryData(auxProp, value);
arg.setAuxiliaryDataWithoutLock(auxProp, value);
return value;
}));
} else {

View File

@@ -189,6 +189,7 @@ public:
QVariant auxiliaryData(const PropertyName &name) const;
void setAuxiliaryData(const PropertyName &name, const QVariant &data) const;
void setAuxiliaryDataWithoutLock(const PropertyName &name, const QVariant &data) const;
void removeAuxiliaryData(const PropertyName &name) const;
bool hasAuxiliaryData(const PropertyName &name) const;
const QHash<PropertyName, QVariant> &auxiliaryData() const;

View File

@@ -1045,6 +1045,11 @@ void ModelNode::setAuxiliaryData(const PropertyName &name, const QVariant &data)
m_model.data()->d->setAuxiliaryData(internalNode(), name, data);
}
void ModelNode::setAuxiliaryDataWithoutLock(const PropertyName &name, const QVariant &data) const
{
m_model.data()->d->setAuxiliaryData(internalNode(), name, data);
}
void ModelNode::removeAuxiliaryData(const PropertyName &name) const
{
Internal::WriteLocker locker(m_model.data());

View File

@@ -325,25 +325,17 @@ public:
if (isCheckRunning(documentRevision, position))
return;
abortHandlers();
// Update invocation data
m_documentRevision = documentRevision;
m_position = position;
m_callback = callback;
// Re-initialize process data
m_currentHandlerIndex = 0;
m_bestHandler = nullptr;
m_highestHandlerPriority = -1;
// Start checking
checkNext();
restart();
}
bool isCheckRunning(int documentRevision, int position) const
{
return m_currentHandlerIndex <= m_handlers.size()
return m_currentHandlerIndex >= 0
&& m_documentRevision == documentRevision
&& m_position == position;
}
@@ -376,6 +368,7 @@ public:
checkNext();
return;
}
m_currentHandlerIndex = -1;
// All were queried, run the best
if (m_bestHandler) {
@@ -384,11 +377,36 @@ public:
}
}
void handlerRemoved(BaseHoverHandler *handler)
{
if (m_lastHandlerInfo.handler == handler)
m_lastHandlerInfo = LastHandlerInfo();
if (m_currentHandlerIndex >= 0)
restart();
}
private:
void abortHandlers()
{
for (BaseHoverHandler *handler : m_handlers)
handler->abort();
m_currentHandlerIndex = -1;
}
void restart()
{
abortHandlers();
if (m_handlers.empty())
return;
// Re-initialize process data
m_currentHandlerIndex = 0;
m_bestHandler = nullptr;
m_highestHandlerPriority = -1;
// Start checking
checkNext();
}
TextEditorWidget *m_widget;
@@ -5457,6 +5475,7 @@ void TextEditorWidget::addHoverHandler(BaseHoverHandler *handler)
void TextEditorWidget::removeHoverHandler(BaseHoverHandler *handler)
{
d->m_hoverHandlers.removeAll(handler);
d->m_hoverHandlerRunner.handlerRemoved(handler);
}
#ifdef WITH_TESTS

View File

@@ -33,8 +33,6 @@
#include "settings.h"
#include <QDir>
#include <iostream>
static char VERSION[] = "Version";

View File

@@ -35,8 +35,6 @@
#include <iostream>
#include <QDir>
// CMakeTools file stuff:
const char COUNT[] = "CMakeTools.Count";
const char PREFIX[] = "CMakeTools.";
@@ -92,7 +90,7 @@ bool AddCMakeOperation::setArguments(const QStringList &args)
if (current == "--path") {
++i; // skip next;
m_path = QDir::fromNativeSeparators(next);
m_path = next;
continue;
}
if (next.isNull()) {
@@ -211,7 +209,7 @@ QVariantMap AddCMakeOperation::addCMake(const QVariantMap &map, const QString &i
data << KeyValuePair({cm, ID_KEY}, QVariant(id));
data << KeyValuePair({cm, DISPLAYNAME_KEY}, QVariant(displayName));
data << KeyValuePair({cm, AUTODETECTED_KEY}, QVariant(true));
data << KeyValuePair({cm, PATH_KEY}, QVariant(path));
data << KeyValuePair({cm, PATH_KEY}, Utils::FilePath::fromUserInput(path).toVariant());
KeyValuePairList extraList;
foreach (const KeyValuePair &pair, extra)
extraList << KeyValuePair(QStringList({cm}) << pair.key, pair.value);

View File

@@ -33,8 +33,6 @@
#include "settings.h"
#include <QDir>
#include <iostream>
const char VERSION[] = "Version";
@@ -108,7 +106,7 @@ bool AddDebuggerOperation::setArguments(const QStringList &args)
if (next.isNull())
return false;
++i; // skip next;
m_binary = QDir::fromNativeSeparators(next);
m_binary = next;
continue;
}
@@ -213,7 +211,8 @@ QVariantMap AddDebuggerOperation::addDebugger(const QVariantMap &map,
data << KeyValuePair(QStringList() << debugger << QLatin1String(ABIS), QVariant(abis));
data << KeyValuePair(QStringList() << debugger << QLatin1String(ENGINE_TYPE), QVariant(engine));
data << KeyValuePair(QStringList() << debugger << QLatin1String(BINARY), QVariant(binary));
data << KeyValuePair(QStringList() << debugger << QLatin1String(BINARY),
Utils::FilePath::fromUserInput(binary).toVariant());
data << KeyValuePair(QStringList() << QLatin1String(COUNT), QVariant(count + 1));

View File

@@ -37,7 +37,6 @@
#include "settings.h"
#include <QDir>
#include <QRegularExpression>
#include <iostream>
@@ -185,7 +184,7 @@ bool AddKitOperation::setArguments(const QStringList &args)
if (next.isNull())
return false;
++i; // skip next;
m_sysRoot = QDir::fromNativeSeparators(next);
m_sysRoot = next;
continue;
}
@@ -649,7 +648,7 @@ QVariantMap AddKitOperation::addKit(const QVariantMap &map, const QVariantMap &t
if (!device.isNull())
data << KeyValuePair({kit, DATA, DEVICE_ID}, QVariant(device));
if (!sysRoot.isNull())
data << KeyValuePair({kit, DATA, SYSROOT}, QVariant(sysRoot));
data << KeyValuePair({kit, DATA, SYSROOT}, Utils::FilePath::fromUserInput(sysRoot).toVariant());
for (auto i = tcs.constBegin(); i != tcs.constEnd(); ++i)
data << KeyValuePair({kit, DATA, TOOLCHAIN, i.key()}, QVariant(i.value()));
if (!qtId.isNull())

View File

@@ -33,10 +33,12 @@
#include "settings.h"
#include <QDir>
#include <utils/filepath.h>
#include <iostream>
using namespace Utils;
// Qt version file stuff:
const char PREFIX[] = "QtVersion.";
const char VERSION[] = "Version";
@@ -297,7 +299,7 @@ QVariantMap AddQtOperation::addQt(const QVariantMap &map,
const QString qt = QString::fromLatin1(PREFIX) + QString::number(versionCount);
// Sanitize qmake path:
QString saneQmake = QDir::cleanPath(QDir::fromNativeSeparators(qmake));
FilePath saneQmake = FilePath::fromUserInput(qmake);
// insert data:
KeyValuePairList data;
@@ -305,7 +307,7 @@ QVariantMap AddQtOperation::addQt(const QVariantMap &map,
data << KeyValuePair(QStringList() << qt << QLatin1String(DISPLAYNAME), QVariant(displayName));
data << KeyValuePair(QStringList() << qt << QLatin1String(AUTODETECTED), QVariant(true));
data << KeyValuePair(QStringList() << qt << QLatin1String(AUTODETECTION_SOURCE), QVariant(sdkId));
data << KeyValuePair(QStringList() << qt << QLatin1String(QMAKE), QVariant(saneQmake));
data << KeyValuePair(QStringList() << qt << QLatin1String(QMAKE), saneQmake.toVariant());
data << KeyValuePair(QStringList() << qt << QLatin1String(TYPE), QVariant(type));
data << KeyValuePair(QStringList() << qt << ABIS, QVariant(abis));

View File

@@ -35,8 +35,6 @@
#include <iostream>
#include <QDir>
// ToolChain file stuff:
const char COUNT[] = "ToolChain.Count";
const char PREFIX[] = "ToolChain.";
@@ -106,7 +104,7 @@ bool AddToolChainOperation::setArguments(const QStringList &args)
if (current == "--path") {
++i; // skip next;
m_path = QDir::fromNativeSeparators(next);
m_path = next;
continue;
}
@@ -278,7 +276,7 @@ QVariantMap AddToolChainOperation::addToolChain(const QVariantMap &map, const QS
data << KeyValuePair({tc, LANGUAGE_KEY_V2}, QVariant(newLang));
data << KeyValuePair({tc, DISPLAYNAME}, QVariant(displayName));
data << KeyValuePair({tc, AUTODETECTED}, QVariant(true));
data << KeyValuePair({tc, PATH}, QVariant(path));
data << KeyValuePair({tc, PATH}, Utils::FilePath::fromUserInput(path).toVariant());
data << KeyValuePair({tc, TARGET_ABI}, QVariant(abi));
QVariantList abis;
QStringList abiStrings = supportedAbis.split(',');