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
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
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)
\li Browse Qt extensions in the \l{https://marketplace.qt.io/}
{Qt Marketplace}
\li Download the Qt Installer
\endif
\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/
**
** This file is part of the Qt Creator documentation.
@@ -76,8 +76,8 @@
\section2 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
you install the Qt for MCUs SDK.
This plugin is enabled automatically by the Qt Installer when you
install Qt for MCUs.
\section2 Specifying MCU Settings

View File

@@ -32,14 +32,18 @@
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
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
\l{Qt for MCUs - All QML Types}{listing of supported QML types} for the
latest state.
are supported at the time of writing.
To develop for MCUs, \l{Using Project Wizards}{create an MCU project}.
Only a subset of properties is supported for the supported types. The
properties that are not available on MCUs are marked in the
\uicontrol Properties view by enclosing them in square brackets.
To develop for MCUs, \l{Using Project Wizards}{create an MCU project}. Only
the types available on MCUs are displayed in the \uicontrol {QML Types} tab
in \uicontrol Library. Only a subset of properties is supported for the
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]
*/

View File

@@ -45,6 +45,11 @@
\l{https://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist}{change logs}
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
\QC contains the following third-party components:

View File

@@ -56,15 +56,16 @@
\section1 Checking Build and Run Settings
\QC is an integrated development environment (IDE) that you can use to
develop Qt applications. While Qt installers typically install \QC,
stand-alone \QC installers never install Qt or any Qt tools, such as qmake.
To use \QC for Qt development, you also need to have a Qt version and a
compiler installed.
develop Qt applications. While you can use the Qt Installer to install \QC,
the stand-alone \QC installer never installs Qt or any Qt tools, such as
qmake. To use \QC for Qt development, you also need to have a Qt version
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
compilers and Qt versions. If they succeed, the relevant kits will
automatically become available in \QC. If they do not, you must add the kits
yourself to tell \QC where everything is.
The Qt Installer attempts to auto-detect the installed compilers and Qt
versions. If it succeeds, the relevant kits will automatically become
available in \QC. If it does not, you must add the kits yourself to tell
\QC where everything is.
To add kits, select \uicontrol Tools > \uicontrol Options >
\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/
**
** This file is part of the Qt Creator documentation.
@@ -42,9 +42,9 @@
specifies the compiler and other necessary tools for building an application
for and running it on a particular platform.
\QC automatically detects the compilers that are registered by your system
or by an installer and lists them in \uicontrol Tools > \uicontrol Options >
\uicontrol Kits > \uicontrol Compilers:
\QC automatically detects the compilers that are registered by your
system or by the Qt Installer and lists them in \uicontrol Tools >
\uicontrol Options > \uicontrol Kits > \uicontrol Compilers:
\image qtcreator-toolchains.png
@@ -59,8 +59,8 @@
\li \MinGW (Minimalist GNU for Windows) is a native software port of GCC
and GNU Binutils for use in the development of native Microsoft
Windows applications on Windows. \MinGW is
distributed together with \QC and Qt installers for Windows.
Windows applications on Windows. \MinGW is distributed together with
\QC and Qt for Windows.
\li ICC (Intel C++ Compiler) is a group of C and C++ compilers.
Only the GCC-compatible variant, available for Linux and \macos,

View File

@@ -43,8 +43,8 @@
\section1 Registering Installed Qt Versions
\QC automatically detects the Qt versions that are registered by
your system or by installers. To view detailed information for each Qt
\QC automatically detects the Qt versions that are registered by your
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
\uicontrol {Qt version for} section.
@@ -137,7 +137,7 @@
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
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.
\section1 Minimum Requirements

View File

@@ -53,6 +53,23 @@
press \key Alt+Shift.
\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
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
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
kit to \QC.
compiling to WebAssembly. The Qt Installer automatically adds a build and
run kit to \QC.
\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,
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
\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
the guidelines for creating and exporting them.

View File

@@ -31,7 +31,7 @@
\title Setting Up \QBPS
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
folder: \c {QtDesignStudio\photoshop_bridge}.

View File

@@ -31,7 +31,7 @@
\title Setting Up \QBSK
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
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
\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
\uicontrol Library \uicontrol {Qt Quick 3D Effects} under the \uicontrol
{View 3D} object in \uicontrol Navigator. You can apply multiple effects to
one component. The effects you add to the project are listed in \uicontrol
Properties > \uicontrol {Scene Environment} > \uicontrol Effect and are
visible in \uicontrol {Form Editor}.
To apply a visual effect to a scene, drag-and-drop an effect from
the \uicontrol {Qt Quick 3D Effects} tab in \uicontrol Library to a
\uicontrol {View 3D} object in \uicontrol Navigator. You can apply multiple
effects to a scene. Select the \uicontrol {Scene Environment} component in
\uicontrol Navigator to view the applied effects in \uicontrol Properties >
\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.
@@ -222,7 +223,11 @@
\li \image effect-fxaa.png "The Fxaa effect"
\li A fast approximate anti-aliasing effect that removes some of the
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
\li Gaussian Blur

View File

@@ -107,34 +107,35 @@ QtObject {
readonly property string pin: "\u0064"
readonly property string plus: "\u0065"
readonly property string redo: "\u0066"
readonly property string rotation: "\u0067"
readonly property string search: "\u0068"
readonly property string splitColumns: "\u0069"
readonly property string splitRows: "\u006A"
readonly property string startNode: "\u006B"
readonly property string testIcon: "\u006C"
readonly property string textAlignBottom: "\u006D"
readonly property string textAlignCenter: "\u006E"
readonly property string textAlignLeft: "\u006F"
readonly property string textAlignMiddle: "\u0070"
readonly property string textAlignRight: "\u0071"
readonly property string textAlignTop: "\u0072"
readonly property string textBulletList: "\u0073"
readonly property string textFullJustification: "\u0074"
readonly property string textNumberedList: "\u0075"
readonly property string tickIcon: "\u0076"
readonly property string triState: "\u0077"
readonly property string undo: "\u0078"
readonly property string unpin: "\u0079"
readonly property string upDownIcon: "\u007A"
readonly property string upDownSquare2: "\u007B"
readonly property string visibilityOff: "\u007C"
readonly property string visibilityOn: "\u007D"
readonly property string wildcard: "\u007E"
readonly property string zoomAll: "\u007F"
readonly property string zoomIn: "\u0080"
readonly property string zoomOut: "\u0081"
readonly property string zoomSelection: "\u0082"
readonly property string rotationFill: "\u0067"
readonly property string rotationOutline: "\u0068"
readonly property string search: "\u0069"
readonly property string splitColumns: "\u006A"
readonly property string splitRows: "\u006B"
readonly property string startNode: "\u006C"
readonly property string testIcon: "\u006D"
readonly property string textAlignBottom: "\u006E"
readonly property string textAlignCenter: "\u006F"
readonly property string textAlignLeft: "\u0070"
readonly property string textAlignMiddle: "\u0071"
readonly property string textAlignRight: "\u0072"
readonly property string textAlignTop: "\u0073"
readonly property string textBulletList: "\u0074"
readonly property string textFullJustification: "\u0075"
readonly property string textNumberedList: "\u0076"
readonly property string tickIcon: "\u0077"
readonly property string triState: "\u0078"
readonly property string undo: "\u0079"
readonly property string unpin: "\u007A"
readonly property string upDownIcon: "\u007B"
readonly property string upDownSquare2: "\u007C"
readonly property string visibilityOff: "\u007D"
readonly property string visibilityOn: "\u007E"
readonly property string wildcard: "\u007F"
readonly property string zoomAll: "\u0080"
readonly property string zoomIn: "\u0081"
readonly property string zoomOut: "\u0082"
readonly property string zoomSelection: "\u0083"
readonly property font iconFont: Qt.font({
"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)
return;
path_helper(symbol->enclosingScope(), names);
path_helper(symbol->enclosingScope(), names, policy);
if (symbol->name()) {
if (symbol->isClass() || symbol->isNamespace()) {
if (policy == LookupContext::HideInlineNamespaces) {
auto ns = symbol->asNamespace();
if (ns && ns->isInline())
return;
}
addNames(symbol->name(), names);
} else if (symbol->isObjCClass() || symbol->isObjCBaseClass() || symbol->isObjCProtocol()
@@ -206,17 +213,17 @@ LookupContext &LookupContext::operator=(const LookupContext &other)
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);
return qualifiedName;
}
QList<const Name *> LookupContext::path(Symbol *symbol)
QList<const Name *> LookupContext::path(Symbol *symbol, InlineNamespacePolicy policy)
{
QList<const Name *> names;
path_helper(symbol, &names);
path_helper(symbol, &names, policy);
return names;
}

View File

@@ -314,8 +314,11 @@ public:
QSharedPointer<CreateBindings> bindings() const
{ return _bindings; }
static QList<const Name *> fullyQualifiedName(Symbol *symbol);
static QList<const Name *> path(Symbol *symbol);
enum InlineNamespacePolicy { ShowInlineNamespaces, HideInlineNamespaces };
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);

View File

@@ -281,7 +281,7 @@ public:
std::function<void()> m_openTerminal;
bool m_readOnly = false;
bool m_undoRedoEnabled = false;
bool m_undoRedoEnabled = true;
bool m_enabled = true;
bool m_showToolTipOnLabel = false;
bool m_fileDialogOnly = false;
@@ -759,8 +759,7 @@ void StringAspect::addToLayout(LayoutBuilder &builder)
d->m_textEditDisplay->setEnabled(d->m_enabled);
d->m_textEditDisplay->setReadOnly(d->m_readOnly);
d->m_textEditDisplay->setUndoRedoEnabled(d->m_undoRedoEnabled);
d->m_textEditDisplay->setTextInteractionFlags
(Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
d->m_textEditDisplay->setTextInteractionFlags(Qt::TextEditorInteraction);
useMacroExpander(d->m_textEditDisplay);
connect(d->m_textEditDisplay, &QTextEdit::textChanged, this, [this] {
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"},
{"urxvt", "", "-e"},
{"xfce4-terminal", "", "-x"},
{"konsole", "--separate", "-e"},
{"konsole", "--separate --workdir .", "-e"},
{"gnome-terminal", "", "--"}
}));

View File

@@ -623,6 +623,58 @@ QIcon StyleHelper::getIconFromIconFont(const QString &fontName, const QString &i
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)
{
// 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 QString &iconSymbol, int fontSize, int iconSize, QColor color);
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 imageFileWithResolution(const QString &fileName, int dpr);

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);
}
}
}