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

@@ -762,3 +762,9 @@ SQLite (https://www.sqlite.org) is in the Public Domain.
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE. OTHER DEALINGS IN THE FONT SOFTWARE.
### Qbs
Qt Creator installations deliver Qbs. Its licensing and third party
attributions are listed in Qbs Manual at
https://doc.qt.io/qbs/attributions.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -56,6 +56,7 @@
\if defined(qtcreator) \if defined(qtcreator)
\li Browse Qt extensions in the \l{https://marketplace.qt.io/} \li Browse Qt extensions in the \l{https://marketplace.qt.io/}
{Qt Marketplace} {Qt Marketplace}
\li Download the Qt Installer
\endif \endif
\li Read news from the online community and Qt blogs \li Read news from the online community and Qt blogs

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -76,8 +76,8 @@
\section2 MCU Plugin \section2 MCU Plugin
To be able to develop applications for MCUs, you need the MCU plugin. To be able to develop applications for MCUs, you need the MCU plugin.
This plugin is enabled automatically by the Qt online installer when This plugin is enabled automatically by the Qt Installer when you
you install the Qt for MCUs SDK. install Qt for MCUs.
\section2 Specifying MCU Settings \section2 Specifying MCU Settings

View File

@@ -32,14 +32,18 @@
types to create UIs for devices that are powered by microcontroller units types to create UIs for devices that are powered by microcontroller units
(MCU). The subset of supported types depends on the Qt for MCUs version (MCU). The subset of supported types depends on the Qt for MCUs version
that you use for development. In this manual, we indicate which components that you use for development. In this manual, we indicate which components
are supported at the time of writing, but you should always check the are supported at the time of writing.
\l{Qt for MCUs - All QML Types}{listing of supported QML types} for the
latest state.
To develop for MCUs, \l{Using Project Wizards}{create an MCU project}. To develop for MCUs, \l{Using Project Wizards}{create an MCU project}. Only
Only a subset of properties is supported for the supported types. The the types available on MCUs are displayed in the \uicontrol {QML Types} tab
properties that are not available on MCUs are marked in the in \uicontrol Library. Only a subset of properties is supported for the
\uicontrol Properties view by enclosing them in square brackets. supported types. The properties that are not available on MCUs are marked
in the \uicontrol Properties view by enclosing them in square brackets.
\image qmldesigner-mcu-support.png "QML types and Image type properties supported for MCUs"
For more information about the supported QML types and their properties, see
\l{Qt for MCUs - All QML Types}.
//! [mcu qtquick components] //! [mcu qtquick components]
*/ */

View File

@@ -45,6 +45,11 @@
\l{https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist}{change logs} \l{https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist}{change logs}
for each release. for each release.
\section1 Qbs
\QC installations deliver Qbs. Its licensing and third party attributions
are listed in \l{https://doc.qt.io/qbs/attributions.html}{Qbs Manual}.
\section1 Third-party Components \section1 Third-party Components
\QC contains the following third-party components: \QC contains the following third-party components:

View File

@@ -56,15 +56,16 @@
\section1 Checking Build and Run Settings \section1 Checking Build and Run Settings
\QC is an integrated development environment (IDE) that you can use to \QC is an integrated development environment (IDE) that you can use to
develop Qt applications. While Qt installers typically install \QC, develop Qt applications. While you can use the Qt Installer to install \QC,
stand-alone \QC installers never install Qt or any Qt tools, such as qmake. the stand-alone \QC installer never installs Qt or any Qt tools, such as
To use \QC for Qt development, you also need to have a Qt version and a qmake. To use \QC for Qt development, you also need to have a Qt version
compiler installed. and a compiler installed. If you update the compiler version later, you
can register it into \QC.
Qt installers, such as SDKs, often attempt to auto-detect the installed The Qt Installer attempts to auto-detect the installed compilers and Qt
compilers and Qt versions. If they succeed, the relevant kits will versions. If it succeeds, the relevant kits will automatically become
automatically become available in \QC. If they do not, you must add the kits available in \QC. If it does not, you must add the kits yourself to tell
yourself to tell \QC where everything is. \QC where everything is.
To add kits, select \uicontrol Tools > \uicontrol Options > To add kits, select \uicontrol Tools > \uicontrol Options >
\uicontrol Kits > \uicontrol Add. \uicontrol Kits > \uicontrol Add.

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -42,9 +42,9 @@
specifies the compiler and other necessary tools for building an application specifies the compiler and other necessary tools for building an application
for and running it on a particular platform. for and running it on a particular platform.
\QC automatically detects the compilers that are registered by your system \QC automatically detects the compilers that are registered by your
or by an installer and lists them in \uicontrol Tools > \uicontrol Options > system or by the Qt Installer and lists them in \uicontrol Tools >
\uicontrol Kits > \uicontrol Compilers: \uicontrol Options > \uicontrol Kits > \uicontrol Compilers:
\image qtcreator-toolchains.png \image qtcreator-toolchains.png
@@ -59,8 +59,8 @@
\li \MinGW (Minimalist GNU for Windows) is a native software port of GCC \li \MinGW (Minimalist GNU for Windows) is a native software port of GCC
and GNU Binutils for use in the development of native Microsoft and GNU Binutils for use in the development of native Microsoft
Windows applications on Windows. \MinGW is Windows applications on Windows. \MinGW is distributed together with
distributed together with \QC and Qt installers for Windows. \QC and Qt for Windows.
\li ICC (Intel C++ Compiler) is a group of C and C++ compilers. \li ICC (Intel C++ Compiler) is a group of C and C++ compilers.
Only the GCC-compatible variant, available for Linux and \macos, Only the GCC-compatible variant, available for Linux and \macos,

View File

@@ -43,8 +43,8 @@
\section1 Registering Installed Qt Versions \section1 Registering Installed Qt Versions
\QC automatically detects the Qt versions that are registered by \QC automatically detects the Qt versions that are registered by your
your system or by installers. To view detailed information for each Qt system or by the Qt Installer. To view detailed information for each Qt
version, select it in the list and select \uicontrol Details in the version, select it in the list and select \uicontrol Details in the
\uicontrol {Qt version for} section. \uicontrol {Qt version for} section.
@@ -137,7 +137,7 @@
output exist. When \QC complains about the installation of a self-built Qt output exist. When \QC complains about the installation of a self-built Qt
version, try running \c {make install} in the build directory to actually version, try running \c {make install} in the build directory to actually
install Qt into the configured location. If you installed Qt using the Qt install Qt into the configured location. If you installed Qt using the Qt
installer, run the Qt maintenance tool to check for updates or to reinstall Installer, run the Qt maintenance tool to check for updates or to reinstall
the Qt version. the Qt version.
\section1 Minimum Requirements \section1 Minimum Requirements

View File

@@ -53,6 +53,23 @@
press \key Alt+Shift. press \key Alt+Shift.
\endif \endif
\section1 Rotating Items
You can use a rotation tool \inlineimage rotate_on.png
in one of the corners of an item to freely rotate
items around their origin in \uicontrol {Form Editor}.
Drag clockwise or counter-clockwise to rotate the item.
\image qtquick-designer-rotating-items.png "2D rotation tool"
Additionally, press \key Shift or \key Alt to rotate items in steps of 5 or
45 degrees, respectively.
You can set the \l{Managing 2D Transformations}{origin} in the
\uicontrol Origin field in the \uicontrol Advanced tab in the
\uicontrol Properties view. There, you can also enter the value
of the \uicontrol Rotation property in degrees.
\section1 Snapping to Parent and Sibling Items \section1 Snapping to Parent and Sibling Items
When you are working on a design, you can use snapping to align When you are working on a design, you can use snapping to align

View File

@@ -65,8 +65,8 @@
\section1 Setting Up the Development Environment \section1 Setting Up the Development Environment
You need to install and configure Qt for WebAssembly and the tool chain for You need to install and configure Qt for WebAssembly and the tool chain for
compiling to WebAssembly. The installer automatically adds a build and run compiling to WebAssembly. The Qt Installer automatically adds a build and
kit to \QC. run kit to \QC.
\section2 Setting Up Qt for WebAssembly \section2 Setting Up Qt for WebAssembly

View File

@@ -37,10 +37,10 @@
the 3D graphics tools to save the assets in widely-used 3D graphics formats, the 3D graphics tools to save the assets in widely-used 3D graphics formats,
and then use \QB to import them into \QDS. and then use \QB to import them into \QDS.
You can use the Qt online installer to install \QB if you have a commercial You can use the Qt Installer to install \QB if you have a commercial
\QDS license. You can also purchase a \QB license separately from the \QDS license. You can also purchase a \QB license separately from the
\l{https://marketplace.qt.io/}{Qt Marketplace} and then install \QB using \l{https://marketplace.qt.io/}{Qt Marketplace} and then install \QB using
the Qt online installer. the Qt Installer.
For best results when importing assets, follow For best results when importing assets, follow
the guidelines for creating and exporting them. the guidelines for creating and exporting them.

View File

@@ -31,7 +31,7 @@
\title Setting Up \QBPS \title Setting Up \QBPS
You can purchase a \QBPS license from the \l{https://marketplace.qt.io/} You can purchase a \QBPS license from the \l{https://marketplace.qt.io/}
{Qt Marketplace}, and then use the Qt online installer to have the \QBPS {Qt Marketplace}, and then use the Qt Installer to have the \QBPS
installation package copied to the following path in your Qt installation installation package copied to the following path in your Qt installation
folder: \c {QtDesignStudio\photoshop_bridge}. folder: \c {QtDesignStudio\photoshop_bridge}.

View File

@@ -31,7 +31,7 @@
\title Setting Up \QBSK \title Setting Up \QBSK
You can purchase a \QBSK license from the \l{https://marketplace.qt.io/} You can purchase a \QBSK license from the \l{https://marketplace.qt.io/}
{Qt Marketplace}, and then use the Qt online installer to have the \QBSK {Qt Marketplace}, and then use the Qt Installer to have the \QBSK
plugin package copied to the following path in your Qt installation plugin package copied to the following path in your Qt installation
folder: \c {QtDesignStudio\sketch_bridge\io.qt.qtbridge.sketchplugin}. folder: \c {QtDesignStudio\sketch_bridge\io.qt.qtbridge.sketchplugin}.

View File

@@ -35,12 +35,13 @@
\QDS provides a set of Qt Quick 3D effects that inherit the types in the \QDS provides a set of Qt Quick 3D effects that inherit the types in the
\l {Qt Quick 3D Effects QML Types}{Qt Quick 3D Effects} module. \l {Qt Quick 3D Effects QML Types}{Qt Quick 3D Effects} module.
To apply a visual effect to a component, drag-and-drop an effect from To apply a visual effect to a scene, drag-and-drop an effect from
\uicontrol Library \uicontrol {Qt Quick 3D Effects} under the \uicontrol the \uicontrol {Qt Quick 3D Effects} tab in \uicontrol Library to a
{View 3D} object in \uicontrol Navigator. You can apply multiple effects to \uicontrol {View 3D} object in \uicontrol Navigator. You can apply multiple
one component. The effects you add to the project are listed in \uicontrol effects to a scene. Select the \uicontrol {Scene Environment} component in
Properties > \uicontrol {Scene Environment} > \uicontrol Effect and are \uicontrol Navigator to view the applied effects in \uicontrol Properties >
visible in \uicontrol {Form Editor}. \uicontrol {Scene Environment} > \uicontrol Effect. The effects are visible
in the \uicontrol {Form Editor} view.
See the following table for available effects and example images. See the following table for available effects and example images.
@@ -222,7 +223,11 @@
\li \image effect-fxaa.png "The Fxaa effect" \li \image effect-fxaa.png "The Fxaa effect"
\li A fast approximate anti-aliasing effect that removes some of the \li A fast approximate anti-aliasing effect that removes some of the
artifacts from the image without impacting performance as heavily as artifacts from the image without impacting performance as heavily as
super-sampling would. super-sampling would. The Fxaa effect is an easy fix for many aliasing
problems. It also works with moving images. However, it should be noted
that this effect can blur and distort fine text details, and as a
screen-space heuristic technique, it can sometimes leave sharp edges
that ideally would be anti-aliased.
\row \row
\li Gaussian Blur \li Gaussian Blur

View File

@@ -107,34 +107,35 @@ QtObject {
readonly property string pin: "\u0064" readonly property string pin: "\u0064"
readonly property string plus: "\u0065" readonly property string plus: "\u0065"
readonly property string redo: "\u0066" readonly property string redo: "\u0066"
readonly property string rotation: "\u0067" readonly property string rotationFill: "\u0067"
readonly property string search: "\u0068" readonly property string rotationOutline: "\u0068"
readonly property string splitColumns: "\u0069" readonly property string search: "\u0069"
readonly property string splitRows: "\u006A" readonly property string splitColumns: "\u006A"
readonly property string startNode: "\u006B" readonly property string splitRows: "\u006B"
readonly property string testIcon: "\u006C" readonly property string startNode: "\u006C"
readonly property string textAlignBottom: "\u006D" readonly property string testIcon: "\u006D"
readonly property string textAlignCenter: "\u006E" readonly property string textAlignBottom: "\u006E"
readonly property string textAlignLeft: "\u006F" readonly property string textAlignCenter: "\u006F"
readonly property string textAlignMiddle: "\u0070" readonly property string textAlignLeft: "\u0070"
readonly property string textAlignRight: "\u0071" readonly property string textAlignMiddle: "\u0071"
readonly property string textAlignTop: "\u0072" readonly property string textAlignRight: "\u0072"
readonly property string textBulletList: "\u0073" readonly property string textAlignTop: "\u0073"
readonly property string textFullJustification: "\u0074" readonly property string textBulletList: "\u0074"
readonly property string textNumberedList: "\u0075" readonly property string textFullJustification: "\u0075"
readonly property string tickIcon: "\u0076" readonly property string textNumberedList: "\u0076"
readonly property string triState: "\u0077" readonly property string tickIcon: "\u0077"
readonly property string undo: "\u0078" readonly property string triState: "\u0078"
readonly property string unpin: "\u0079" readonly property string undo: "\u0079"
readonly property string upDownIcon: "\u007A" readonly property string unpin: "\u007A"
readonly property string upDownSquare2: "\u007B" readonly property string upDownIcon: "\u007B"
readonly property string visibilityOff: "\u007C" readonly property string upDownSquare2: "\u007C"
readonly property string visibilityOn: "\u007D" readonly property string visibilityOff: "\u007D"
readonly property string wildcard: "\u007E" readonly property string visibilityOn: "\u007E"
readonly property string zoomAll: "\u007F" readonly property string wildcard: "\u007F"
readonly property string zoomIn: "\u0080" readonly property string zoomAll: "\u0080"
readonly property string zoomOut: "\u0081" readonly property string zoomIn: "\u0081"
readonly property string zoomSelection: "\u0082" readonly property string zoomOut: "\u0082"
readonly property string zoomSelection: "\u0083"
readonly property font iconFont: Qt.font({ readonly property font iconFont: Qt.font({
"family": controlIcons.name, "family": controlIcons.name,

View File

@@ -60,15 +60,22 @@ static void addNames(const Name *name, QList<const Name *> *names, bool addAllNa
} }
} }
static void path_helper(Symbol *symbol, QList<const Name *> *names) static void path_helper(Symbol *symbol,
QList<const Name *> *names,
LookupContext::InlineNamespacePolicy policy)
{ {
if (! symbol) if (! symbol)
return; return;
path_helper(symbol->enclosingScope(), names); path_helper(symbol->enclosingScope(), names, policy);
if (symbol->name()) { if (symbol->name()) {
if (symbol->isClass() || symbol->isNamespace()) { if (symbol->isClass() || symbol->isNamespace()) {
if (policy == LookupContext::HideInlineNamespaces) {
auto ns = symbol->asNamespace();
if (ns && ns->isInline())
return;
}
addNames(symbol->name(), names); addNames(symbol->name(), names);
} else if (symbol->isObjCClass() || symbol->isObjCBaseClass() || symbol->isObjCProtocol() } else if (symbol->isObjCClass() || symbol->isObjCBaseClass() || symbol->isObjCProtocol()
@@ -206,17 +213,17 @@ LookupContext &LookupContext::operator=(const LookupContext &other)
return *this; return *this;
} }
QList<const Name *> LookupContext::fullyQualifiedName(Symbol *symbol) QList<const Name *> LookupContext::fullyQualifiedName(Symbol *symbol, InlineNamespacePolicy policy)
{ {
QList<const Name *> qualifiedName = path(symbol->enclosingScope()); QList<const Name *> qualifiedName = path(symbol->enclosingScope(), policy);
addNames(symbol->name(), &qualifiedName, /*add all names*/ true); addNames(symbol->name(), &qualifiedName, /*add all names*/ true);
return qualifiedName; return qualifiedName;
} }
QList<const Name *> LookupContext::path(Symbol *symbol) QList<const Name *> LookupContext::path(Symbol *symbol, InlineNamespacePolicy policy)
{ {
QList<const Name *> names; QList<const Name *> names;
path_helper(symbol, &names); path_helper(symbol, &names, policy);
return names; return names;
} }

View File

@@ -314,8 +314,11 @@ public:
QSharedPointer<CreateBindings> bindings() const QSharedPointer<CreateBindings> bindings() const
{ return _bindings; } { return _bindings; }
static QList<const Name *> fullyQualifiedName(Symbol *symbol); enum InlineNamespacePolicy { ShowInlineNamespaces, HideInlineNamespaces };
static QList<const Name *> path(Symbol *symbol); static QList<const Name *> fullyQualifiedName(
Symbol *symbol, InlineNamespacePolicy policy = ShowInlineNamespaces);
static QList<const Name *> path(Symbol *symbol,
InlineNamespacePolicy policy = ShowInlineNamespaces);
static const Name *minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control); static const Name *minimalName(Symbol *symbol, ClassOrNamespace *target, Control *control);

View File

@@ -281,7 +281,7 @@ public:
std::function<void()> m_openTerminal; std::function<void()> m_openTerminal;
bool m_readOnly = false; bool m_readOnly = false;
bool m_undoRedoEnabled = false; bool m_undoRedoEnabled = true;
bool m_enabled = true; bool m_enabled = true;
bool m_showToolTipOnLabel = false; bool m_showToolTipOnLabel = false;
bool m_fileDialogOnly = false; bool m_fileDialogOnly = false;
@@ -759,8 +759,7 @@ void StringAspect::addToLayout(LayoutBuilder &builder)
d->m_textEditDisplay->setEnabled(d->m_enabled); d->m_textEditDisplay->setEnabled(d->m_enabled);
d->m_textEditDisplay->setReadOnly(d->m_readOnly); d->m_textEditDisplay->setReadOnly(d->m_readOnly);
d->m_textEditDisplay->setUndoRedoEnabled(d->m_undoRedoEnabled); d->m_textEditDisplay->setUndoRedoEnabled(d->m_undoRedoEnabled);
d->m_textEditDisplay->setTextInteractionFlags d->m_textEditDisplay->setTextInteractionFlags(Qt::TextEditorInteraction);
(Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
useMacroExpander(d->m_textEditDisplay); useMacroExpander(d->m_textEditDisplay);
connect(d->m_textEditDisplay, &QTextEdit::textChanged, this, [this] { connect(d->m_textEditDisplay, &QTextEdit::textChanged, this, [this] {
const QString value = d->m_textEditDisplay->document()->toPlainText(); const QString value = d->m_textEditDisplay->document()->toPlainText();

View File

@@ -157,7 +157,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QVector<TerminalCommand>, knownTerminals, (
{"rxvt", "", "-e"}, {"rxvt", "", "-e"},
{"urxvt", "", "-e"}, {"urxvt", "", "-e"},
{"xfce4-terminal", "", "-x"}, {"xfce4-terminal", "", "-x"},
{"konsole", "--separate", "-e"}, {"konsole", "--separate --workdir .", "-e"},
{"gnome-terminal", "", "--"} {"gnome-terminal", "", "--"}
})); }));

View File

@@ -623,6 +623,58 @@ QIcon StyleHelper::getIconFromIconFont(const QString &fontName, const QString &i
return getIconFromIconFont(fontName, iconSymbol, fontSize, iconSize, penColor); return getIconFromIconFont(fontName, iconSymbol, fontSize, iconSize, penColor);
} }
QIcon StyleHelper::getCursorFromIconFont(const QString &fontName, const QString &cursorFill, const QString &cursorOutline,
int fontSize, int iconSize)
{
QFontDatabase a;
QTC_ASSERT(a.hasFamily(fontName), {});
const QColor outlineColor = Qt::black;
const QColor fillColor = Qt::white;
if (a.hasFamily(fontName)) {
QIcon icon;
QSize size(iconSize, iconSize);
const int maxDpr = qRound(qApp->devicePixelRatio());
for (int dpr = 1; dpr <= maxDpr; dpr++) {
QPixmap pixmap(size * dpr);
pixmap.setDevicePixelRatio(dpr);
pixmap.fill(Qt::transparent);
QFont font(fontName);
font.setPixelSize(fontSize);
QPainter painter(&pixmap);
painter.save();
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::LosslessImageRendering, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
painter.setFont(font);
painter.setPen(outlineColor);
painter.drawText(QRectF(QPointF(0.0, 0.0), size),
Qt::AlignCenter, cursorOutline);
painter.setPen(fillColor);
painter.drawText(QRectF(QPointF(0.0, 0.0), size),
Qt::AlignCenter, cursorFill);
painter.restore();
icon.addPixmap(pixmap);
}
return icon;
}
return {};
}
QString StyleHelper::dpiSpecificImageFile(const QString &fileName) QString StyleHelper::dpiSpecificImageFile(const QString &fileName)
{ {
// See QIcon::addFile() // See QIcon::addFile()

View File

@@ -125,6 +125,8 @@ public:
static QIcon getIconFromIconFont(const QString &fontName, const QList<IconFontHelper> &parameters); static QIcon getIconFromIconFont(const QString &fontName, const QList<IconFontHelper> &parameters);
static QIcon getIconFromIconFont(const QString &fontName, const QString &iconSymbol, int fontSize, int iconSize, QColor color); static QIcon getIconFromIconFont(const QString &fontName, const QString &iconSymbol, int fontSize, int iconSize, QColor color);
static QIcon getIconFromIconFont(const QString &fontName, const QString &iconSymbol, int fontSize, int iconSize); static QIcon getIconFromIconFont(const QString &fontName, const QString &iconSymbol, int fontSize, int iconSize);
static QIcon getCursorFromIconFont(const QString &fontname, const QString &cursorFill, const QString &cursorOutline,
int fontSize, int iconSize);
static QString dpiSpecificImageFile(const QString &fileName); static QString dpiSpecificImageFile(const QString &fileName);
static QString imageFileWithResolution(const QString &fileName, int dpr); static QString imageFileWithResolution(const QString &fileName, int dpr);

View File

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

View File

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

View File

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

View File

@@ -7422,6 +7422,52 @@ void CppEditorPlugin::test_quickfix_removeUsingNamespace_data()
expected1 = expected2 = expected3 = ""; expected1 = expected2 = expected3 = "";
QTest::newRow("global scope remove in every file") QTest::newRow("global scope remove in every file")
<< h1 << h2 << h3 << expected1 << expected2 << expected3 << 1; << 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() void CppEditorPlugin::test_quickfix_removeUsingNamespace()

View File

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

View File

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

View File

@@ -31,6 +31,14 @@ extend_qtc_plugin(Help
DEFINES HELP_NEW_FILTER_ENGINE 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 extend_qtc_plugin(Help
CONDITION FWWebKit AND FWAppKit AND Qt5_VERSION VERSION_LESS 6.0.0 CONDITION FWWebKit AND FWAppKit AND Qt5_VERSION VERSION_LESS 6.0.0
FEATURE_INFO "Native WebKit help viewer" 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 kLastSelectedTabKey[] = "Help/LastSelectedTab";
static const char kViewerBackend[] = "Help/ViewerBackend"; 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 const int kDefaultFallbackFontSize = 14;
static QString defaultFallbackFontFamily() static QString defaultFallbackFontFamily()
@@ -327,22 +323,17 @@ HelpViewerFactory LocalHelpManager::defaultViewerBackend()
} }
if (!backend.isEmpty()) if (!backend.isEmpty())
qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData()); qWarning("Help viewer backend \"%s\" not found, using default.", backend.constData());
const Utils::optional<HelpViewerFactory> webengineFactory = backendForId(kQtWebEngineBackend); const QVector<HelpViewerFactory> backends = viewerBackends();
if (webengineFactory) return backends.isEmpty() ? HelpViewerFactory() : backends.first();
return *webengineFactory;
const Utils::optional<HelpViewerFactory> litehtmlFactory = backendForId(kLitehtmlBackend);
if (litehtmlFactory)
return *litehtmlFactory;
return backendForId(kTextBrowserBackend).value_or(HelpViewerFactory());
} }
QVector<HelpViewerFactory> LocalHelpManager::viewerBackends() QVector<HelpViewerFactory> LocalHelpManager::viewerBackends()
{ {
QVector<HelpViewerFactory> result; QVector<HelpViewerFactory> result;
#ifdef QTC_LITEHTML_HELPVIEWER
result.append({"litehtml", tr("litehtml"), []() { return new LiteHtmlHelpViewer; }});
#endif
#ifdef QTC_WEBENGINE_HELPVIEWER #ifdef QTC_WEBENGINE_HELPVIEWER
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
static bool schemeRegistered = false; static bool schemeRegistered = false;
if (!schemeRegistered) { if (!schemeRegistered) {
schemeRegistered = true; schemeRegistered = true;
@@ -350,18 +341,21 @@ QVector<HelpViewerFactory> LocalHelpManager::viewerBackends()
scheme.setFlags(QWebEngineUrlScheme::LocalScheme | QWebEngineUrlScheme::LocalAccessAllowed); scheme.setFlags(QWebEngineUrlScheme::LocalScheme | QWebEngineUrlScheme::LocalAccessAllowed);
QWebEngineUrlScheme::registerScheme(scheme); QWebEngineUrlScheme::registerScheme(scheme);
} }
result.append({"qtwebengine", tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }});
#endif #endif
result.append( result.append({"textbrowser", tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }});
{kQtWebEngineBackend, tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }});
#endif
#ifdef QTC_LITEHTML_HELPVIEWER
result.append({kLitehtmlBackend, tr("litehtml"), []() { return new LiteHtmlHelpViewer; }});
#endif
#ifdef QTC_MAC_NATIVE_HELPVIEWER #ifdef QTC_MAC_NATIVE_HELPVIEWER
result.append({"native", tr("WebKit"), []() { return new MacWebKitHelpViewer; }}); result.append({"native", tr("WebKit"), []() { return new MacWebKitHelpViewer; }});
#endif #endif
result.append( #ifdef QTC_DEFAULT_HELPVIEWER_BACKEND
{kTextBrowserBackend, tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }}); 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; return result;
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,6 +29,9 @@
#include "graphicsview.h" #include "graphicsview.h"
#include "handleitem.h" #include "handleitem.h"
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <cmath> #include <cmath>
@@ -425,6 +428,19 @@ void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
graphicsView()->setZoomY(0.0); 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 GraphicsView *GraphicsScene::graphicsView() const
{ {
const QList<QGraphicsView *> viewList = views(); const QList<QGraphicsView *> viewList = views();

View File

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

View File

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

View File

@@ -28,6 +28,7 @@
#include "formeditorwidget.h" #include "formeditorwidget.h"
#include "formeditoritem.h" #include "formeditoritem.h"
#include <nodehints.h> #include <nodehints.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <designersettings.h> #include <designersettings.h>
@@ -321,10 +322,21 @@ void FormEditorScene::keyReleaseEvent(QKeyEvent *keyEvent)
currentTool()->keyReleaseEvent(keyEvent); currentTool()->keyReleaseEvent(keyEvent);
} }
void FormEditorScene::focusOutEvent(QFocusEvent *) void FormEditorScene::focusOutEvent(QFocusEvent *focusEvent)
{ {
if (currentTool()) if (currentTool())
currentTool()->focusLost(); 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 FormEditorView *FormEditorScene::editorView() const

View File

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

View File

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

View File

@@ -28,6 +28,7 @@
#include <rewritingexception.h> #include <rewritingexception.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <qmldesignerconstants.h>
namespace QmlDesigner { namespace QmlDesigner {
@@ -120,6 +121,13 @@ void ImportManagerView::removeImport(const Import &import)
void ImportManagerView::addImport(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 { try {
if (model()) if (model())
model()->changeImports({import}, {}); model()->changeImports({import}, {});

View File

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

View File

@@ -42,6 +42,7 @@
#include <rewritertransaction.h> #include <rewritertransaction.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <viewmanager.h> #include <viewmanager.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <qmlobjectnode.h> #include <qmlobjectnode.h>
#include <qmltimelinekeyframegroup.h> #include <qmltimelinekeyframegroup.h>
@@ -668,6 +669,19 @@ void TimelineGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
QGraphicsScene::keyReleaseEvent(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() void TimelineGraphicsScene::invalidateSections()
{ {
for (auto child : m_layout->childItems()) for (auto child : m_layout->childItems())

View File

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

View File

@@ -45,6 +45,7 @@
#include <rewritertransaction.h> #include <rewritertransaction.h>
#include <rewriterview.h> #include <rewriterview.h>
#include <viewmanager.h> #include <viewmanager.h>
#include <qmldesignerconstants.h>
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <qmlobjectnode.h> #include <qmlobjectnode.h>
#include <qmltimelinekeyframegroup.h> #include <qmltimelinekeyframegroup.h>
@@ -401,6 +402,19 @@ void TransitionEditorGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
QGraphicsScene::keyReleaseEvent(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() void TransitionEditorGraphicsScene::invalidateSections()
{ {
const QList<QGraphicsItem *> children = m_layout->childItems(); const QList<QGraphicsItem *> children = m_layout->childItems();

View File

@@ -30,6 +30,7 @@
#include <qmltimeline.h> #include <qmltimeline.h>
#include <QElapsedTimer>
#include <QGraphicsScene> #include <QGraphicsScene>
#include <memory> #include <memory>
@@ -123,6 +124,9 @@ protected:
void keyPressEvent(QKeyEvent *keyEvent) override; void keyPressEvent(QKeyEvent *keyEvent) override;
void keyReleaseEvent(QKeyEvent *keyEvent) override; void keyReleaseEvent(QKeyEvent *keyEvent) override;
void focusOutEvent(QFocusEvent *focusEvent) override;
void focusInEvent(QFocusEvent *focusEvent) override;
private: private:
void invalidateSections(); void invalidateSections();
QList<QGraphicsItem *> itemsAt(const QPointF &pos); QList<QGraphicsItem *> itemsAt(const QPointF &pos);
@@ -135,6 +139,7 @@ private:
int m_scrollOffset = 0; int m_scrollOffset = 0;
TimelineToolDelegate m_tools; TimelineToolDelegate m_tools;
TransitionEditorPropertyItem *m_selectedProperty = nullptr; TransitionEditorPropertyItem *m_selectedProperty = nullptr;
QElapsedTimer m_usageTimer;
}; };
} // namespace QmlDesigner } // 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_TIMELINE_ADDED[] = "Timeline Added";
const char EVENT_TRANSITION_ADDED[] = "Transition Added"; const char EVENT_TRANSITION_ADDED[] = "Transition Added";
const char EVENT_STATE_ADDED[] = "State 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_ANNOTATION_ADDED[] = "Annotation Added";
const char EVENT_RESOURCE_IMPORTED[] = "Resource Imported "; const char EVENT_RESOURCE_IMPORTED[] = "Resource Imported ";
const char EVENT_ACTION_EXECUTED[] = "Action Executed "; 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 { namespace Internal {
enum { debug = 0 }; enum { debug = 0 };

View File

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

View File

@@ -85,11 +85,13 @@ public:
static void emitUsageStatistics(const QString &identifier); static void emitUsageStatistics(const QString &identifier);
static void emitUsageStatisticsContextAction(const QString &identifier); static void emitUsageStatisticsContextAction(const QString &identifier);
static void emitUsageStatisticsTime(const QString &identifier, int elapsed);
static ImageCache &imageCache(); static ImageCache &imageCache();
signals: signals:
void usageStatisticsNotifier(const QString &identifier); void usageStatisticsNotifier(const QString &identifier);
void usageStatisticsUsageTimer(const QString &identifier, int elapsed);
private: // functions 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) 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; QSet<QString> filePaths;
const QList<BaseQtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs; const QList<BaseQtVersion *> versions = highestOnly ? QtVersionManager::sortVersions(vs) : vs;
for (BaseQtVersion *v : versions) { for (BaseQtVersion *v : versions) {
const int majorVersion = v->qtVersion().majorVersion;
QSet<QString> &majorVersionFileNames = includedFileNames[majorVersion];
for (const std::pair<Path, FileName> &file : documentationFiles(v)) { 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); filePaths.insert(file.first + file.second);
includedFileNames.insert(file.second); majorVersionFileNames.insert(file.second);
} }
} }
} }