Merge remote-tracking branch 'origin/4.14'

Change-Id: I5e138bb7883c0436fee14ca6af20e99396676af1
This commit is contained in:
Eike Ziller
2020-11-20 13:00:37 +01:00
54 changed files with 440 additions and 139 deletions

View File

@@ -60,6 +60,7 @@
#include <utils/textutils.h>
#include <QDirIterator>
#include <QPair>
#include <QTextDocument>
namespace ClangCodeModel {
@@ -512,11 +513,17 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
completeIncludePath(realPath, suffixes);
}
auto includesCompare = [](AssistProposalItemInterface *first,
AssistProposalItemInterface *second) {
return first->text() < second->text();
};
std::sort(m_completions.begin(), m_completions.end(), includesCompare);
QList<QPair<AssistProposalItemInterface *, QString>> completionsForSorting;
for (AssistProposalItemInterface * const item : qAsConst(m_completions)) {
QString s = item->text();
s.replace('/', QChar(0)); // The dir separator should compare less than anything else.
completionsForSorting << qMakePair(item, s);
}
Utils::sort(completionsForSorting, [](const auto &left, const auto &right) {
return left.second < right.second;
});
for (int i = 0; i < completionsForSorting.count(); ++i)
m_completions[i] = completionsForSorting[i].first;
return !m_completions.isEmpty();
}

View File

@@ -132,25 +132,29 @@ private:
QMetaObject::Connection m_updateSizeConnection;
};
class TopLeftLocatorPopup : public LocatorPopup
class TopLeftLocatorPopup final : public LocatorPopup
{
public:
TopLeftLocatorPopup(LocatorWidget *locatorWidget)
: LocatorPopup(locatorWidget, locatorWidget) {}
: LocatorPopup(locatorWidget, locatorWidget) {
doUpdateGeometry();
}
protected:
void updateGeometry() override;
void doUpdateGeometry() override;
void inputLostFocus() override;
};
class CenteredLocatorPopup : public LocatorPopup
class CenteredLocatorPopup final : public LocatorPopup
{
public:
CenteredLocatorPopup(LocatorWidget *locatorWidget, QWidget *parent)
: LocatorPopup(locatorWidget, parent) {}
: LocatorPopup(locatorWidget, parent) {
doUpdateGeometry();
}
protected:
void updateGeometry() override;
void doUpdateGeometry() override;
};
// =========== LocatorModel ===========
@@ -297,22 +301,22 @@ void CompletionList::setModel(QAbstractItemModel *newModel)
}
}
void LocatorPopup::updateGeometry()
void LocatorPopup::doUpdateGeometry()
{
m_tree->resizeHeaders();
}
void TopLeftLocatorPopup::updateGeometry()
void TopLeftLocatorPopup::doUpdateGeometry()
{
QTC_ASSERT(parentWidget(), return);
const QSize size = preferredSize();
const int border = m_tree->frameWidth();
const QRect rect(parentWidget()->mapToGlobal(QPoint(-border, -size.height() - border)), size);
setGeometry(rect);
LocatorPopup::updateGeometry();
LocatorPopup::doUpdateGeometry();
}
void CenteredLocatorPopup::updateGeometry()
void CenteredLocatorPopup::doUpdateGeometry()
{
QTC_ASSERT(parentWidget(), return);
const QSize size = preferredSize();
@@ -333,7 +337,7 @@ void CenteredLocatorPopup::updateGeometry()
if (rect.left() < available.left())
rect.moveLeft(available.left());
setGeometry(rect);
LocatorPopup::updateGeometry();
LocatorPopup::doUpdateGeometry();
}
void LocatorPopup::updateWindow()
@@ -354,17 +358,17 @@ bool LocatorPopup::event(QEvent *event)
updateWindow();
else if (event->type() == QEvent::Show)
// make sure the popup has correct position before it becomes visible
updateGeometry();
doUpdateGeometry();
else if (event->type() == QEvent::LayoutRequest)
// completion list resizes after first items are shown --> LayoutRequest
QTimer::singleShot(0, this, &LocatorPopup::updateGeometry);
QTimer::singleShot(0, this, &LocatorPopup::doUpdateGeometry);
return QWidget::event(event);
}
bool LocatorPopup::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_window && event->type() == QEvent::Resize)
updateGeometry();
doUpdateGeometry();
return QWidget::eventFilter(watched, event);
}
@@ -427,8 +431,6 @@ LocatorPopup::LocatorPopup(LocatorWidget *locatorWidget, QWidget *parent)
if (isVisible())
locatorWidget->scheduleAcceptEntry(index);
});
updateGeometry();
}
CompletionList *LocatorPopup::completionList() const

