Merge remote-tracking branch 'origin/4.14' into master

Conflicts:
	src/plugins/cppeditor/cppquickfix_test.cpp

Change-Id: Ib2984a3b3d9d071d11304b6cf132c2f8cef77e1c
This commit is contained in:
Eike Ziller
2020-10-19 15:22:37 +02:00
247 changed files with 6131 additions and 705 deletions

View File

@@ -0,0 +1,79 @@
# create_python_xy function will precompile the Python/lib/*.py files
# and create a zip file containing all the pyc files
function(create_python_xy PythonExe PythonZipFilePath)
get_filename_component(python_lib_dir "${PythonExe}" DIRECTORY)
get_filename_component(python_lib_dir "${python_lib_dir}/Lib" ABSOLUTE)
foreach(dir collections encodings importlib json urllib)
file(COPY ${python_lib_dir}/${dir}
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python-lib
FILES_MATCHING PATTERN "*.py"
)
endforeach()
file(GLOB python_lib_files "${python_lib_dir}/*.py")
foreach(not_needed
aifc.py imghdr.py socket.py
antigravity.py imp.py socketserver.py
argparse.py ipaddress.py ssl.py
asynchat.py locale.py statistics.py
asyncore.py lzma.py string.py
bdb.py mailbox.py stringprep.py
binhex.py mailcap.py sunau.py
bisect.py mimetypes.py symbol.py
bz2.py modulefinder.py symtable.py
calendar.py netrc.py tabnanny.py
cgi.py nntplib.py tarfile.py
cgitb.py nturl2path.py telnetlib.py
chunk.py numbers.py tempfile.py
cmd.py optparse.py textwrap.py
code.py pathlib.py this.py
codeop.py pdb.py timeit.py
colorsys.py pickle.py trace.py
compileall.py pickletools.py tracemalloc.py
configparser.py pipes.py tty.py
contextvars.py plistlib.py turtle.py
cProfile.py poplib.py typing.py
crypt.py pprint.py uu.py
csv.py profile.py uuid.py
dataclasses.py pstats.py wave.py
datetime.py pty.py webbrowser.py
decimal.py pyclbr.py xdrlib.py
difflib.py py_compile.py zipapp.py
doctest.py queue.py zipfile.py
dummy_threading.py quopri.py zipimport.py
filecmp.py random.py _compat_pickle.py
fileinput.py rlcompleter.py _compression.py
formatter.py runpy.py _dummy_thread.py
fractions.py sched.py _markupbase.py
ftplib.py secrets.py _osx_support.py
getopt.py selectors.py _pydecimal.py
getpass.py shelve.py _pyio.py
gettext.py shlex.py _py_abc.py
gzip.py shutil.py _strptime.py
hashlib.py smtpd.py _threading_local.py
hmac.py smtplib.py __future__.py
imaplib.py sndhdr.py __phello__.foo.py
)
list(FIND python_lib_files "${python_lib_dir}/${not_needed}" found_not_needed)
if (NOT found_not_needed STREQUAL "-1")
list(REMOVE_AT python_lib_files ${found_not_needed})
endif()
endforeach()
file(COPY ${python_lib_files} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/python-lib")
set(ENV{PYTHONOPTIMIZE} "2")
execute_process(
COMMAND "${PythonExe}" -OO -m compileall "${CMAKE_CURRENT_BINARY_DIR}/python-lib" -b
)
file(GLOB_RECURSE python_lib_files "${CMAKE_CURRENT_BINARY_DIR}/python-lib/*.py")
file(REMOVE ${python_lib_files})
file(GLOB_RECURSE python_lib_files LIST_DIRECTORIES ON "${CMAKE_CURRENT_BINARY_DIR}/python-lib/*/__pycache__$")
file(REMOVE_RECURSE ${python_lib_files})
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar cf "${PythonZipFilePath}" . --format=zip
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/python-lib/"
)
endfunction()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -52,18 +52,26 @@
the parameter that you are adding: \uicontrol Boolean, \uicontrol String,
\uicontrol Directory, or \uicontrol File.
To change the type of the selected parameter, select
To change the type of the selected parameter, right-click the
parameter name in the \uicontrol Key column, and then select
\uicontrol {Force to bool}, \uicontrol {Force to file},
\uicontrol {Force to directory}, or \uicontrol {Force to string}.
\uicontrol {Force to directory}, or \uicontrol {Force to string}
in the context menu.
To modify the value of a parameter, double-click it, or select it,
and then select \uicontrol Edit. To save the changes, select
\uicontrol {Apply Configuration Changes}. Keep in mind that a
configuration change might trigger a follow-up configuration change.
and then select \uicontrol Edit.
To remove a parameter, select \uicontrol Unset.
You can apply actions to multiple parameters at a time. To clear
the selection, select \uicontrol {Clear Selection}.
To reset the changes that you made, select \uicontrol Reset.
To remove the selected parameters, select \uicontrol Unset. To undo
the removal, select \uicontrol Set.
To reset all the changes that you made, select \uicontrol Reset.
To save the changes, select \uicontrol {Apply Configuration Changes}.
Keep in mind that a configuration change might trigger a follow-up
configuration change.
The parameter values that you change are passed via \c -D<option>=<value>
to CMake, which stores the options in the CMakeCache.txt file. This means

View File

@@ -151,8 +151,19 @@ public:
qint32 nodeId = -1;
};
CapturedDataCommand() = default;
CapturedDataCommand(QVector<StateData> &&stateData)
: stateData{std::move(stateData)}
{}
CapturedDataCommand(QImage &&image)
: image{std::move(image)}
{}
friend QDataStream &operator<<(QDataStream &out, const CapturedDataCommand &command)
{
out << command.image;
out << command.stateData;
return out;
@@ -160,12 +171,14 @@ public:
friend QDataStream &operator>>(QDataStream &in, CapturedDataCommand &command)
{
in >> command.image;
in >> command.stateData;
return in;
}
public:
QImage image;
QVector<StateData> stateData;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -86,6 +86,7 @@ public:
virtual void requestModelNodePreviewImage(const RequestModelNodePreviewImageCommand &command) = 0;
virtual void changeLanguage(const ChangeLanguageCommand &command) = 0;
virtual void changePreviewImageSize(const ChangePreviewImageSizeCommand &command) = 0;
virtual void dispatchCommand(const QVariant &) {}
virtual void benchmark(const QString &) {}

View File

@@ -9,6 +9,7 @@ HEADERS += $$PWD/qt5nodeinstanceserver.h \
$$PWD/capturenodeinstanceserverdispatcher.h \
$$PWD/capturescenecreatedcommand.h \
$$PWD/nodeinstanceserverdispatcher.h \
$$PWD/qt5captureimagenodeinstanceserver.h \
$$PWD/qt5capturepreviewnodeinstanceserver.h \
$$PWD/qt5testnodeinstanceserver.h \
$$PWD/qt5informationnodeinstanceserver.h \
@@ -33,11 +34,13 @@ HEADERS += $$PWD/qt5nodeinstanceserver.h \
$$PWD/layoutnodeinstance.h \
$$PWD/qt3dpresentationnodeinstance.h \
$$PWD/quick3dnodeinstance.h \
$$PWD/quick3dtexturenodeinstance.h
$$PWD/quick3dtexturenodeinstance.h \
SOURCES += $$PWD/qt5nodeinstanceserver.cpp \
$$PWD/capturenodeinstanceserverdispatcher.cpp \
$$PWD/nodeinstanceserverdispatcher.cpp \
$$PWD/qt5captureimagenodeinstanceserver.cpp \
$$PWD/qt5capturepreviewnodeinstanceserver.cpp \
$$PWD/qt5testnodeinstanceserver.cpp \
$$PWD/qt5informationnodeinstanceserver.cpp \

View File

@@ -72,22 +72,23 @@
#include <requestmodelnodepreviewimagecommand.h>
#include <changelanguagecommand.h>
#include <designersupportdelegate.h>
#include <QAbstractAnimation>
#include <QDebug>
#include <QQmlEngine>
#include <QQmlApplicationEngine>
#include <QFileSystemWatcher>
#include <QUrl>
#include <QSet>
#include <QDir>
#include <QVariant>
#include <QFileSystemWatcher>
#include <QMetaType>
#include <QMutableVectorIterator>
#include <QQmlApplicationEngine>
#include <QQmlComponent>
#include <QQmlContext>
#include <qqmllist.h>
#include <QAbstractAnimation>
#include <QQmlEngine>
#include <QQuickItemGrabResult>
#include <QQuickView>
#include <QSet>
#include <designersupportdelegate.h>
#include <QUrl>
#include <QVariant>
#include <qqmllist.h>
#include <algorithm>
@@ -1461,4 +1462,19 @@ void NodeInstanceServer::disableTimer()
m_timerMode = TimerMode::DisableTimer;
}
void NodeInstanceServer::sheduleRootItemRender()
{
QSharedPointer<QQuickItemGrabResult> result = m_rootNodeInstance.createGrabResult();
qint32 instanceId = m_rootNodeInstance.instanceId();
if (result) {
connect(result.data(), &QQuickItemGrabResult::ready, [this, result, instanceId] {
QVector<ImageContainer> imageVector;
ImageContainer container(instanceId, result->image(), instanceId);
imageVector.append(container);
nodeInstanceClient()->pixmapChanged(PixmapChangedCommand(imageVector));
});
}
}
} // namespace QmlDesigner

View File

@@ -241,6 +241,8 @@ protected:
ComponentCompletedCommand createComponentCompletedCommand(const QList<ServerNodeInstance> &instanceList);
ChangeSelectionCommand createChangeSelectionCommand(const QList<ServerNodeInstance> &instanceList);
void sheduleRootItemRender();
void addChangedProperty(const InstancePropertyPair &property);
virtual void startRenderTimer();

View File