View File

@@ -121,7 +121,7 @@ public:
protected:
QSize preferredSize();
virtual void updateGeometry();
virtual void doUpdateGeometry();
virtual void inputLostFocus();
QPointer<QWidget> m_window;

View File

@@ -7422,6 +7422,52 @@ void CppEditorPlugin::test_quickfix_removeUsingNamespace_data()
expected1 = expected2 = expected3 = "";
QTest::newRow("global scope remove in every file")
<< h1 << h2 << h3 << expected1 << expected2 << expected3 << 1;
// test: dont print inline namespaces
h1 = R"--(
namespace test {
inline namespace test {
class Foo{
void foo1();
void foo2();
};
inline int TEST = 42;
}
}
)--";
h2 = R"--(
#include "header1.h"
using namespace tes@t;
)--";
h3 = R"--(
#include "header2.h"
Foo f1;
test::Foo f2;
using T1 = Foo;
using T2 = test::Foo;
int i1 = TEST;
int i2 = test::TEST;
void Foo::foo1(){};
void test::Foo::foo2(){};
)--";
expected1 = h1;
expected2 = R"--(
#include "header1.h"
)--";
expected3 = R"--(
#include "header2.h"
test::Foo f1;
test::Foo f2;
using T1 = test::Foo;
using T2 = test::Foo;
int i1 = test::TEST;
int i2 = test::TEST;
void test::Foo::foo1(){};
void test::Foo::foo2(){};
)--";
QTest::newRow("don't insert inline namespaces")
<< h1 << h2 << h3 << expected1 << expected2 << expected3 << 0;
}
void CppEditorPlugin::test_quickfix_removeUsingNamespace()

View File

@@ -8037,7 +8037,9 @@ private:
const QList<LookupItem> localLookup = m_context.lookup(ast->name->name, scope);
QList<const Name *> longestName;
for (const LookupItem &item : localLookup) {
QList<const Name *> names = m_context.fullyQualifiedName(item.declaration());
QList<const Name *> names
= m_context.fullyQualifiedName(item.declaration(),
LookupContext::HideInlineNamespaces);
if (names.length() > longestName.length())
longestName = names;
}
@@ -8073,8 +8075,9 @@ private:
const QList<LookupItem> lookups = m_context.lookup(wantToLookup, scope);
if (!lookups.empty()) {
QList<const Name *> fullName = m_context.fullyQualifiedName(
lookups.first().declaration());
QList<const Name *> fullName
= m_context.fullyQualifiedName(lookups.first().declaration(),
LookupContext::HideInlineNamespaces);
const int currentNameCount = countNames(wantToLookup);
const bool needNamespace = needMissingNamespaces(std::move(fullName),
currentNameCount);

View File

@@ -1520,9 +1520,6 @@ void DebuggerEnginePrivate::updateState()
const bool detachable = stopped && !isCore;
m_detachAction.setEnabled(detachable);
if (stopped)
QApplication::alert(ICore::dialogParent(), 3000);
updateReverseActions();
const bool canSnapshot = m_engine->hasCapability(SnapshotCapability);

View File

@@ -31,6 +31,14 @@ extend_qtc_plugin(Help
DEFINES HELP_NEW_FILTER_ENGINE
)
set(HELPVIEWER_DEFAULT_BACKEND "litehtml" CACHE STRING "Sets default help viewer backend")
set_property(CACHE HELPVIEWER_DEFAULT_BACKEND PROPERTY STRINGS "litehtml;qtwebengine;textbrowser")
extend_qtc_plugin(Help
CONDITION HELPVIEWER_DEFAULT_BACKEND
DEFINES QTC_DEFAULT_HELPVIEWER_BACKEND="${HELPVIEWER_DEFAULT_BACKEND}"
)
extend_qtc_plugin(Help
CONDITION FWWebKit AND FWAppKit AND Qt5_VERSION VERSION_LESS 6.0.0
FEATURE_INFO "Native WebKit help viewer"

View File

@@ -92,10 +92,6 @@ static const char kLastShownPagesZoomKey[] = "Help/LastShownPagesZoom";
static const char kLastSelectedTabKey[] = "Help/LastSelectedTab";
static const char kViewerBackend[] = "Help/ViewerBackend";
static const char kQtWebEngineBackend[] = "qtwebengine";
static const char kLitehtmlBackend[] = "litehtml";
static const char kTextBrowserBackend[] = "textbrowser";
static const int kDefaultFallbackFontSize = 14;
static QString defaultFallbackFontFamily()
@@ -327,22 +323,17 @@ HelpViewerFactory LocalHelpManager::defaultViewerBackend()
}
if (!backend.isEmpty())
qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData());
const Utils::optional<HelpViewerFactory> webengineFactory = backendForId(kQtWebEngineBackend);
if (webengineFactory)
return *webengineFactory;
const Utils::optional<HelpViewerFactory> litehtmlFactory = backendForId(kLitehtmlBackend);
if (litehtmlFactory)
return *litehtmlFactory;
return backendForId(kTextBrowserBackend).value_or(HelpViewerFactory());
const QVector<HelpViewerFactory> backends = viewerBackends();
return backends.isEmpty() ? HelpViewerFactory() : backends.first();
}
QVector<HelpViewerFactory> LocalHelpManager::viewerBackends()
{
QVector<HelpViewerFactory> result;
#ifdef QTC_LITEHTML_HELPVIEWER
result.append({"litehtml", tr("litehtml"), []() { return new LiteHtmlHelpViewer; }});
#endif
#ifdef QTC_WEBENGINE_HELPVIEWER
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
static bool schemeRegistered = false;
if (!schemeRegistered) {
schemeRegistered = true;
@@ -350,18 +341,21 @@ QVector<HelpViewerFactory> LocalHelpManager::viewerBackends()
scheme.setFlags(QWebEngineUrlScheme::LocalScheme | QWebEngineUrlScheme::LocalAccessAllowed);
QWebEngineUrlScheme::registerScheme(scheme);
}
result.append({"qtwebengine", tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }});
#endif
result.append(
{kQtWebEngineBackend, tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }});
#endif
#ifdef QTC_LITEHTML_HELPVIEWER
result.append({kLitehtmlBackend, tr("litehtml"), []() { return new LiteHtmlHelpViewer; }});
#endif
result.append({"textbrowser", tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }});
#ifdef QTC_MAC_NATIVE_HELPVIEWER
result.append({"native", tr("WebKit"), []() { return new MacWebKitHelpViewer; }});
#endif
result.append(
{kTextBrowserBackend, tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }});
#ifdef QTC_DEFAULT_HELPVIEWER_BACKEND
const int index = Utils::indexOf(result, [](const HelpViewerFactory &f) {
return f.id == QByteArray(QTC_DEFAULT_HELPVIEWER_BACKEND);
});
if (QTC_GUARD(index >= 0)) {
const HelpViewerFactory defaultBackend = result.takeAt(index);
result.prepend(defaultBackend);
}
#endif
return result;
}

View File

@@ -29,6 +29,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <bindingeditor/bindingeditordialog.h>
#include <qmldesignerconstants.h>
#include <metainfo.h>
#include <qmlmodelnodeproxy.h>
@@ -59,6 +60,8 @@ void BindingEditor::registerDeclarativeType()
void BindingEditor::prepareDialog()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_BINDINGEDITOR_OPENED);
if (s_lastBindingEditor)
s_lastBindingEditor->hideWidget();

View File

@@ -116,7 +116,8 @@ public:
pin,
plus,
redo,
rotation,
rotationFill,
rotationOutline,
search,
splitColumns,
splitRows,

View File