@@ -25,6 +25,7 @@
#include "nodeinstanceserverdispatcher.h"
#include "qt5captureimagenodeinstanceserver.h"
#include "qt5capturepreviewnodeinstanceserver.h"
#include "qt5informationnodeinstanceserver.h"
#include "qt5rendernodeinstanceserver.h"
@@ -183,6 +184,8 @@ std::unique_ptr<NodeInstanceServer> createNodeInstanceServer(
{
if (serverName == "capturemode")
return std::make_unique<Qt5CapturePreviewNodeInstanceServer>(nodeInstanceClient);
else if (serverName == "captureiconmode")
return std::make_unique<Qt5CaptureImageNodeInstanceServer>(nodeInstanceClient);
else if (serverName == "rendermode")
return std::make_unique<Qt5RenderNodeInstanceServer>(nodeInstanceClient);
else if (serverName == "editormode")

View File

@@ -908,6 +908,11 @@ QImage ObjectNodeInstance::renderPreviewImage(const QSize & /*previewImageSize*/
return QImage();
}
QSharedPointer<QQuickItemGrabResult> ObjectNodeInstance::createGrabResult() const
{
return {};
}
QObject *ObjectNodeInstance::parent() const
{
if (!object())

View File

@@ -84,6 +84,8 @@ public:
virtual QImage renderImage() const;
virtual QImage renderPreviewImage(const QSize &previewImageSize) const;
virtual QSharedPointer<QQuickItemGrabResult> createGrabResult() const;
virtual QObject *parent() const;
Pointer parentInstance() const;

View File

@@ -0,0 +1,84 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qt5captureimagenodeinstanceserver.h"
#include "servernodeinstance.h"
#include <captureddatacommand.h>
#include <createscenecommand.h>
#include <nodeinstanceclientinterface.h>
#include <QImage>
#include <QQuickItem>
#include <QQuickView>
namespace QmlDesigner {
namespace {
QImage renderImage(ServerNodeInstance rootNodeInstance)
{
rootNodeInstance.updateDirtyNodeRecursive();
QSize previewImageSize = rootNodeInstance.boundingRect().size().toSize();
if (previewImageSize.isEmpty())
previewImageSize = {640, 480};
if (previewImageSize.width() > 800 || previewImageSize.height() > 800)
previewImageSize.scale({800, 800}, Qt::KeepAspectRatio);
QImage previewImage = rootNodeInstance.renderPreviewImage(previewImageSize);
return previewImage;
}
} // namespace
void Qt5CaptureImageNodeInstanceServer::collectItemChangesAndSendChangeCommands()
{
static bool inFunction = false;
if (!rootNodeInstance().holdsGraphical()) {
nodeInstanceClient()->capturedData(CapturedDataCommand{});
return;
}
if (!inFunction) {
inFunction = true;
auto rooNodeInstance = rootNodeInstance();
rooNodeInstance.rootQuickItem()->setClip(true);
DesignerSupport::polishItems(quickView());
QImage image = renderImage(rooNodeInstance);
nodeInstanceClient()->capturedData(CapturedDataCommand{std::move(image)});
slowDownRenderTimer();
inFunction = false;
}
}
} // namespace

View File

@@ -0,0 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <qt5previewnodeinstanceserver.h>
namespace QmlDesigner {
class Qt5CaptureImageNodeInstanceServer : public Qt5PreviewNodeInstanceServer
{
public:
explicit Qt5CaptureImageNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
: Qt5PreviewNodeInstanceServer(nodeInstanceClient)
{}
protected:
void collectItemChangesAndSendChangeCommands() override;
private:
};
} // namespace QmlDesigner

View File

@@ -100,7 +100,7 @@ void Qt5CapturePreviewNodeInstanceServer::collectItemChangesAndSendChangeCommand
stateInstance.deactivateState();
}
nodeInstanceClient()->capturedData(CapturedDataCommand{stateDatas});
nodeInstanceClient()->capturedData(CapturedDataCommand{std::move(stateDatas)});
slowDownRenderTimer();
inFunction = false;

View File

@@ -101,6 +101,30 @@ static QVariant objectToVariant(QObject *object)
return QVariant::fromValue(object);
}
static QImage nonVisualComponentPreviewImage()
{
static double ratio = qgetenv("FORMEDITOR_DEVICE_PIXEL_RATIO").toDouble();
if (ratio == 1.) {
static const QImage image(":/qtquickplugin/images/non-visual-component.png");
return image;
} else {
static const QImage image(":/qtquickplugin/images/non-visual-component@2x.png");
return image;
}
}
static bool imageHasContent(const QImage &image)
{
// Check if any image pixel contains non-zero data
const uchar *pData = image.constBits();
const qsizetype size = image.sizeInBytes();
for (qsizetype i = 0; i < size; ++i) {
if (*(pData++) != 0)
return true;
}
return false;
}
QQuickView *Qt5InformationNodeInstanceServer::createAuxiliaryQuickView(const QUrl &url,
QQuickItem *&rootItem)
{
@@ -556,7 +580,7 @@ void Qt5InformationNodeInstanceServer::doRenderModelNode3DImageView()
ServerNodeInstance instance = instanceForId(m_modelNodePreviewImageCommand.instanceId());
instanceObj = instance.internalObject();
}
QSize renderSize = m_modelNodePreviewImageCommand.size() * 2;
QSize renderSize = m_modelNodePreviewImageCommand.size();
QMetaObject::invokeMethod(m_ModelNode3DImageViewRootItem, "createViewForObject",
Q_ARG(QVariant, objectToVariant(instanceObj)),
@@ -652,7 +676,7 @@ void Qt5InformationNodeInstanceServer::doRenderModelNode2DImageView()
// Some component may expect to always be shown at certain size, so their layouts may
// not support scaling, so let's always render at the default size if item has one and
// scale the resulting image instead.
QSize finalSize = m_modelNodePreviewImageCommand.size() * 2;
QSize finalSize = m_modelNodePreviewImageCommand.size();
QRectF renderRect = itemBoundingRect(instanceItem);
QSize renderSize = renderRect.size().toSize();
if (renderSize.isEmpty()) {
@@ -665,6 +689,9 @@ void Qt5InformationNodeInstanceServer::doRenderModelNode2DImageView()
renderImage = designerSupport()->renderImageForItem(m_ModelNode2DImageViewContentItem, renderRect, renderSize);
if (!imageHasContent(renderImage))
renderImage = nonVisualComponentPreviewImage();
if (renderSize != finalSize)
renderImage = renderImage.scaled(finalSize, Qt::KeepAspectRatio);

View File

@@ -28,11 +28,13 @@
#include <QCoreApplication>
#include "capturenodeinstanceserverdispatcher.h"
#include "qt5captureimagenodeinstanceserver.h"
#include "qt5capturepreviewnodeinstanceserver.h"
#include "qt5informationnodeinstanceserver.h"
#include "qt5previewnodeinstanceserver.h"
#include "qt5rendernodeinstanceserver.h"
#include "qt5testnodeinstanceserver.h"
#include "quickitemnodeinstance.h"
#include <designersupportdelegate.h>
@@ -56,7 +58,19 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
NodeInstanceClientProxy(parent)
{
prioritizeDown();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const bool qt6 = false;
#else
const bool qt6 = true;
#endif
const bool unifiedRenderPath = qt6 || qEnvironmentVariableIsSet("QMLPUPPET_UNIFIED_RENDER_PATH");
if (unifiedRenderPath)
Internal::QuickItemNodeInstance::enableUnifiedRenderPath(true);
else
DesignerSupport::activateDesignerWindowManager();
if (QCoreApplication::arguments().at(1) == QLatin1String("--readcapturedstream")) {
qputenv("DESIGNER_DONT_USE_SHARED_MEMORY", "1");
setNodeInstanceServer(std::make_unique<Qt5TestNodeInstanceServer>(this));
@@ -79,6 +93,9 @@ Qt5NodeInstanceClientProxy::Qt5NodeInstanceClientProxy(QObject *parent) :
} else if (QCoreApplication::arguments().at(2) == QLatin1String("capturemode")) {
setNodeInstanceServer(std::make_unique<Qt5CapturePreviewNodeInstanceServer>(this));
initializeSocket();
} else if (QCoreApplication::arguments().at(2) == QLatin1String("captureiconmode")) {
setNodeInstanceServer(std::make_unique<Qt5CaptureImageNodeInstanceServer>(this));
initializeSocket();
}
}

View File

@@ -64,6 +64,8 @@ void Qt5NodeInstanceServer::initializeView()
m_quickView = new QQuickView;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/* enables grab window without show */
QSurfaceFormat surfaceFormat = m_quickView->requestedFormat();
surfaceFormat.setVersion(4, 1);
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
@@ -72,6 +74,7 @@ void Qt5NodeInstanceServer::initializeView()
m_quickView->setFormat(surfaceFormat);
DesignerSupport::createOpenGLContext(m_quickView.data());
#endif
if (qEnvironmentVariableIsSet("QML_FILE_SELECTORS")) {
QQmlFileSelector *fileSelector = new QQmlFileSelector(engine(), engine());

View File

@@ -87,16 +87,26 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
if (ancestorInstance.isValid())
m_dirtyInstanceSet.insert(ancestorInstance);
}
DesignerSupport::updateDirtyNode(item);
Internal::QuickItemNodeInstance::updateDirtyNode(item);
}
}
clearChangedPropertyList();
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
/* QQuickItem::grabToImage render path */
/* TODO implement QQuickItem::grabToImage based rendering */
/* sheduleRootItemRender(); */
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()}));
} else {
if (!m_dirtyInstanceSet.isEmpty()) {
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(QtHelpers::toList(m_dirtyInstanceSet)));
nodeInstanceClient()->pixmapChanged(
createPixmapChangedCommand(QtHelpers::toList(m_dirtyInstanceSet)));
m_dirtyInstanceSet.clear();
}
}
m_dirtyInstanceSet.clear();
resetAllItems();
@@ -137,6 +147,11 @@ void Qt5RenderNodeInstanceServer::createScene(const CreateSceneCommand &command)
}
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(instanceList));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#else
quickView()->show();
#endif
}
void Qt5RenderNodeInstanceServer::clearScene(const ClearSceneCommand &command)

View File

@@ -41,6 +41,7 @@ namespace QmlDesigner {
namespace Internal {
bool QuickItemNodeInstance::s_createEffectItem = false;
bool QuickItemNodeInstance::s_unifiedRenderPath = false;
QuickItemNodeInstance::QuickItemNodeInstance(QQuickItem *item)
: ObjectNodeInstance(item),
@@ -58,7 +59,7 @@ QuickItemNodeInstance::QuickItemNodeInstance(QQuickItem *item)
QuickItemNodeInstance::~QuickItemNodeInstance()
{
if (quickItem())
if (quickItem() && checkIfRefFromEffect(instanceId()))
designerSupport()->derefFromEffectItem(quickItem());
}
@@ -156,6 +157,19 @@ void QuickItemNodeInstance::createEffectItem(bool createEffectItem)
s_createEffectItem = createEffectItem;
}
void QuickItemNodeInstance::enableUnifiedRenderPath(bool unifiedRenderPath)
{
s_unifiedRenderPath = unifiedRenderPath;
}
bool QuickItemNodeInstance::checkIfRefFromEffect(qint32 id)
{
if (s_unifiedRenderPath)
return false;
return (s_createEffectItem || id == 0);
}
void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags)
{
@@ -166,10 +180,10 @@ void QuickItemNodeInstance::initialize(const ObjectNodeInstance::Pointer &object
quickItem()->setParentItem(qobject_cast<QQuickItem*>(nodeInstanceServer()->quickView()->rootObject()));
}
if (quickItem()->window()) {
if (s_createEffectItem || instanceId() == 0)
if (quickItem()->window() && checkIfRefFromEffect(instanceId())) {
designerSupport()->refFromEffectItem(quickItem(),
!flags.testFlag(InstanceContainer::ParentTakesOverRendering));
!flags.testFlag(
InstanceContainer::ParentTakesOverRendering));
}
ObjectNodeInstance::initialize(objectNodeInstance, flags);
@@ -246,6 +260,20 @@ QStringList QuickItemNodeInstance::allStates() const
return list;
}
void QuickItemNodeInstance::updateDirtyNode(QQuickItem *item)
{
if (s_unifiedRenderPath) {
item->update();
return;
}
DesignerSupport::updateDirtyNode(item);
}
bool QuickItemNodeInstance::unifiedRenderPath()
{
return s_unifiedRenderPath;
}
QRectF QuickItemNodeInstance::contentItemBoundingBox() const
{
if (contentItem()) {
@@ -378,6 +406,9 @@ double QuickItemNodeInstance::y() const
QImage QuickItemNodeInstance::renderImage() const
{
if (s_unifiedRenderPath && !isRootNodeInstance())
return {};
updateDirtyNodesRecursive(quickItem());
QRectF renderBoundingRect = boundingRect();
@@ -390,7 +421,16 @@ QImage QuickItemNodeInstance::renderImage() const
nodeInstanceServer()->quickView()->beforeSynchronizing();
nodeInstanceServer()->quickView()->beforeRendering();
QImage renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);
QImage renderImage;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (s_unifiedRenderPath)
renderImage = nodeInstanceServer()->quickView()->grabWindow();
else
renderImage = designerSupport()->renderImageForItem(quickItem(), renderBoundingRect, size);
#else
renderImage = nodeInstanceServer()->quickView()->grabWindow();
#endif
nodeInstanceServer()->quickView()->afterRendering();
@@ -411,7 +451,20 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
nodeInstanceServer()->quickView()->beforeSynchronizing();
nodeInstanceServer()->quickView()->beforeRendering();
QImage image = designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, size);
QImage image;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (s_unifiedRenderPath)
image = nodeInstanceServer()->quickView()->grabWindow();
else
image = designerSupport()->renderImageForItem(quickItem(),
previewItemBoundingRect,
size);
#else
image = nodeInstanceServer()->quickView()->grabWindow();
#endif
image = image.scaledToWidth(size.width());
nodeInstanceServer()->quickView()->afterRendering();
@@ -426,6 +479,11 @@ QImage QuickItemNodeInstance::renderPreviewImage(const QSize &previewImageSize)
return QImage();
}
QSharedPointer<QQuickItemGrabResult> QuickItemNodeInstance::createGrabResult() const
{
return quickItem()->grabToImage(size().toSize());
}
void QuickItemNodeInstance::updateAllDirtyNodesRecursive()
{
updateAllDirtyNodesRecursive(quickItem());
@@ -490,10 +548,11 @@ void QuickItemNodeInstance::updateDirtyNodesRecursive(QQuickItem *parentItem) co
void QuickItemNodeInstance::updateAllDirtyNodesRecursive(QQuickItem *parentItem) const
{
foreach (QQuickItem *childItem, parentItem->childItems())
const QList<QQuickItem *> children = parentItem->childItems();
for (QQuickItem *childItem : children)
updateAllDirtyNodesRecursive(childItem);
DesignerSupport::updateDirtyNode(parentItem);
updateDirtyNode(parentItem);
}
static inline bool isRectangleSane(const QRectF &rect)
@@ -507,7 +566,7 @@ QRectF QuickItemNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem)
boundingRect = boundingRect.united(QRectF(QPointF(0, 0), size()));
foreach (QQuickItem *childItem, parentItem->childItems()) {
for (QQuickItem *childItem : parentItem->childItems()) {
if (!nodeInstanceServer()->hasInstanceForObject(childItem)) {
QRectF transformedRect = childItem->mapRectToItem(parentItem, boundingRectWithStepChilds(childItem));
if (isRectangleSane(transformedRect))
@@ -515,6 +574,9 @@ QRectF QuickItemNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem)
}
}
if (boundingRect.isEmpty())
QRectF{0, 0, 640, 480};
return boundingRect;
}