@@ -36,6 +36,8 @@
#include <nodelistproperty.h>
#include <rewriterview.h>
#include <nodemetainfo.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <QStandardItemModel>
#include <QMessageBox>
@@ -309,6 +311,8 @@ ModelNode ConnectionModel::getTargetNodeForConnection(const ModelNode &connectio
void ConnectionModel::addConnection()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_CONNECTION_ADDED);
ModelNode rootModelNode = connectionView()->rootModelNode();
if (rootModelNode.isValid() && rootModelNode.metaInfo().isValid()) {

View File

@@ -33,6 +33,8 @@
#include <bindingproperty.h>
#include <rewritingexception.h>
#include <rewritertransaction.h>
#include <qmldesignerplugin.h>
#include <qmldesignerconstants.h>
#include <utils/fileutils.h>
@@ -356,6 +358,8 @@ QStringList DynamicPropertiesModel::possibleTargetProperties(const BindingProper
void DynamicPropertiesModel::addDynamicPropertyForCurrentNode()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_PROPERTY_ADDED);
if (connectionView()->selectedModelNodes().count() == 1) {
const ModelNode modelNode = connectionView()->selectedModelNodes().constFirst();
if (modelNode.isValid()) {

View File

@@ -29,6 +29,9 @@
#include "graphicsview.h"
#include "handleitem.h"
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <QGraphicsSceneMouseEvent>
#include <cmath>
@@ -425,6 +428,19 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
graphicsView()->setZoomY(0.0);
}
void GraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
{
QmlDesignerPlugin::emitUsageStatisticsTime(Constants::EVENT_CURVEDITOR_TIME,
m_usageTimer.elapsed());
QGraphicsScene::focusOutEvent(focusEvent);
}
void GraphicsScene::focusInEvent(QFocusEvent *focusEvent)
{
m_usageTimer.restart();
QGraphicsScene::focusInEvent(focusEvent);
}
GraphicsView *GraphicsScene::graphicsView() const
{
const QList<QGraphicsView *> viewList = views();

View File

@@ -27,6 +27,7 @@
#include "keyframeitem.h"
#include <QElapsedTimer>
#include <QGraphicsScene>
namespace QmlDesigner {
@@ -120,6 +121,10 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private:
using QGraphicsScene::addItem;
@@ -140,6 +145,8 @@ private:
mutable QRectF m_limits;
bool m_doNotMoveItems;
QElapsedTimer m_usageTimer;
};
} // End namespace QmlDesigner.

View File

@@ -30,6 +30,9 @@
#include "nodehints.h"
#include "qmlvisualnode.h"
#include <qmldesignerplugin.h>
#include <qmldesignerconstants.h>
#include <QtCore/qmimedata.h>
#include <QPainter>
@@ -132,4 +135,17 @@ void Edit3DCanvas::dropEvent(QDropEvent *e)
}
}
void Edit3DCanvas::focusOutEvent(QFocusEvent *focusEvent)
{
QmlDesignerPlugin::emitUsageStatisticsTime(Constants::EVENT_3DEDITOR_TIME,
m_usageTimer.elapsed());
QWidget::focusOutEvent(focusEvent);
}
void Edit3DCanvas::focusInEvent(QFocusEvent *focusEvent)
{
m_usageTimer.restart();
QWidget::focusInEvent(focusEvent);
}
}

View File

@@ -29,6 +29,7 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qimage.h>
#include <QtGui/qevent.h>
#include <QTCore/qelapsedtimer.h>
#include <QtCore/qpointer.h>
namespace QmlDesigner {
@@ -57,12 +58,15 @@ protected:
void resizeEvent(QResizeEvent *e) override;
void dragEnterEvent(QDragEnterEvent *e) override;
void dropEvent(QDropEvent *e) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private:
QPointer<Edit3DWidget> m_parent;
QImage m_image;
qint32 m_activeScene = -1;
ItemLibraryEntry m_itemLibraryEntry;
QElapsedTimer m_usageTimer;
};
} // namespace QmlDesigner

View File

@@ -28,6 +28,7 @@
#include "formeditorwidget.h"
#include "formeditoritem.h"
#include <nodehints.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <designersettings.h>
@@ -321,10 +322,21 @@ void FormEditorScene::keyReleaseEvent(QKeyEvent *keyEvent)
currentTool()->keyReleaseEvent(keyEvent);
}
void FormEditorScene::focusOutEvent(QFocusEvent *)
void FormEditorScene::focusOutEvent(QFocusEvent *focusEvent)
{
if (currentTool())
currentTool()->focusLost();
QmlDesignerPlugin::emitUsageStatisticsTime(Constants::EVENT_FORMEDITOR_TIME,
m_usageTimer.elapsed());
QGraphicsScene::focusOutEvent(focusEvent);
}
void FormEditorScene::focusInEvent(QFocusEvent *focusEvent)
{
m_usageTimer.restart();
QGraphicsScene::focusInEvent(focusEvent);
}
FormEditorView *FormEditorScene::editorView() const

View File

@@ -30,6 +30,7 @@
#include <QGraphicsScene>
#include <QPointer>
#include <QHash>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent;
@@ -119,6 +120,7 @@ protected:
void keyReleaseEvent(QKeyEvent *keyEvent) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private:
QList<QGraphicsItem *> removeLayerItems(const QList<QGraphicsItem *> &itemList);
@@ -135,6 +137,7 @@ private:
ModelNode m_dragNode;
bool m_showBoundingRects;
bool m_annotationVisibility;
QElapsedTimer m_usageTimer;
};
} // namespace QmlDesigner

View File

@@ -203,11 +203,11 @@ QCursor RotationController::getRotationCursor() const
const QString fontName = "qtds_propertyIconFont.ttf";
const int cursorSize = 32; //32 is cursor recommended size
QIcon rotationIcon = Utils::StyleHelper::getIconFromIconFont(
QIcon rotationIcon = Utils::StyleHelper::getCursorFromIconFont(
fontName,
Theme::getIconUnicode(Theme::rotation),
cursorSize, cursorSize,
Qt::white);
Theme::getIconUnicode(Theme::rotationFill),
Theme::getIconUnicode(Theme::rotationOutline),
cursorSize, cursorSize);
return QCursor(rotationIcon.pixmap(cursorSize, cursorSize));
}

View File

@@ -28,6 +28,7 @@
#include <rewritingexception.h>
#include <qmldesignerplugin.h>
#include <qmldesignerconstants.h>
namespace QmlDesigner {
@@ -120,6 +121,13 @@ void ImportManagerView::removeImport(const Import &import)
void ImportManagerView::addImport(const Import &import)
{
if (import.isLibraryImport()
&& (import.toImportString().startsWith("QtQuick")
|| import.toImportString().startsWith("SimulinkConnector"))) {
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_IMPORT_ADDED
+ import.toImportString());
}
try {
if (model())
model()->changeImports({import}, {});

View File

@@ -25,6 +25,9 @@
#include "richtexteditorproxy.h"
#include <qmldesignerplugin.h>
#include <qmldesignerconstants.h>
#include <QDialog>
#include <QDialogButtonBox>
#include <QGridLayout>
@@ -67,6 +70,7 @@ void RichTextEditorProxy::registerDeclarativeType()
void RichTextEditorProxy::showWidget()
{
QmlDesignerPlugin::emitUsageStatistics(Constants::EVENT_RICHTEXT_OPENED);
m_dialog->show();
}

View File

@@ -42,6 +42,7 @@
#include <rewritertransaction.h>
#include <rewriterview.h>
#include <viewmanager.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <qmlobjectnode.h>
#include <qmltimelinekeyframegroup.h>
@@ -668,6 +669,19 @@ void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
QGraphicsScene::keyReleaseEvent(keyEvent);
}
void TimelineGraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
{
QmlDesignerPlugin::emitUsageStatisticsTime(Constants::EVENT_TIMELINE_TIME,
m_usageTimer.elapsed());
QGraphicsScene::focusOutEvent(focusEvent);
}
void TimelineGraphicsScene::focusInEvent(QFocusEvent *focusEvent)
{
m_usageTimer.restart();
QGraphicsScene::focusInEvent(focusEvent);
}
void TimelineGraphicsScene::invalidateSections()
{
for (auto child : m_layout->childItems())

View File

@@ -30,6 +30,7 @@
#include <qmltimeline.h>
#include <QElapsedTimer>
#include <QGraphicsScene>
#include <memory>
@@ -193,6 +194,9 @@ protected:
void keyPressEvent(QKeyEvent *keyEvent) override;
void keyReleaseEvent(QKeyEvent *keyEvent) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private:
void copySelectedKeyframes();
void pasteSelectedKeyframes();
@@ -215,6 +219,7 @@ private:
// sorted, unique cache of keyframes positions, used for snapping
QVector<qreal> m_keyframePositionsCache;
QElapsedTimer m_usageTimer;
};
} // namespace QmlDesigner

View File