View File

@@ -45,6 +45,7 @@ public:
static Pointer create(QObject *objectToBeWrapped);
static void createEffectItem(bool createEffectItem);
static void enableUnifiedRenderPath(bool createEffectItem);
void initialize(const ObjectNodeInstance::Pointer &objectNodeInstance,
InstanceContainer::NodeFlags flags) override;
@@ -70,6 +71,8 @@ public:
QImage renderImage() const override;
QImage renderPreviewImage(const QSize &previewImageSize) const override;
QSharedPointer<QQuickItemGrabResult> createGrabResult() const override;
void updateAllDirtyNodesRecursive() override;
@@ -98,6 +101,9 @@ public:
QList<QQuickItem*> allItemsRecursive() const override;
QStringList allStates() const override;
static void updateDirtyNode(QQuickItem *item);
static bool unifiedRenderPath();
protected:
explicit QuickItemNodeInstance(QQuickItem*);
QQuickItem *quickItem() const;
@@ -118,6 +124,7 @@ protected:
double x() const;
double y() const;
bool checkIfRefFromEffect(qint32 id);
private: //variables
QPointer<QQuickItem> m_contentItem;
@@ -131,6 +138,7 @@ private: //variables
double m_width;
double m_height;
static bool s_createEffectItem;
static bool s_unifiedRenderPath;
};
} // namespace Internal

View File