@@ -45,6 +45,7 @@
#include <rewritertransaction.h>
#include <rewriterview.h>
#include <viewmanager.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <qmlobjectnode.h>
#include <qmltimelinekeyframegroup.h>
@@ -401,6 +402,19 @@ void TransitionEditorGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
QGraphicsScene::keyReleaseEvent(keyEvent);
}
void TransitionEditorGraphicsScene::focusOutEvent(QFocusEvent *focusEvent)
{
QmlDesignerPlugin::emitUsageStatisticsTime(Constants::EVENT_TRANSITIONEDITOR_TIME,
m_usageTimer.elapsed());
QGraphicsScene::focusOutEvent(focusEvent);
}
void TransitionEditorGraphicsScene::focusInEvent(QFocusEvent *focusEvent)
{
m_usageTimer.restart();
QGraphicsScene::focusInEvent(focusEvent);
}
void TransitionEditorGraphicsScene::invalidateSections()
{
const QList<QGraphicsItem *> children = m_layout->childItems();

View File

@@ -30,6 +30,7 @@
#include <qmltimeline.h>
#include <QElapsedTimer>
#include <QGraphicsScene>
#include <memory>
@@ -123,6 +124,9 @@ protected:
void keyPressEvent(QKeyEvent *keyEvent) override;
void keyReleaseEvent(QKeyEvent *keyEvent) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private:
void invalidateSections();
QList<QGraphicsItem *> itemsAt(const QPointF &pos);
@@ -135,6 +139,7 @@ private:
int m_scrollOffset = 0;
TimelineToolDelegate m_tools;
TransitionEditorPropertyItem *m_selectedProperty = nullptr;
QElapsedTimer m_usageTimer;
};
} // namespace QmlDesigner

View File

@@ -80,9 +80,19 @@ const int MODELNODE_PREVIEW_IMAGE_DIMENSIONS = 150;
const char EVENT_TIMELINE_ADDED[] = "Timeline Added";
const char EVENT_TRANSITION_ADDED[] = "Transition Added";
const char EVENT_STATE_ADDED[] = "State Added";
const char EVENT_CONNECTION_ADDED[] = "Connection Added";
const char EVENT_PROPERTY_ADDED[] = "Property Added";
const char EVENT_ANNOTATION_ADDED[] = "Annotation Added";
const char EVENT_RESOURCE_IMPORTED[] = "Resource Imported ";
const char EVENT_ACTION_EXECUTED[] = "Action Executed ";
const char EVENT_IMPORT_ADDED[] = "Import Added ";
const char EVENT_BINDINGEDITOR_OPENED[] = "Binding Editor Opened";
const char EVENT_RICHTEXT_OPENED[] = "Richtext Editor Opened";
const char EVENT_FORMEDITOR_TIME[] = "Form Editor";
const char EVENT_3DEDITOR_TIME[] = "3D Editor";
const char EVENT_TIMELINE_TIME[] = "Timeline";
const char EVENT_TRANSITIONEDITOR_TIME[] = "Transition Editor";
const char EVENT_CURVEDITOR_TIME[] = "Curve Editor";
namespace Internal {
enum { debug = 0 };

View File

@@ -566,6 +566,11 @@ ImageCache &QmlDesignerPlugin::imageCache()
return m_instance->d->viewManager.imageCache();
}
void QmlDesignerPlugin::emitUsageStatisticsTime(const QString &identifier, int elapsed)
{
emit instance()->usageStatisticsUsageTimer(identifier, elapsed);
}
QmlDesignerPlugin *QmlDesignerPlugin::instance()
{
return m_instance;

View File

@@ -85,11 +85,13 @@ public:
static void emitUsageStatistics(const QString &identifier);
static void emitUsageStatisticsContextAction(const QString &identifier);
static void emitUsageStatisticsTime(const QString &identifier, int elapsed);
static ImageCache &imageCache();
signals:
void usageStatisticsNotifier(const QString &identifier);
void usageStatisticsUsageTimer(const QString &identifier, int elapsed);
private: // functions

View File

@@ -502,14 +502,18 @@ static QList<std::pair<Path, FileName>> documentationFiles(BaseQtVersion *v)
static QStringList documentationFiles(const QList<BaseQtVersion *> &vs, bool highestOnly = false)
{
QSet<QString> includedFileNames;
// if highestOnly is true, register each file only once per major Qt version, even if
// multiple minor or patch releases of that major version are installed
QHash<int, QSet<QString>> includedFileNames; // major Qt version -> names
QSet<QString> filePaths;
const QList<BaseQtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
for (BaseQtVersion *v : versions) {
const int majorVersion = v->qtVersion().majorVersion;
QSet<QString> &majorVersionFileNames = includedFileNames[majorVersion];
for (const std::pair<Path, FileName> &file : documentationFiles(v)) {
if (!highestOnly || !includedFileNames.contains(file.second)) {
if (!highestOnly || !majorVersionFileNames.contains(file.second)) {
filePaths.insert(file.first + file.second);
includedFileNames.insert(file.second);
majorVersionFileNames.insert(file.second);
}
}
}