@@ -120,6 +120,11 @@ QImage ServerNodeInstance::renderPreviewImage(const QSize &previewImageSize) con
return m_nodeInstance->renderPreviewImage(previewImageSize);
}
QSharedPointer<QQuickItemGrabResult> ServerNodeInstance::createGrabResult() const
{
return m_nodeInstance->createGrabResult();
}
bool ServerNodeInstance::isRootNodeInstance() const
{
return isValid() && m_nodeInstance->isRootNodeInstance();

View File

@@ -40,6 +40,7 @@ class QGraphicsItem;
class QGraphicsTransform;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
class QQuickItem;
class QQuickItemGrabResult;
#endif
QT_END_NAMESPACE
@@ -102,6 +103,8 @@ public:
QImage renderImage() const;
QImage renderPreviewImage(const QSize &previewImageSize) const;
QSharedPointer<QQuickItemGrabResult> createGrabResult() const;
ServerNodeInstance parent() const;
bool hasParent() const;

View File

@@ -1,7 +1,7 @@
QT += core gui widgets qml quick network
QT += core-private qml-private quick-private gui-private
CONFIG += c++11
CONFIG += c++17
DEFINES -= QT_CREATOR

View File

@@ -42,9 +42,11 @@
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#include <Windows.h>
#endif
namespace {
int internalMain(QGuiApplication *application)
{
QCoreApplication::setOrganizationName("QtProject");
@@ -138,6 +140,7 @@ int internalMain(QGuiApplication *application)
return application->exec();
}
} // namespace
int main(int argc, char *argv[])
{

View File

@@ -3,6 +3,8 @@
<file>images/template_image.png</file>
<file>html/welcome.html</file>
<file>images/webkit.png</file>
<file>images/non-visual-component.png</file>
<file>images/non-visual-component@2x.png</file>
<file>mockfiles/Window.qml</file>
<file>mockfiles/SwipeView.qml</file>
<file>mockfiles/GenericBackend.qml</file>

View File

@@ -46,8 +46,6 @@ Item {
width: itemLibraryIconWidth // to be set in Qml context
height: itemLibraryIconHeight // to be set in Qml context
source: itemLibraryIconPath // to be set by model
cache: false // Allow thumbnail to be dynamically updated
}
Text {
@@ -71,10 +69,11 @@ Item {
renderType: Text.NativeRendering
}
ToolTipArea {
ImagePreviewTooltipArea {
id: mouseRegion
anchors.fill: parent
tooltip: itemName
onPressed: {
rootView.startDragAndDrop(mouseRegion, itemLibraryEntry)
}

View File

@@ -0,0 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.1
import HelperWidgets 2.0
import QtQuick.Layouts 1.0
MouseArea {
id: mouseArea
onExited: tooltipBackend.hideTooltip()
onCanceled: tooltipBackend.hideTooltip()
onClicked: forceActiveFocus()
hoverEnabled: true
Timer {
interval: 1000
running: mouseArea.containsMouse
onTriggered: {
tooltipBackend.componentName = itemName
tooltipBackend.componentPath = componentPath
tooltipBackend.showTooltip()
}
}
}

View File

@@ -221,7 +221,7 @@ RowLayout {
onClicked: {
fileModel.openFileDialog()
if (fileModel.path !== "")
urlChooser.backendValue.value = fileModel.path
urlChooser.backendValue.value = fileModel.fileName
}
}
}

View File

@@ -47,3 +47,4 @@ ExpressionTextField 2.0 ExpressionTextField.qml
MarginSection 2.0 MarginSection.qml
HorizontalScrollBar 2.0 HorizontalScrollBar.qml
VerticalScrollBar 2.0 VerticalScrollBar.qml
ImagePreviewTooltipArea 2.0 ImagePreviewTooltipArea.qml

View File

@@ -98,33 +98,37 @@ QtObject {
readonly property string idAliasOff: "\u005B"
readonly property string idAliasOn: "\u005C"
readonly property string listView: "\u005D"
readonly property string mergeCells: "\u005E"
readonly property string minus: "\u005F"
readonly property string plus: "\u0060"
readonly property string redo: "\u0061"
readonly property string splitColumns: "\u0062"
readonly property string splitRows: "\u0063"
readonly property string startNode: "\u0064"
readonly property string testIcon: "\u0065"
readonly property string textAlignBottom: "\u0066"
readonly property string textAlignCenter: "\u0067"
readonly property string textAlignLeft: "\u0068"
readonly property string textAlignMiddle: "\u0069"
readonly property string textAlignRight: "\u006A"
readonly property string textAlignTop: "\u006B"
readonly property string textBulletList: "\u006C"
readonly property string textFullJustification: "\u006D"
readonly property string textNumberedList: "\u006E"
readonly property string tickIcon: "\u006F"
readonly property string triState: "\u0070"
readonly property string undo: "\u0071"
readonly property string upDownIcon: "\u0072"
readonly property string upDownSquare2: "\u0073"
readonly property string wildcard: "\u0074"
readonly property string zoomAll: "\u0075"
readonly property string zoomIn: "\u0076"
readonly property string zoomOut: "\u0077"
readonly property string zoomSelection: "\u0078"
readonly property string lockOff: "\u005E"
readonly property string lockOn: "\u005F"
readonly property string mergeCells: "\u0060"
readonly property string minus: "\u0061"
readonly property string plus: "\u0062"
readonly property string redo: "\u0063"
readonly property string splitColumns: "\u0064"
readonly property string splitRows: "\u0065"
readonly property string startNode: "\u0066"
readonly property string testIcon: "\u0067"
readonly property string textAlignBottom: "\u0068"
readonly property string textAlignCenter: "\u0069"
readonly property string textAlignLeft: "\u006A"
readonly property string textAlignMiddle: "\u006B"
readonly property string textAlignRight: "\u006C"
readonly property string textAlignTop: "\u006D"
readonly property string textBulletList: "\u006E"
readonly property string textFullJustification: "\u006F"
readonly property string textNumberedList: "\u0070"
readonly property string tickIcon: "\u0071"
readonly property string triState: "\u0072"
readonly property string undo: "\u0073"
readonly property string upDownIcon: "\u0074"
readonly property string upDownSquare2: "\u0075"
readonly property string visibilityOff: "\u0076"
readonly property string visibilityOn: "\u0077"
readonly property string wildcard: "\u0078"
readonly property string zoomAll: "\u0079"
readonly property string zoomIn: "\u007A"
readonly property string zoomOut: "\u007B"
readonly property string zoomSelection: "\u007C"
readonly property font iconFont: Qt.font({
"family": controlIcons.name,

View File

@@ -59,8 +59,12 @@ if (_library_enabled)
foreach(lib IN LISTS PYTHON_LIBRARIES)
if (lib MATCHES ${PythonRegex})
set(PythonZipFileName "python${CMAKE_MATCH_4}.zip")
set(PythonDll "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(PythonZip "${CMAKE_MATCH_1}/python${CMAKE_MATCH_4}.zip")
set(PythonExe "${CMAKE_MATCH_1}/python${CMAKE_EXECUTABLE_SUFFIX}")
set(PythonZip "${CMAKE_MATCH_1}/${PythonZipFileName}")
break()
endif()
endforeach()
@@ -85,16 +89,27 @@ if (_library_enabled)
pyvalue.cpp pyvalue.h
)
install(FILES
"${PythonDll}"
"${PythonZip}"
if (NOT EXISTS "${PythonZip}" AND
NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${PythonZipFileName}")
include(CreatePythonXY)
create_python_xy("${PythonExe}" "${CMAKE_CURRENT_BINARY_DIR}/${PythonZipFileName}")
endif()
if (NOT EXISTS "${PythonZip}" AND
EXISTS "${CMAKE_CURRENT_BINARY_DIR}/${PythonZipFileName}")
set(PythonZip "${CMAKE_CURRENT_BINARY_DIR}/${PythonZipFileName}")
endif()
list(APPEND deployPythonFiles "${PythonDll}")
list(APPEND deployPythonFiles "${PythonZip}")
install(FILES ${deployPythonFiles}
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
COMPONENT qtcreatorcdbext)
add_custom_target(copy_python_dll ALL VERBATIM)
add_custom_command(TARGET copy_python_dll POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonDll}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonZip}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
COMMAND "${CMAKE_COMMAND}" -E copy ${deployPythonFiles} "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
VERBATIM
)
endif()

View File

@@ -44,4 +44,6 @@ add_qtc_library(Sqlite
tableconstraints.h
utf8string.cpp utf8string.h
utf8stringvector.cpp utf8stringvector.h
sqliteblob.h
sqlitetimestamp.h
)

View File

@@ -27,6 +27,8 @@ SOURCES += \
$$PWD/sqlitebasestatement.cpp
HEADERS += \
$$PWD/constraints.h \
$$PWD/sqliteblob.h \
$$PWD/sqlitetimestamp.h \
$$PWD/tableconstraints.h \
$$PWD/createtablesqlstatementbuilder.h \
$$PWD/lastchangedrowid.h \

View File

@@ -191,12 +191,12 @@ void BaseStatement::bind(int index, Utils::SmallStringView text)
checkForBindingError(resultCode);
}
void BaseStatement::bind(int index, Utils::span<const byte> bytes)
void BaseStatement::bind(int index, BlobView blobView)
{
int resultCode = sqlite3_bind_blob64(m_compiledStatement.get(),
index,
bytes.data(),
static_cast<long long>(bytes.size()),
blobView.data(),
blobView.size(),
SQLITE_STATIC);
if (resultCode != SQLITE_OK)
checkForBindingError(resultCode);
@@ -498,7 +498,7 @@ StringType textForColumn(sqlite3_stmt *sqlStatment, int column)
return StringType(text, size);
}
Utils::span<const byte> blobForColumn(sqlite3_stmt *sqlStatment, int column)
BlobView blobForColumn(sqlite3_stmt *sqlStatment, int column)
{
const byte *blob = reinterpret_cast<const byte *>(sqlite3_column_blob(sqlStatment, column));
std::size_t size = std::size_t(sqlite3_column_bytes(sqlStatment, column));
@@ -506,7 +506,7 @@ Utils::span<const byte> blobForColumn(sqlite3_stmt *sqlStatment, int column)
return {blob, size};
}
Utils::span<const byte> convertToBlobForColumn(sqlite3_stmt *sqlStatment, int column)
BlobView convertToBlobForColumn(sqlite3_stmt *sqlStatment, int column)
{
int dataType = sqlite3_column_type(sqlStatment, column);
if (dataType == SQLITE_BLOB)
@@ -571,7 +571,7 @@ double BaseStatement::fetchDoubleValue(int column) const
return sqlite3_column_double(m_compiledStatement.get(), column);
}
Utils::span<const byte> BaseStatement::fetchBlobValue(int column) const
BlobView BaseStatement::fetchBlobValue(int column) const
{
return convertToBlobForColumn(m_compiledStatement.get(), column);
}

View File

@@ -27,6 +27,7 @@
#include "sqliteglobal.h"
#include "sqliteblob.h"
#include "sqliteexception.h"
#include "sqlitevalue.h"
@@ -70,7 +71,7 @@ public:
double fetchDoubleValue(int column) const;
Utils::SmallStringView fetchSmallStringViewValue(int column) const;
ValueView fetchValueView(int column) const;
Utils::span<const byte> fetchBlobValue(int column) const;
BlobView fetchBlobValue(int column) const;
template<typename Type>
Type fetchValue(int column) const;
int columnCount() const;
@@ -82,7 +83,7 @@ public:
void bind(int index, void *pointer);
void bind(int index, Utils::SmallStringView fetchValue);
void bind(int index, const Value &fetchValue);
void bind(int index, Utils::span<const byte> bytes);
void bind(int index, BlobView blobView);
void bind(int index, uint value) { bind(index, static_cast<long long>(value)); }
@@ -358,7 +359,7 @@ private:
operator long long() { return statement.fetchLongLongValue(column); }
operator double() { return statement.fetchDoubleValue(column); }
operator Utils::SmallStringView() { return statement.fetchSmallStringViewValue(column); }
operator Utils::span<const Sqlite::byte>() { return statement.fetchBlobValue(column); }
operator BlobView() { return statement.fetchBlobValue(column); }
operator ValueView() { return statement.fetchValueView(column); }
StatementImplementation &statement;

View File

@@ -0,0 +1,100 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "sqliteglobal.h"
#include <utils/span.h>
#include <QByteArray>
#include <algorithm>
#include <cstring>
#include <vector>
namespace Sqlite {
class BlobView
{
public:
BlobView() = default;
BlobView(const byte *data, std::size_t size)
: m_data(data)
, m_size(size)
{}
BlobView(const QByteArray &byteArray)
: m_data(reinterpret_cast<const byte *>(byteArray.constData()))
, m_size(static_cast<std::size_t>(byteArray.size()))
{}
BlobView(const std::vector<Sqlite::byte> &bytes)
: m_data(bytes.data())
, m_size(static_cast<std::size_t>(bytes.size()))
{}
const byte *data() const { return m_data; }
const char *cdata() const { return reinterpret_cast<const char *>(m_data); }
std::size_t size() const { return m_size; }
int sisize() const { return static_cast<int>(m_size); }
long long ssize() const { return static_cast<long long>(m_size); }
bool empty() const { return !m_size; }
friend bool operator==(Sqlite::BlobView first, Sqlite::BlobView second)
{
return first.size() == second.size()
&& std::memcmp(first.data(), second.data(), first.size()) == 0;
}
private:
const byte *m_data{};
std::size_t m_size{};
};
class Blob
{
public:
Blob(BlobView blobView)
{
bytes.reserve(blobView.size());
std::copy_n(blobView.data(), blobView.size(), std::back_inserter(bytes));
}
std::vector<Sqlite::byte> bytes;
};
class ByteArrayBlob
{
public:
ByteArrayBlob(BlobView blobView)
: byteArray{blobView.cdata(), blobView.sisize()}
{}
QByteArray byteArray;
};
} // namespace Sqlite

View File

@@ -46,7 +46,7 @@ void checkResultCode(int resultCode)
} // namespace
SessionChangeSet::SessionChangeSet(Utils::span<const byte> blob)
SessionChangeSet::SessionChangeSet(BlobView blob)
: data(sqlite3_malloc64(blob.size()))
, size(int(blob.size()))
{
@@ -64,7 +64,7 @@ SessionChangeSet::~SessionChangeSet()
sqlite3_free(data);
}
Utils::span<const byte> SessionChangeSet::asSpan() const
BlobView SessionChangeSet::asBlobView() const
{
return {static_cast<const byte *>(data), static_cast<std::size_t>(size)};
}

View File

@@ -25,10 +25,9 @@
#pragma once
#include "sqliteblob.h"
#include "sqliteglobal.h"
#include <utils/span.h>
#include <memory>
#include <vector>
@@ -41,7 +40,7 @@ class Sessions;
class SessionChangeSet
{
public:
SessionChangeSet(Utils::span<const byte> blob);
SessionChangeSet(BlobView blob);
SessionChangeSet(Sessions &session);
~SessionChangeSet();
SessionChangeSet(const SessionChangeSet &) = delete;
@@ -54,7 +53,7 @@ public:
}
void operator=(SessionChangeSet &);
Utils::span<const byte> asSpan() const;
BlobView asBlobView() const;
friend void swap(SessionChangeSet &first, SessionChangeSet &second) noexcept
{

View File

@@ -103,7 +103,7 @@ void Sessions::commit()
if (session && !sqlite3session_isempty(session.get())) {
SessionChangeSet changeSet{*this};
insertSession.write(changeSet.asSpan());
insertSession.write(changeSet.asBlobView());
}
session.reset();

View File

@@ -0,0 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
namespace Sqlite {
class TimeStamp
{
public:
TimeStamp() = default;
TimeStamp(long long value)
: value(value)
{}
friend bool operator==(TimeStamp first, TimeStamp second)
{
return first.value == second.value;
}
public:
long long value = -1;
};
} // namespace Sqlite

View File

@@ -23,6 +23,8 @@
**
****************************************************************************/
#pragma once
#include "sqliteexception.h"
#include <utils/smallstring.h>
@@ -32,9 +34,6 @@
#include <cstddef>
#pragma once
namespace Sqlite {
enum class ValueType : unsigned char { Null, Integer, Float, String };

View File

@@ -1161,13 +1161,14 @@ void IntegerAspect::setToolTip(const QString &tooltip)
Its visual representation is a QComboBox with three items.
*/
TriStateAspect::TriStateAspect()
TriStateAspect::TriStateAspect(const QString onString, const QString &offString,
const QString &defaultString)
{
setDisplayStyle(DisplayStyle::ComboBox);
setDefaultValue(2);
addOption(tr("Enable"));
addOption(tr("Disable"));
addOption(tr("Leave at Default"));
addOption(onString);
addOption(offString);
addOption(defaultString);
}
TriState TriStateAspect::setting() const

View File

@@ -322,7 +322,10 @@ class QTCREATOR_UTILS_EXPORT TriStateAspect : public SelectionAspect
{
Q_OBJECT
public:
TriStateAspect();
TriStateAspect(
const QString onString = tr("Enable"),
const QString &offString = tr("Disable"),
const QString &defaultString = tr("Leave at Default"));
TriState setting() const;
void setSetting(TriState setting);

View File

@@ -179,7 +179,13 @@ QStringList BuildableHelperLibrary::possibleQMakeCommands()
// On Unix some distributions renamed qmake with a postfix to avoid clashes
// On OS X, Qt 4 binary packages also has renamed qmake. There are also symbolic links that are
// named "qmake", but the file dialog always checks against resolved links (native Cocoa issue)
return QStringList(HostOsInfo::withExecutableSuffix("qmake*"));
QStringList commands(HostOsInfo::withExecutableSuffix("qmake*"));
// Qt 6 CMake built targets, such as Android, are dependent on the host installation
// and use a script wrapper around the host qmake executable
if (HostOsInfo::isWindowsHost())
commands.append("qmake*.bat");
return commands;
}
// Copy helper source files to a target directory, replacing older files.

View File

@@ -29,6 +29,7 @@
#include "fileutils.h"
#include "mapreduce.h"
#include "qtcassert.h"
#include "stringutils.h"
#include <QCoreApplication>
#include <QMutex>
@@ -474,7 +475,7 @@ QString matchCaseReplacement(const QString &originalText, const QString &replace
static QList<QRegularExpression> filtersToRegExps(const QStringList &filters)
{
return Utils::transform(filters, [](const QString &filter) {
return QRegularExpression(QRegularExpression::wildcardToRegularExpression(filter),
return QRegularExpression(Utils::wildcardToRegularExpression(filter),
QRegularExpression::CaseInsensitiveOption);
});
}

View File

@@ -393,4 +393,68 @@ QString formatElapsedTime(qint64 elapsed)
return QCoreApplication::translate("StringUtils", "Elapsed time: %1.").arg(time);
}
/*
* Basically QRegularExpression::wildcardToRegularExpression(), but let wildcards match
* path separators as well
*/
QString wildcardToRegularExpression(const QString &original)
{
const qsizetype wclen = original.size();
QString rx;
rx.reserve(wclen + wclen / 16);
qsizetype i = 0;
const QChar *wc = original.data();
const QLatin1String starEscape(".*");
const QLatin1String questionMarkEscape(".");
while (i < wclen) {
const QChar c = wc[i++];
switch (c.unicode()) {
case '*':
rx += starEscape;
break;
case '?':
rx += questionMarkEscape;
break;
case '\\':
case '$':
case '(':
case ')':
case '+':
case '.':
case '^':
case '{':
case '|':
case '}':
rx += QLatin1Char('\\');
rx += c;
break;
case '[':
rx += c;
// Support for the [!abc] or [!a-c] syntax
if (i < wclen) {
if (wc[i] == QLatin1Char('!')) {
rx += QLatin1Char('^');
++i;
}
if (i < wclen && wc[i] == QLatin1Char(']'))
rx += wc[i++];
while (i < wclen && wc[i] != QLatin1Char(']')) {
if (wc[i] == QLatin1Char('\\'))
rx += QLatin1Char('\\');
rx += wc[i++];
}
}
break;
default:
rx += c;
break;
}
}
return QRegularExpression::anchoredPattern(rx);
}
} // namespace Utils

View File

@@ -104,4 +104,11 @@ T makeUniquelyNumbered(const T &preferred, const Container &reserved)
QTCREATOR_UTILS_EXPORT QString formatElapsedTime(qint64 elapsed);
/* This function is only necessary if you need to match the wildcard expression against a
* string that might contain path separators - otherwise
* QRegularExpression::wildcardToRegularExpression() can be used.
* Working around QRegularExpression::wildcardToRegularExpression() taking native separators
* into account and handling them to disallow matching a wildcard characters.
*/
QTCREATOR_UTILS_EXPORT QString wildcardToRegularExpression(const QString &original);
} // namespace Utils

View File

@@ -324,7 +324,7 @@ QWidget *AndroidBuildApkWidget::createAdvancedGroup()
auto vbox = new QVBoxLayout(group);
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(m_step->kit());
if (version && version->supportsMultipleQtAbis()) {
auto buildAAB = new QCheckBox(tr("Build .aab (Android App Bundle)"), group);
auto buildAAB = new QCheckBox(tr("Build Android App Bundle (*.aab)"), group);
buildAAB->setChecked(m_step->buildAAB());
connect(buildAAB, &QAbstractButton::toggled, m_step, &AndroidBuildApkStep::setBuildAAB);
vbox->addWidget(buildAAB);

View File

@@ -51,6 +51,7 @@
#include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h>
#include <utils/layoutbuilder.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h>
@@ -86,8 +87,18 @@ AndroidDeployQtStep::AndroidDeployQtStep(BuildStepList *parent, Utils::Id id)
: BuildStep(parent, id)
{
setImmutable(true);
m_uninstallPreviousPackage = addAspect<BoolAspect>();
m_uninstallPreviousPackage->setSettingsKey(UninstallPreviousPackageKey);
m_uninstallPreviousPackage->setLabel(tr("Uninstall the existing app first"));
m_uninstallPreviousPackage->setValue(false);
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(kit());
m_uninstallPreviousPackage = qt && qt->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
const bool forced = qt && qt->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0);
if (forced) {
m_uninstallPreviousPackage->setValue(true);
m_uninstallPreviousPackage->setEnabled(false);
}
connect(this, &AndroidDeployQtStep::askForUninstall,
this, &AndroidDeployQtStep::slotAskForUninstall,
@@ -167,7 +178,7 @@ bool AndroidDeployQtStep::init()
emit addOutput(tr("Deploying to %1").arg(m_serialNumber), OutputFormat::Stdout);
m_uninstallPreviousPackageRun = m_uninstallPreviousPackage;
m_uninstallPreviousPackageRun = m_uninstallPreviousPackage->value();
if (m_uninstallPreviousPackageRun)
m_manifestName = AndroidManager::manifestPath(target());
@@ -480,14 +491,6 @@ QWidget *AndroidDeployQtStep::createConfigWidget()
setDisplayName(QString("<b>%1</b>").arg(displayName()));
setSummaryText(displayName());
auto uninstallPreviousCheckBox = new QCheckBox(widget);
uninstallPreviousCheckBox->setText(tr("Uninstall the existing app first"));
uninstallPreviousCheckBox->setChecked(uninstallPreviousPackage() > Keep);
uninstallPreviousCheckBox->setEnabled(uninstallPreviousPackage() != ForceUninstall);
connect(uninstallPreviousCheckBox, &QAbstractButton::toggled,
this, &AndroidDeployQtStep::setUninstallPreviousPackage);
auto resetDefaultDevices = new QPushButton(widget);
resetDefaultDevices->setText(tr("Reset Default Deployment Devices"));
@@ -508,10 +511,10 @@ QWidget *AndroidDeployQtStep::createConfigWidget()
AndroidManager::installQASIPackage(target(), packagePath);
});
auto layout = new QVBoxLayout(widget);
layout->addWidget(uninstallPreviousCheckBox);
layout->addWidget(resetDefaultDevices);
layout->addWidget(installCustomApkButton);
LayoutBuilder builder(widget);
builder.addRow(m_uninstallPreviousPackage);
builder.addRow(resetDefaultDevices);
builder.addRow(installCustomApkButton);
return widget;
}
@@ -569,32 +572,6 @@ AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::parseDeployErrors(QStr
return errorCode;
}
bool AndroidDeployQtStep::fromMap(const QVariantMap &map)
{
m_uninstallPreviousPackage = map.value(UninstallPreviousPackageKey, m_uninstallPreviousPackage).toBool();
return ProjectExplorer::BuildStep::fromMap(map);
}
QVariantMap AndroidDeployQtStep::toMap() const
{
QVariantMap map = ProjectExplorer::BuildStep::toMap();
map.insert(UninstallPreviousPackageKey, m_uninstallPreviousPackage);
return map;
}
void AndroidDeployQtStep::setUninstallPreviousPackage(bool uninstall)
{
m_uninstallPreviousPackage = uninstall;
}
AndroidDeployQtStep::UninstallType AndroidDeployQtStep::uninstallPreviousPackage()
{
const QtSupport::BaseQtVersion * const qt = QtSupport::QtKitAspect::qtVersion(kit());
if (qt && qt->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0))
return ForceUninstall;
return m_uninstallPreviousPackage ? Uninstall : Keep;
}
// AndroidDeployQtStepFactory
AndroidDeployQtStepFactory::AndroidDeployQtStepFactory()

View File

@@ -59,20 +59,8 @@ class AndroidDeployQtStep : public ProjectExplorer::BuildStep
};
public:
enum UninstallType {
Keep,
Uninstall,
ForceUninstall
};
AndroidDeployQtStep(ProjectExplorer::BuildStepList *bc, Utils::Id id);
bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
UninstallType uninstallPreviousPackage();
void setUninstallPreviousPackage(bool uninstall);
signals:
void askForUninstall(DeployErrorCode errorCode);
@@ -105,7 +93,7 @@ private:
QMap<QString, QString> m_filesToPull;
QStringList m_androidABIs;
bool m_uninstallPreviousPackage = false;
Utils::BoolAspect *m_uninstallPreviousPackage = nullptr;
bool m_uninstallPreviousPackageRun = false;
bool m_useAndroiddeployqt = false;
bool m_askForUninstall = false;

View File

@@ -86,7 +86,8 @@ QString AndroidQtVersion::invalidReason() const
bool AndroidQtVersion::supportsMultipleQtAbis() const
{
return qtVersion() >= QtSupport::QtVersionNumber{5, 14};
return qtVersion() >= QtSupport::QtVersionNumber{5, 14}
&& qtVersion() < QtSupport::QtVersionNumber{6, 0};
}
Abis AndroidQtVersion::detectQtAbis() const

View File

@@ -10,9 +10,6 @@
<height>284</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">

View File

@@ -185,8 +185,11 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
qCDebug(LOG) << " LocalExecutable" << localExecutable;
qCDebug(LOG) << " DeployedExecutable" << deployedExecutable;
qCDebug(LOG) << "Iterating run configurations";
for (RunConfiguration *runConfig : target->runConfigurations()) {
qCDebug(LOG) << "Iterating run configurations - prefer active over others";
QList<RunConfiguration *> runConfigurations = target->runConfigurations();
runConfigurations.removeOne(target->activeRunConfiguration());
runConfigurations.prepend(target->activeRunConfiguration());
for (RunConfiguration *runConfig : qAsConst(runConfigurations)) {
qCDebug(LOG) << "RunConfiguration" << runConfig->id();
if (!isLocal(target)) { // TODO add device support
qCDebug(LOG) << " Skipped as not being local";

View File

@@ -58,10 +58,11 @@
#include <QThread>
using namespace ClangBackEnd;
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
using namespace ProjectExplorer;
namespace ClangCodeModel {
namespace Internal {
static Q_LOGGING_CATEGORY(debug, "qtc.clangcodemodel.batch", QtWarningMsg);
static int timeOutFromEnvironmentVariable()
@@ -78,7 +79,7 @@ static int timeOutFromEnvironmentVariable()
return intervalAsInt;
}
static int timeOutInMs()
int timeOutInMs()
{
static int timeOut = timeOutFromEnvironmentVariable();
return timeOut;
@@ -747,9 +748,6 @@ bool BatchFileParser::parseLine(const QString &line)
} // anonymous namespace
namespace ClangCodeModel {
namespace Internal {
static QString applySubstitutions(const QString &filePath, const QString &text)
{
const QString dirPath = QFileInfo(filePath).absolutePath();

View File

@@ -30,6 +30,8 @@
namespace ClangCodeModel {
namespace Internal {
int timeOutInMs();
bool runClangBatchFile(const QString &filePath);
} // namespace Internal

View File

@@ -26,6 +26,7 @@
#include "clangcodecompletion_test.h"
#include "clangautomationutils.h"
#include "clangbatchfileprocessor.h"
#include "../clangcompletionassistinterface.h"
#include "../clangmodelmanagersupport.h"
@@ -344,7 +345,7 @@ public:
if (!textToInsert.isEmpty())
openEditor.editor()->insert(textToInsert);
proposal = completionResults(openEditor.editor(), includePaths, 15000);
proposal = completionResults(openEditor.editor(), includePaths, timeOutInMs());
}
TextEditor::ProposalModelPtr proposal;
@@ -657,7 +658,8 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCode()
OpenEditorAtCursorPosition openEditor(testDocument);
QVERIFY(openEditor.succeeded());
TextEditor::ProposalModelPtr proposal = completionResults(openEditor.editor());
TextEditor::ProposalModelPtr proposal = completionResults(openEditor.editor(), {},
timeOutInMs());
QVERIFY(hasItem(proposal, "projectConfiguration1"));
}
@@ -670,7 +672,8 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeAfterChangingProje
QVERIFY(openEditor.succeeded());
// Check completion without project
TextEditor::ProposalModelPtr proposal = completionResults(openEditor.editor());
TextEditor::ProposalModelPtr proposal = completionResults(openEditor.editor(), {},
timeOutInMs());
QVERIFY(hasItem(proposal, "noProjectConfigurationDetected"));
{
@@ -681,7 +684,7 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeAfterChangingProje
QVERIFY(projectLoader.load());
openEditor.waitUntilProjectPartChanged(QLatin1String("myproject.project"));
proposal = completionResults(openEditor.editor());
proposal = completionResults(openEditor.editor(), {}, timeOutInMs());
QVERIFY(hasItem(proposal, "projectConfiguration1"));
QVERIFY(!hasItem(proposal, "projectConfiguration2"));
@@ -689,7 +692,7 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeAfterChangingProje
// Check completion with project configuration 2
QVERIFY(projectLoader.updateProject({{"PROJECT_CONFIGURATION_2"}}));
openEditor.waitUntilBackendIsNotified();
proposal = completionResults(openEditor.editor());
proposal = completionResults(openEditor.editor(), {}, timeOutInMs());
QVERIFY(!hasItem(proposal, "projectConfiguration1"));
QVERIFY(hasItem(proposal, "projectConfiguration2"));
@@ -697,7 +700,7 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeAfterChangingProje
// Check again completion without project
openEditor.waitUntilProjectPartChanged(QLatin1String(""));
proposal = completionResults(openEditor.editor());
proposal = completionResults(openEditor.editor(), {}, timeOutInMs());
QVERIFY(hasItem(proposal, "noProjectConfigurationDetected"));
}
@@ -723,7 +726,8 @@ void ClangCodeCompletionTest::testCompleteProjectDependingCodeInGeneratedUiFile(
QVERIFY(openSource.succeeded());
// ...and check comletions
TextEditor::ProposalModelPtr proposal = completionResults(openSource.editor());
TextEditor::ProposalModelPtr proposal = completionResults(openSource.editor(), {},
timeOutInMs());
QVERIFY(hasItem(proposal, "menuBar"));
QVERIFY(hasItem(proposal, "statusBar"));
QVERIFY(hasItem(proposal, "centralWidget"));

View File

@@ -10,9 +10,6 @@
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">

View File

@@ -125,7 +125,7 @@ void ClangToolsUnitTests::testProject()
ClangToolsSettings::instance()->runSettings(),
diagnosticConfig);
QSignalSpy waitForFinishedTool(tool, &ClangTool::finished);
QVERIFY(waitForFinishedTool.wait(90000));
QVERIFY(waitForFinishedTool.wait(m_timeout));
// Check for errors
const QString errorText = waitForFinishedTool.takeFirst().first().toString();
@@ -186,5 +186,11 @@ void ClangToolsUnitTests::addTestRow(const QByteArray &relativeFilePath,
<< absoluteFilePath << expectedDiagCount << diagnosticConfig;
}
int ClangToolsUnitTests::getTimeout()
{
const int t = qEnvironmentVariableIntValue("QTC_CLANGTOOLS_TEST_TIMEOUT");
return t > 0 ? t : 480000;
}
} // namespace Internal
} // namespace ClangTools

View File

@@ -56,8 +56,11 @@ private:
const CppTools::ClangDiagnosticConfig &diagnosticConfig);
private:
static int getTimeout();
CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
ProjectExplorer::Kit *m_kit = nullptr;
int m_timeout = getTimeout();
};
} // namespace Internal

View File

@@ -10,9 +10,6 @@
<height>125</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>

View File

@@ -38,6 +38,7 @@
#include <utils/algorithm.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <QThread>
@@ -67,7 +68,7 @@ void CppcheckTool::updateOptions(const CppcheckOptions &options)
if (trimmedPattern.isEmpty())
continue;
const QRegularExpression re(QRegularExpression::wildcardToRegularExpression(trimmedPattern));
const QRegularExpression re(Utils::wildcardToRegularExpression(trimmedPattern));
if (re.isValid())
m_filters.push_back(re);
}

View File

@@ -226,6 +226,8 @@ private slots:
void test_quickfix_removeUsingNamespace_data();
void test_quickfix_removeUsingNamespace();
void test_quickfix_removeUsingNamespace_simple_data();
void test_quickfix_removeUsingNamespace_simple();
void test_quickfix_removeUsingNamespace_differentSymbols();
void test_quickfix_InsertVirtualMethods_data();

View File

@@ -606,6 +606,32 @@ void CppEditorPlugin::test_quickfix_data()
""
);
// Checks: complete switch statement where enum is goes via a template type parameter
QTest::newRow("CompleteSwitchCaseStatement_QTCREATORBUG-24752")
<< CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
"enum E {EA, EB};\n"
"template<typename T> struct S {\n"
" static T theType() { return T(); }\n"
"};\n"
"int main() {\n"
" @switch (S<E>::theType()) {\n"
" }\n"
"}\n"
) << _(
"enum E {EA, EB};\n"
"template<typename T> struct S {\n"
" static T theType() { return T(); }\n"
"};\n"
"int main() {\n"
" switch (S<E>::theType()) {\n"
" case EA:\n"
" break;\n"
" case EB:\n"
" break;\n"
" }\n"
"}\n"
);
// Checks: No special treatment for reference to non const.
// Check: Quick fix is not triggered on a member function.
@@ -7083,6 +7109,49 @@ void CppEditorPlugin::test_quickfix_removeUsingNamespace()
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths(), operation);
}
void CppEditorPlugin::test_quickfix_removeUsingNamespace_simple_data()
{
QTest::addColumn<QByteArray>("header");
QTest::addColumn<QByteArray>("expected");
const QByteArray common = R"--(
namespace N{
template<typename T>
struct vector{
using iterator = T*;
};
using int_vector = vector<int>;
}
)--";
const QByteArray header = common + R"--(
using namespace N@;
int_vector ints;
int_vector::iterator intIter;
using vec = vector<int>;
vec::iterator it;
)--";
const QByteArray expected = common + R"--(
N::int_vector ints;
N::int_vector::iterator intIter;
using vec = N::vector<int>;
vec::iterator it;
)--";
QTest::newRow("nested typedefs with Namespace") << header << expected;
}
void CppEditorPlugin::test_quickfix_removeUsingNamespace_simple()
{
QFETCH(QByteArray, header);
QFETCH(QByteArray, expected);
QList<QuickFixTestDocument::Ptr> testDocuments;
testDocuments << QuickFixTestDocument::create("header.h", header, expected);
RemoveUsingNamespace factory;
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths());
}
void CppEditorPlugin::test_quickfix_removeUsingNamespace_differentSymbols()
{
QByteArray header = "namespace test{\n"

View File

@@ -2752,6 +2752,7 @@ Enum *conditionEnum(const CppQuickFixInterface &interface, SwitchStatementAST *s
Block *block = statement->symbol;
Scope *scope = interface.semanticInfo().doc->scopeAt(block->line(), block->column());
TypeOfExpression typeOfExpression;
typeOfExpression.setExpandTemplates(true);
typeOfExpression.init(interface.semanticInfo().doc, interface.snapshot());
const QList<LookupItem> results = typeOfExpression(statement->condition,
interface.semanticInfo().doc,
@@ -7794,6 +7795,33 @@ private:
int counter;
};
/**
* @brief getBaseName returns the base name of a qualified name or nullptr.
* E.g.: foo::bar => foo; bar => bar
* @param name The Name, maybe qualified
* @return The base name of the qualified name or nullptr
*/
const Identifier *getBaseName(const Name *name)
{
class GetBaseName : public NameVisitor
{
void visit(const Identifier *name) override { baseName = name; }
void visit(const QualifiedNameId *name) override
{
if (name->base())
accept(name->base());
else
accept(name->name());
}
public:
const Identifier *baseName = nullptr;
};
GetBaseName getter;
getter.accept(name);
return getter.baseName;
}
/**
* @brief countNames counts the parts of the Name.
* E.g. if the name is std::vector, the function returns 2, if the name is variant, returns 1
@@ -7993,11 +8021,24 @@ private:
{
if (m_start) {
Scope *scope = m_file->scopeAt(ast->firstToken());
const QList<LookupItem> lookups = m_context.lookup(ast->name->name, scope);
const Name *wantToLookup = ast->name->name;
// first check if the base name is a typedef. Consider the following example:
// using namespace std;
// using vec = std::vector<int>;
// vec::iterator it; // we have to lookup 'vec' and not iterator (would result in
// std::vector<int>::iterator => std::vec::iterator, which is wrong)
const Name *baseName = getBaseName(wantToLookup);
QList<LookupItem> typedefCandidates = m_context.lookup(baseName, scope);
if (!typedefCandidates.isEmpty()) {
if (typedefCandidates.front().declaration()->isTypedef())
wantToLookup = baseName;
}
const QList<LookupItem> lookups = m_context.lookup(wantToLookup, scope);
if (!lookups.empty()) {
QList<const Name *> fullName = m_context.fullyQualifiedName(
lookups.first().declaration());
const int currentNameCount = countNames(ast->name->name);
const int currentNameCount = countNames(wantToLookup);
const bool needNamespace = needMissingNamespaces(std::move(fullName),
currentNameCount);
if (needNamespace)

View File

@@ -1117,12 +1117,12 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
const MyTestDataDir testDir2(_("testdata_project2"));
QFile foobar2000Header(testDir2.file("foobar2000.h"));
QVERIFY(foobar2000Header.open(QFile::ReadOnly));
QVERIFY(foobar2000Header.open(QFile::ReadOnly | QFile::Text));
const auto foobar2000HeaderContents = foobar2000Header.readAll();
foobar2000Header.close();
QFile renamedHeader(renamedHeaderWithNormalGuard);
QVERIFY(renamedHeader.open(QFile::ReadOnly));
QVERIFY(renamedHeader.open(QFile::ReadOnly | QFile::Text));
auto renamedHeaderContents = renamedHeader.readAll();
renamedHeader.close();
QCOMPARE(renamedHeaderContents, foobar2000HeaderContents);
@@ -1133,12 +1133,12 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
Core::HandleIncludeGuards::Yes));
QFile foobar4000Header(testDir2.file("foobar4000.h"));
QVERIFY(foobar4000Header.open(QFile::ReadOnly));
QVERIFY(foobar4000Header.open(QFile::ReadOnly | QFile::Text));
const auto foobar4000HeaderContents = foobar4000Header.readAll();
foobar4000Header.close();
renamedHeader.setFileName(renamedHeaderWithUnderscoredGuard);
QVERIFY(renamedHeader.open(QFile::ReadOnly));
QVERIFY(renamedHeader.open(QFile::ReadOnly | QFile::Text));
renamedHeaderContents = renamedHeader.readAll();
renamedHeader.close();
QCOMPARE(renamedHeaderContents, foobar4000HeaderContents);
@@ -1146,7 +1146,7 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
// test the renaming of a header with a malformed guard to verify we do not make
// accidental refactors
renamedHeader.setFileName(headerWithMalformedGuard);
QVERIFY(renamedHeader.open(QFile::ReadOnly));
QVERIFY(renamedHeader.open(QFile::ReadOnly | QFile::Text));
auto originalMalformedGuardContents = renamedHeader.readAll();
renamedHeader.close();
@@ -1154,7 +1154,7 @@ void CppToolsPlugin::test_modelmanager_renameIncludesInEditor()
Core::HandleIncludeGuards::Yes));
renamedHeader.setFileName(renamedHeaderWithMalformedGuard);
QVERIFY(renamedHeader.open(QFile::ReadOnly));
QVERIFY(renamedHeader.open(QFile::ReadOnly | QFile::Text));
renamedHeaderContents = renamedHeader.readAll();
renamedHeader.close();
QCOMPARE(renamedHeaderContents, originalMalformedGuardContents);

View File

@@ -4166,7 +4166,7 @@ void GdbEngine::setupInferior()
}
if (!symbolFile.isEmpty()) {
runCommand({"-file-exec-and-symbols \"" + symbolFile + '"',
runCommand({"-file-symbol-file \"" + symbolFile + '"',
CB(handleFileExecAndSymbols)});
}

View File

@@ -2951,14 +2951,12 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
const SynchronousProcessResponse resp = vcsSynchronousExec(repositoryDirectory, arguments,
VcsCommand::NoFullySync);
const QString stdErr = resp.stdErr();
if (resp.result == SynchronousProcessResponse::Finished) {
VcsOutputWindow::appendMessage(msgCommitted(amendSHA1, commitCount));
VcsOutputWindow::appendError(stdErr);
GitPlugin::updateCurrentBranch();
return true;
} else {
VcsOutputWindow::appendError(tr("Cannot commit %n files: %1\n", nullptr, commitCount).arg(stdErr));
VcsOutputWindow::appendError(tr("Cannot commit %n files\n", nullptr, commitCount));
return false;
}
}

View File

@@ -325,10 +325,9 @@ void Client::sendContent(const IContent &content)
QString error;
if (!QTC_GUARD(content.isValid(&error)))
Core::MessageManager::write(error);
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage,
name(),
content.toBaseMessage());
m_clientInterface->sendMessage(content.toBaseMessage());
const BaseMessage message = content.toBaseMessage();
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage, name(), message);
m_clientInterface->sendMessage(message);
}
void Client::sendContent(const DocumentUri &uri, const IContent &content)

View File

@@ -10,9 +10,6 @@
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>

View File

@@ -10,9 +10,6 @@
<height>349</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">

View File

@@ -10,9 +10,6 @@
<height>70</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="_nameLbl">

View File

@@ -10,9 +10,6 @@
<height>349</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">

View File

@@ -124,9 +124,6 @@ QWidget *NimbleTaskStep::createConfigWidget()
connect(buildSystem, &NimbleBuildSystem::tasksChanged, this, &NimbleTaskStep::updateTaskList);
connect(m_taskName, &StringAspect::changed, this, &BuildStep::recreateSummary);
connect(m_taskArgs, &StringAspect::changed, this, &BuildStep::recreateSummary);
setSummaryUpdater([this] {
return QString("<b>%1:</b> nimble %2 %3")
.arg(displayName(), m_taskName->value(), m_taskArgs->value());

View File

@@ -477,6 +477,7 @@ void BuildManager::finish()
{
const QString elapsedTime = Utils::formatElapsedTime(d->m_elapsed.elapsed());
m_instance->addToOutputWindow(elapsedTime, BuildStep::OutputFormat::NormalMessage);
d->m_outputWindow->flush();
QApplication::alert(ICore::dialogParent(), 3000);
}
@@ -696,7 +697,7 @@ void BuildManager::nextStep()
}
static const auto finishedHandler = [](bool success) {
d->m_outputWindow->outputFormatter()->flush();
d->m_outputWindow->flush();
d->m_lastStepSucceeded = success;
disconnect(d->m_currentBuildStep, nullptr, instance(), nullptr);
BuildManager::nextBuildQueue();

View File

@@ -35,6 +35,7 @@ class PROJECTEXPLORER_EXPORT BuildPropertiesSettings
{
public:
QString buildDirectoryTemplate;
QString buildDirectoryTemplateOld; // TODO: Remove in ~4.16
Utils::TriState separateDebugInfo;
Utils::TriState qmlDebugging;
Utils::TriState qtQuickCompiler;

View File

@@ -157,6 +157,26 @@ void BuildStep::cancel()
doCancel();
}
QWidget *BuildStep::doCreateConfigWidget()
{
QWidget *widget = createConfigWidget();
const auto recreateSummary = [this] {
if (m_summaryUpdater)
setSummaryText(m_summaryUpdater());
};
for (BaseAspect *aspect : qAsConst(m_aspects))
connect(aspect, &BaseAspect::changed, widget, recreateSummary);
connect(buildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
widget, recreateSummary);
recreateSummary();
return widget;
}
QWidget *BuildStep::createConfigWidget()
{
auto widget = new QWidget;
@@ -165,12 +185,8 @@ QWidget *BuildStep::createConfigWidget()
for (BaseAspect *aspect : qAsConst(m_aspects)) {
if (aspect->isVisible())
aspect->addToLayout(builder.finishRow());
connect(aspect, &BaseAspect::changed, this, &BuildStep::recreateSummary);
}
connect(buildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
this, &BuildStep::recreateSummary);
if (m_addMacroExpander)
VariableChooser::addSupportForChildWidgets(widget, macroExpander());
@@ -500,13 +516,6 @@ void BuildStep::setSummaryText(const QString &summaryText)
void BuildStep::setSummaryUpdater(const std::function<QString()> &summaryUpdater)
{
m_summaryUpdater = summaryUpdater;
recreateSummary();
}
void BuildStep::recreateSummary()
{
if (m_summaryUpdater)
setSummaryText(m_summaryUpdater());
}
} // ProjectExplorer

View File

@@ -70,7 +70,6 @@ public:
virtual bool init() = 0;
void run();
void cancel();
virtual QWidget *createConfigWidget();
bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
@@ -120,7 +119,7 @@ public:
QString summaryText() const;
void setSummaryText(const QString &summaryText);
void recreateSummary();
QWidget *doCreateConfigWidget();
signals:
void updateSummary();
@@ -141,6 +140,8 @@ signals:
void finished(bool result);
protected:
virtual QWidget *createConfigWidget();
void runInThread(const std::function<bool()> &syncImpl);
std::function<bool()> cancelChecker() const;

View File

@@ -170,7 +170,7 @@ void ToolWidget::setDownVisible(bool b)
BuildStepsWidgetData::BuildStepsWidgetData(BuildStep *s) :
step(s), widget(nullptr), detailsWidget(nullptr)
{
widget = s->createConfigWidget();
widget = s->doCreateConfigWidget();
Q_ASSERT(widget);
detailsWidget = new DetailsWidget;

View File

@@ -416,8 +416,6 @@ QWidget *MakeStep::createConfigWidget()
m_nonOverrideWarning->setVisible(makeflagsJobCountMismatch()
&& !jobCountOverridesMakeflags());
disableInSubDirsCheckBox->setChecked(!m_enabledForSubDirs);
recreateSummary();
};
updateDetails();

View File

@@ -259,7 +259,8 @@ const char PROJECT_OPEN_LOCATIONS_CONTEXT_MENU[] = "Project.P.OpenLocation.CtxM
// Default directories:
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE[] = "../%{JS: Util.asciify(\"build-%{Project:Name}-%{Kit:FileSystemName}-%{BuildConfig:Name}\")}";
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY[] = "Directories/BuildDirectory.Template";
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY_OLD[] = "Directories/BuildDirectory.Template"; // TODO: Remove in ~4.16
const char DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY[] = "Directories/BuildDirectory.TemplateV2";
const char BUILD_BEFORE_DEPLOY_SETTINGS_KEY[] = "ProjectExplorer/Settings/BuildBeforeDeploy";
const char DEPLOY_BEFORE_RUN_SETTINGS_KEY[] = "ProjectExplorer/Settings/DeployBeforeRun";
@@ -1532,8 +1533,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_projectExplorerSettings.lowBuildPriority
= s->value(Constants::LOW_BUILD_PRIORITY_SETTINGS_KEY, false).toBool();
dd->m_buildPropertiesSettings.buildDirectoryTemplateOld
= s->value(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY_OLD).toString();
dd->m_buildPropertiesSettings.buildDirectoryTemplate
= s->value(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY).toString();
if (dd->m_buildPropertiesSettings.buildDirectoryTemplate.isEmpty()) {
dd->m_buildPropertiesSettings.buildDirectoryTemplate
= dd->m_buildPropertiesSettings.buildDirectoryTemplateOld;
}
if (dd->m_buildPropertiesSettings.buildDirectoryTemplate.isEmpty())
dd->m_buildPropertiesSettings.buildDirectoryTemplate = Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE;
// TODO: Remove in ~4.16
@@ -2110,6 +2117,8 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
s->setValue(Constants::STOP_BEFORE_BUILD_SETTINGS_KEY, int(dd->m_projectExplorerSettings.stopBeforeBuild));
// Store this in the Core directory scope for backward compatibility!
s->setValue(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY_OLD,
dd->m_buildPropertiesSettings.buildDirectoryTemplateOld);
s->setValue(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY,
dd->m_buildPropertiesSettings.buildDirectoryTemplate);

View File

@@ -53,9 +53,11 @@ class PROJECTEXPLORER_EXPORT Target : public QObject
friend class SessionManager; // for setActiveBuild and setActiveDeployConfiguration
Q_OBJECT
struct _constructor_tag { explicit _constructor_tag() = default; };
public:
struct _constructor_tag
{
explicit _constructor_tag() = default;
};
Target(Project *parent, Kit *k, _constructor_tag);
~Target() override;

View File

@@ -75,6 +75,17 @@ using namespace QmakeProjectManager::Internal;
namespace QmakeProjectManager {
class RunSystemAspect : public TriStateAspect
{
Q_OBJECT
public:
RunSystemAspect() : TriStateAspect(tr("Run"), tr("Ignore"), tr("Use global setting"))
{
setSettingsKey("RunSystemFunction");
setDisplayName(tr("qmake system() behavior when parsing:"));
}
};
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
{
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
@@ -198,6 +209,8 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Utils::Id id)
emit qmakeBuildConfigurationChanged();
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
});
addAspect<RunSystemAspect>();
}
QmakeBuildConfiguration::~QmakeBuildConfiguration()
@@ -439,6 +452,17 @@ void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
aspect<QtQuickCompilerAspect>()->setSetting(enable ? TriState::Enabled : TriState::Disabled);
}
bool QmakeBuildConfiguration::runSystemFunction() const
{
switch (aspect<RunSystemAspect>()->value()) {
case 0:
return true;
case 1:
return false;
}
return QmakeSettings::runSystemFunction();
}
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
{
QStringList result;
@@ -875,3 +899,5 @@ void QmakeBuildConfiguration::restrictNextBuild(const RunConfiguration *rc)
}
} // namespace QmakeProjectManager
#include <qmakebuildconfiguration.moc>

View File

@@ -106,6 +106,8 @@ public:
Utils::TriState useQtQuickCompiler() const;
void forceQtQuickCompiler(bool enable);
bool runSystemFunction() const;
signals:
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
/// if those change the qmakebuildconfig

View File

@@ -1839,16 +1839,25 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
}
bool tryUnfixified = false;
// These paths should not be checked for existence, to ensure consistent include path lists
// before and after building.
const QString mocDir = mocDirPath(reader, buildDir);
const QString uiDir = uiDirPath(reader, buildDir);
foreach (const ProFileEvaluator::SourceFile &el,
reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString(),
false)) {
const QString sysrootifiedPath = sysrootify(el.fileName, sysroot.toString(), projectDir,
buildDir.toString());
if (IoUtils::isAbsolutePath(sysrootifiedPath) && IoUtils::exists(sysrootifiedPath))
if (IoUtils::isAbsolutePath(sysrootifiedPath)
&& (IoUtils::exists(sysrootifiedPath) || sysrootifiedPath == mocDir
|| sysrootifiedPath == uiDir)) {
paths << sysrootifiedPath;
else
} else {
tryUnfixified = true;
}
}
// If sysrootifying a fixified path does not yield a valid path, try again with the
// unfixified value. This can be necessary for cross-building; see QTCREATORBUG-21164.
@@ -1862,10 +1871,6 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
}
}
// paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf
// except if those directories don't exist at the time of parsing
// thus we add those directories manually (without checking for existence)
paths << mocDirPath(reader, buildDir) << uiDirPath(reader, buildDir);
paths.removeDuplicates();
return paths;
}

View File

@@ -797,6 +797,7 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi
m_qmakeGlobals->environment.insert(env.key(eit), env.expandedValueForKey(env.key(eit)));
m_qmakeGlobals->setCommandLineArguments(buildDir(rootProFile()->filePath()).toString(), qmakeArgs);
m_qmakeGlobals->runSystemFunction = bc->runSystemFunction();
QtSupport::ProFileCacheManager::instance()->incRefCount();

View File

@@ -38,11 +38,13 @@ namespace Internal {
const char BUILD_DIR_WARNING_KEY[] = "QmakeProjectManager/WarnAgainstUnalignedBuildDir";
const char ALWAYS_RUN_QMAKE_KEY[] = "QmakeProjectManager/AlwaysRunQmake";
const char RUN_SYSTEM_KEY[] = "QmakeProjectManager/RunSystemFunction";
static bool operator==(const QmakeSettingsData &s1, const QmakeSettingsData &s2)
{
return s1.warnAgainstUnalignedBuildDir == s2.warnAgainstUnalignedBuildDir
&& s1.alwaysRunQmake == s2.alwaysRunQmake;
&& s1.alwaysRunQmake == s2.alwaysRunQmake
&& s1.runSystemFunction == s2.runSystemFunction;
}
static bool operator!=(const QmakeSettingsData &s1, const QmakeSettingsData &s2)
{
@@ -59,6 +61,11 @@ bool QmakeSettings::alwaysRunQmake()
return instance().m_settings.alwaysRunQmake;
}
bool QmakeSettings::runSystemFunction()
{
return instance().m_settings.runSystemFunction;
}
QmakeSettings &QmakeSettings::instance()
{
static QmakeSettings theSettings;
@@ -85,6 +92,7 @@ void QmakeSettings::loadSettings()
m_settings.warnAgainstUnalignedBuildDir = s->value(
BUILD_DIR_WARNING_KEY, Utils::HostOsInfo::isWindowsHost()).toBool();
m_settings.alwaysRunQmake = s->value(ALWAYS_RUN_QMAKE_KEY, false).toBool();
m_settings.runSystemFunction = s->value(RUN_SYSTEM_KEY, false).toBool();
}
void QmakeSettings::storeSettings() const
@@ -92,6 +100,7 @@ void QmakeSettings::storeSettings() const
QSettings * const s = Core::ICore::settings();
s->setValue(BUILD_DIR_WARNING_KEY, warnAgainstUnalignedBuildDir());
s->setValue(ALWAYS_RUN_QMAKE_KEY, alwaysRunQmake());
s->setValue(RUN_SYSTEM_KEY, runSystemFunction());
}
class QmakeSettingsPage::SettingsWidget : public QWidget
@@ -110,9 +119,15 @@ public:
m_alwaysRunQmakeCheckbox.setToolTip(tr("This option can help to prevent failures on "
"incremental builds, but might slow them down unnecessarily in the general case."));
m_alwaysRunQmakeCheckbox.setChecked(QmakeSettings::alwaysRunQmake());
m_ignoreSystemCheckbox.setText(tr("Ignore qmake's system() function "
"when parsing a project"));
m_ignoreSystemCheckbox.setToolTip(tr("Unchecking this option can help getting more exact "
"parsing results, but can have unwanted side effects."));
m_ignoreSystemCheckbox.setChecked(!QmakeSettings::runSystemFunction());
const auto layout = new QVBoxLayout(this);
layout->addWidget(&m_warnAgainstUnalignedBuildDirCheckbox);
layout->addWidget(&m_alwaysRunQmakeCheckbox);
layout->addWidget(&m_ignoreSystemCheckbox);
layout->addStretch(1);
}
@@ -121,12 +136,14 @@ public:
QmakeSettingsData settings;
settings.warnAgainstUnalignedBuildDir = m_warnAgainstUnalignedBuildDirCheckbox.isChecked();
settings.alwaysRunQmake = m_alwaysRunQmakeCheckbox.isChecked();
settings.runSystemFunction = !m_ignoreSystemCheckbox.isChecked();
QmakeSettings::setSettingsData(settings);
}
private:
QCheckBox m_warnAgainstUnalignedBuildDirCheckbox;
QCheckBox m_alwaysRunQmakeCheckbox;
QCheckBox m_ignoreSystemCheckbox;
};
QmakeSettingsPage::QmakeSettingsPage()

View File

@@ -37,6 +37,7 @@ class QmakeSettingsData {
public:
bool warnAgainstUnalignedBuildDir = false;
bool alwaysRunQmake = false;
bool runSystemFunction = false;
};
class QmakeSettings : public QObject
@@ -46,6 +47,7 @@ public:
static QmakeSettings &instance();
static bool warnAgainstUnalignedBuildDir();
static bool alwaysRunQmake();
static bool runSystemFunction();
static void setSettingsData(const QmakeSettingsData &settings);
signals:

View File

@@ -6,7 +6,7 @@ endif()
add_qtc_plugin(QmlDesigner
DEPENDS
QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem
Qt5::QuickWidgets Qt5::CorePrivate
Qt5::QuickWidgets Qt5::CorePrivate Sqlite
DEFINES
DESIGNER_CORE_LIBRARY
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
@@ -208,6 +208,7 @@ extend_qtc_plugin(QmlDesigner
modelnodecontextmenu.cpp modelnodecontextmenu.h
modelnodecontextmenu_helper.cpp modelnodecontextmenu_helper.h
modelnodeoperations.cpp modelnodeoperations.h
navigation2d.cpp navigation2d.h
qmldesignericonprovider.cpp qmldesignericonprovider.h
selectioncontext.cpp selectioncontext.h
theme.cpp theme.h
@@ -316,6 +317,7 @@ extend_qtc_plugin(QmlDesigner
itemlibraryassetimportdialog.cpp itemlibraryassetimportdialog.h
itemlibraryassetimportdialog.ui
itemlibraryassetimporter.cpp itemlibraryassetimporter.h
itemlibraryiconimageprovider.cpp itemlibraryiconimageprovider.h
)
find_package(Qt5 COMPONENTS Quick3DAssetImport QUIET)
@@ -501,6 +503,7 @@ extend_qtc_plugin(QmlDesigner
include/textmodifier.h
include/variantproperty.h
include/viewmanager.h
include/imagecache.h
)
extend_qtc_plugin(QmlDesigner
@@ -585,6 +588,21 @@ extend_qtc_plugin(QmlDesigner
pluginmanager/widgetpluginmanager.cpp pluginmanager/widgetpluginmanager.h
pluginmanager/widgetpluginpath.cpp pluginmanager/widgetpluginpath.h
rewritertransaction.cpp rewritertransaction.h
imagecache/imagecachecollector.h
imagecache/imagecachecollector.cpp
imagecache/imagecache.cpp
imagecache/imagecachecollectorinterface.h
imagecache/imagecacheconnectionmanager.cpp
imagecache/imagecacheconnectionmanager.h
imagecache/imagecachegenerator.cpp
imagecache/imagecachegenerator.h
imagecache/imagecachestorage.h
imagecache/imagecachegeneratorinterface.h
imagecache/imagecachestorageinterface.h
imagecache/timestampproviderinterface.h
imagecache/timestampprovider.h
imagecache/timestampprovider.cpp
)
extend_qtc_plugin(QmlDesigner
@@ -644,6 +662,16 @@ extend_qtc_plugin(QmlDesigner
texttool/texttool.cpp texttool/texttool.h
)
extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components/previewtooltip
SOURCES
previewimagetooltip.cpp
previewimagetooltip.h
previewimagetooltip.ui
previewtooltipbackend.cpp
previewtooltipbackend.h
)
extend_qtc_plugin(QmlDesigner
SOURCES_PREFIX components/richtexteditor
SOURCES

View File

@@ -28,12 +28,12 @@
#include "assetexportpluginconstants.h"
#include "filepathmodel.h"
#include "coreplugin/fileutils.h"
#include "coreplugin/icore.h"
#include "projectexplorer/task.h"
#include "projectexplorer/taskhub.h"
#include "utils/fileutils.h"
#include "utils/outputformatter.h"
#include <coreplugin/fileutils.h>
#include <coreplugin/icore.h>
#include <projectexplorer/task.h>
#include <projectexplorer/taskhub.h>
#include <utils/fileutils.h>
#include <utils/outputformatter.h>
#include <QCheckBox>
#include <QPushButton>

View File

@@ -28,18 +28,34 @@
#include "richtexteditor/richtexteditor.h"
#include "QStringListModel"
namespace QmlDesigner {
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) :
QWidget(parent),
ui(new Ui::AnnotationCommentTab)
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
: QWidget(parent)
, ui(new Ui::AnnotationCommentTab)
{
ui->setupUi(this);
m_editor = new RichTextEditor;
ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor);
connect(ui->titleEdit, &QLineEdit::textEdited,
ui->titleEdit->setModel(new QStringListModel{QStringList{"Description",
"Display Condition",
"helper_lines"
"highlight"
"project author",
"project confirmed",
"project developer",
"project distributor",
"project modified",
"project type"
"project version",
"Screen Description"
"Section"}});
connect(ui->titleEdit, &QComboBox::currentTextChanged,
this, &AnnotationCommentTab::commentTitleChanged);
}
@@ -52,7 +68,7 @@ Comment AnnotationCommentTab::currentComment() const
{
Comment result;
result.setTitle(ui->titleEdit->text().trimmed());
result.setTitle(ui->titleEdit->currentText().trimmed());
result.setAuthor(ui->authorEdit->text().trimmed());
result.setText(m_editor->richText().trimmed());
@@ -77,7 +93,7 @@ void AnnotationCommentTab::setComment(const Comment &comment)
void AnnotationCommentTab::resetUI()
{
ui->titleEdit->setText(m_comment.title());
ui->titleEdit->setCurrentText(m_comment.title());
ui->authorEdit->setText(m_comment.author());
m_editor->setRichText(m_comment.deescapedText());

View File

@@ -24,7 +24,11 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="titleEdit"/>
<widget class="QComboBox" name="titleEdit">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel">

View File

@@ -14,6 +14,7 @@ SOURCES += modelnodecontextmenu_helper.cpp
SOURCES += selectioncontext.cpp
SOURCES += designeractionmanager.cpp
SOURCES += modelnodeoperations.cpp
SOURCES += navigation2d.cpp
SOURCES += crumblebar.cpp
SOURCES += qmldesignericonprovider.cpp
SOURCES += zoomaction.cpp
@@ -33,6 +34,7 @@ HEADERS += selectioncontext.h
HEADERS += componentcore_constants.h
HEADERS += designeractionmanager.h
HEADERS += modelnodeoperations.h
HEADERS += navigation2d.h
HEADERS += actioninterface.h
HEADERS += crumblebar.h
HEADERS += qmldesignericonprovider.h

View File

@@ -347,11 +347,11 @@ public:
&& !selectionContext().currentSingleSelectedNode().isRootNode()
&& selectionContext().currentSingleSelectedNode().hasParentProperty()) {
ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select);
selectionAction->setParent(menu());
parentNode = selectionContext().currentSingleSelectedNode().parentProperty().parentModelNode();
if (!ModelNode::isThisOrAncestorLocked(parentNode)) {
ActionTemplate *selectionAction = new ActionTemplate(QString(), &ModelNodeOperations::select);
selectionAction->setParent(menu());
selectionAction->setText(QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select parent: %1")).arg(
captionForModelNode(parentNode)));
@@ -361,11 +361,13 @@ public:
menu()->addAction(selectionAction);
}
foreach (const ModelNode &node, selectionContext().view()->allModelNodes()) {
}
for (const ModelNode &node : selectionContext().view()->allModelNodes()) {
if (node != selectionContext().currentSingleSelectedNode()
&& node != parentNode
&& contains(node, selectionContext().scenePosition())
&& !node.isRootNode()) {
&& !node.isRootNode()
&& !ModelNode::isThisOrAncestorLocked(node)) {
selectionContext().setTargetNode(node);
QString what = QString(QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Select: %1")).arg(captionForModelNode(node));
ActionTemplate *selectionAction = new ActionTemplate(what, &ModelNodeOperations::select);
@@ -377,6 +379,9 @@ public:
menu()->addAction(selectionAction);
}
}
if (menu()->isEmpty())
action()->setEnabled(false);
}
}
};
@@ -574,11 +579,6 @@ bool multiSelection(const SelectionContext &context)
return !singleSelection(context) && selectionNotEmpty(context);
}
bool singleSelectionAndInBaseState(const SelectionContext &context)
{
return singleSelection(context) && inBaseState(context);
}
bool multiSelectionAndInBaseState(const SelectionContext &context)
{
return multiSelection(context) && inBaseState(context);
@@ -828,6 +828,11 @@ bool studioComponentsAvailable(const SelectionContext &context)
return context.view()->model()->isImportPossible(import, true, true);
}
bool studioComponentsAvailableAndSelectionCanBeLayouted(const SelectionContext &context)
{
return selectionCanBeLayouted(context) && studioComponentsAvailable(context);
}
bool singleSelectedAndUiFile(const SelectionContext &context)
{
if (!singleSelection(context))
@@ -882,6 +887,12 @@ bool raiseAvailable(const SelectionContext &selectionState)
return parentProperty.indexOf(modelNode) < parentProperty.count() - 1;
}
bool anchorsMenuEnabled(const SelectionContext &context)
{
return singleSelectionItemIsNotAnchoredAndSingleSelectionNotRoot(context)
|| singleSelectionItemIsAnchored(context);
}
void DesignerActionManager::createDefaultDesignerActions()
{
using namespace SelectionContextFunctors;
@@ -996,11 +1007,10 @@ void DesignerActionManager::createDefaultDesignerActions()
&setVisible,
&singleSelectedItem));
addDesignerAction(new ActionGroup(
anchorsCategoryDisplayName,
addDesignerAction(new ActionGroup(anchorsCategoryDisplayName,
anchorsCategory,
priorityAnchorsCategory,
&singleSelectionAndInBaseState));
&anchorsMenuEnabled));
addDesignerAction(new ModelNodeAction(
anchorsFillCommandId,
@@ -1042,7 +1052,7 @@ void DesignerActionManager::createDefaultDesignerActions()
addDesignerAction(new ActionGroup(groupCategoryDisplayName,
groupCategory,
priorityGroupCategory,
&studioComponentsAvailable));
&studioComponentsAvailableAndSelectionCanBeLayouted));
addDesignerAction(new ActionGroup(
flowCategoryDisplayName,

View File

@@ -0,0 +1,91 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "navigation2d.h"
#include <QGestureEvent>
#include <QWheelEvent>
namespace QmlDesigner {
Navigation2dScrollBar::Navigation2dScrollBar(QWidget *parent)
: QScrollBar(parent)
{}
bool Navigation2dScrollBar::postEvent(QEvent *event)
{
if (event->type() == QEvent::Wheel) {
wheelEvent(static_cast<QWheelEvent *>(event));
return true;
}
return false;
}
void Navigation2dScrollBar::wheelEvent(QWheelEvent *event)
{
if (!event->angleDelta().isNull())
QScrollBar::wheelEvent(event);
}
Navigation2dFilter::Navigation2dFilter(QWidget *parent, Navigation2dScrollBar *scrollbar)
: QObject(parent)
, m_scrollbar(scrollbar)
{
if (parent)
parent->grabGesture(Qt::PinchGesture);
}
bool Navigation2dFilter::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent *>(event));
else if (event->type() == QEvent::Wheel && m_scrollbar)
return wheelEvent(static_cast<QWheelEvent *>(event));
return QObject::event(event);
}
bool Navigation2dFilter::gestureEvent(QGestureEvent *event)
{
if (QPinchGesture *pinch = static_cast<QPinchGesture *>(event->gesture(Qt::PinchGesture))) {
QPinchGesture::ChangeFlags changeFlags = pinch->changeFlags();
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
emit zoomChanged(-(1.0 - pinch->scaleFactor()), pinch->startCenterPoint());
event->accept();
return true;
}
}
return false;
}
bool Navigation2dFilter::wheelEvent(QWheelEvent *event)
{
if (m_scrollbar->postEvent(event))
event->ignore();
return false;
}
} // End namespace QmlDesigner.

View File

@@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QScrollBar>
QT_FORWARD_DECLARE_CLASS(QGestureEvent)
QT_FORWARD_DECLARE_CLASS(QWheelEvent)
namespace QmlDesigner {
class Navigation2dScrollBar : public QScrollBar
{
Q_OBJECT
public:
Navigation2dScrollBar(QWidget *parent = nullptr);
bool postEvent(QEvent *event);
protected:
void wheelEvent(QWheelEvent *event) override;
};
class Navigation2dFilter : public QObject
{
Q_OBJECT
signals:
void zoomChanged(double scale, const QPointF &pos);
public:
Navigation2dFilter(QWidget *parent = nullptr, Navigation2dScrollBar *scrollbar = nullptr);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
private:
bool gestureEvent(QGestureEvent *event);
bool wheelEvent(QWheelEvent *event);
Navigation2dScrollBar *m_scrollbar = nullptr;
};
} // namespace QmlDesigner

View File

@@ -107,6 +107,8 @@ public:
idAliasOff,
idAliasOn,
listView,
lockOff,
lockOn,
mergeCells,
minus,
plus,
@@ -129,6 +131,8 @@ public:
undo,
upDownIcon,
upDownSquare2,
visibilityOff,
visibilityOn,
wildcard,
zoomAll,
zoomIn,

View File

@@ -75,6 +75,23 @@ ConnectionModel::ConnectionModel(ConnectionView *parent)
connect(this, &QStandardItemModel::dataChanged, this, &ConnectionModel::handleDataChanged);
}
Qt::ItemFlags ConnectionModel::flags(const QModelIndex &modelIndex) const
{
if (!modelIndex.isValid())
return Qt::ItemIsEnabled;
if (!m_connectionView || !m_connectionView->model())
return Qt::ItemIsEnabled;
const int internalId = data(index(modelIndex.row(), TargetModelNodeRow), UserRoles::InternalIdRole).toInt();
ModelNode modelNode = m_connectionView->modelNodeForInternalId(internalId);
if (modelNode.isValid() && ModelNode::isThisOrAncestorLocked(modelNode))
return Qt::ItemIsEnabled;
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
}
void ConnectionModel::resetModel()
{
beginResetModel();
@@ -82,7 +99,7 @@ void ConnectionModel::resetModel()
setHorizontalHeaderLabels(QStringList({ tr("Target"), tr("Signal Handler"), tr("Action") }));
if (connectionView()->isAttached()) {
for (const ModelNode modelNode : connectionView()->allModelNodes())
for (const ModelNode &modelNode : connectionView()->allModelNodes())
addModelNode(modelNode);
}
@@ -94,8 +111,8 @@ void ConnectionModel::resetModel()
SignalHandlerProperty ConnectionModel::signalHandlerPropertyForRow(int rowNumber) const
{
const int internalId = data(index(rowNumber, TargetModelNodeRow), Qt::UserRole + 1).toInt();
const QString targetPropertyName = data(index(rowNumber, TargetModelNodeRow), Qt::UserRole + 2).toString();
const int internalId = data(index(rowNumber, TargetModelNodeRow), UserRoles::InternalIdRole).toInt();
const QString targetPropertyName = data(index(rowNumber, TargetModelNodeRow), UserRoles::TargetPropertyNameRole).toString();
ModelNode modelNode = connectionView()->modelNodeForInternalId(internalId);
if (modelNode.isValid())
@@ -256,8 +273,8 @@ void ConnectionModel::updateTargetNode(int rowNumber)
void ConnectionModel::updateCustomData(QStandardItem *item, const SignalHandlerProperty &signalHandlerProperty)
{
item->setData(signalHandlerProperty.parentModelNode().internalId(), Qt::UserRole + 1);
item->setData(signalHandlerProperty.name(), Qt::UserRole + 2);
item->setData(signalHandlerProperty.parentModelNode().internalId(), UserRoles::InternalIdRole);
item->setData(signalHandlerProperty.name(), UserRoles::TargetPropertyNameRole);
}
ModelNode ConnectionModel::getTargetNodeForConnection(const ModelNode &connection) const

Some files were not shown because too many files have changed in this diff Show More