Merge remote-tracking branch 'origin/4.15'

Change-Id: Ic839ab43a723ab22cc83e5b0d823ec6121cb6701
This commit is contained in:
Eike Ziller
2021-05-10 13:50:43 +02:00
25 changed files with 190 additions and 111 deletions

View File

@@ -7,7 +7,7 @@ instructions:
variableValue: "RelWithDebInfo"
- type: EnvironmentVariable
variableName: QTC_QT_BASE_URL
variableValue: "http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/archive/qt/6.1/6.1.0-beta3-released"
variableValue: "http://ci-files02-hki-infra.intra.qt.io/packages/jenkins/archive/qt/6.1/6.1.0-final-released"
- type: EnvironmentVariable
variableName: QTC_QT_MODULES
variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations"

View File

@@ -8,9 +8,18 @@ Module {
Depends { name: "cpp" }
cpp.defines: [
"_HAVE_SQLITE_CONFIG_H", "SQLITE_CORE"
].concat(buildSharedLib ? "BUILD_SQLITE_LIBRARY" : "BUILD_SQLITE_STATIC_LIBRARY")
cpp.defines: {
var defines = ["_HAVE_SQLITE_CONFIG_H", "SQLITE_CORE"];
if (buildSharedLib)
defines.push("BUILD_SQLITE_LIBRARY");
else
defines.push("BUILD_SQLITE_STATIC_LIBRARY");
if (qbs.targetOS.contains("linux"))
defines.push("_POSIX_C_SOURCE=200809L", "_GNU_SOURCE");
else if (qbs.targetOS.contains("macos"))
defines.push("_BSD_SOURCE");
return defines;
}
cpp.dynamicLibraries: base.concat((qbs.targetOS.contains("unix") && !qbs.targetOS.contains("bsd"))
? ["dl", "pthread"] : [])
@@ -31,10 +40,12 @@ Module {
prefix: sqlite_sources.sqliteDir3rdParty + '/'
cpp.warningLevel: "none"
files: [
"carray.c",
"config.h",
"sqlite3.c",
"sqlite3.h",
"sqlite.h",
"sqlite3ext.h",
"carray.c"
]
}
}

View File

@@ -142,17 +142,9 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 0,
"items":
[
{
"trKey": "Default",
"value":
{
"QtQuickControlsStyle": "Default",
"QtQuickControlsStyleTheme": ""
}
},
{
"trKey": "Material Light",
"value":

View File

@@ -142,17 +142,9 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 0,
"items":
[
{
"trKey": "Default",
"value":
{
"QtQuickControlsStyle": "Default",
"QtQuickControlsStyleTheme": ""
}
},
{
"trKey": "Material Light",
"value":

View File

@@ -142,17 +142,9 @@
"type": "ComboBox",
"data":
{
"index": 1,
"index": 0,
"items":
[
{
"trKey": "Default",
"value":
{
"QtQuickControlsStyle": "Default",
"QtQuickControlsStyleTheme": ""
}
},
{
"trKey": "Material Light",
"value":

View File

@@ -66,15 +66,24 @@ static bool isCatchMacro(const QString &macroName)
static bool includesCatchHeader(const CPlusPlus::Document::Ptr &doc,
const CPlusPlus::Snapshot &snapshot)
{
static const QString catchHeader("catch.hpp");
static const QStringList catchHeaders{"catch.hpp", // v2
"catch_all.hpp", // v3 - new approach
"catch_amalgamated.hpp",
"catch_test_macros.hpp",
"catch_template_test_macros.hpp"
};
for (const CPlusPlus::Document::Include &inc : doc->resolvedIncludes()) {
if (inc.resolvedFileName().endsWith(catchHeader))
return true;
for (const QString &catchHeader : catchHeaders) {
if (inc.resolvedFileName().endsWith(catchHeader))
return true;
}
}
for (const QString &include : snapshot.allIncludesForDocument(doc->fileName())) {
if (include.endsWith(catchHeader))
return true;
for (const QString &catchHeader : catchHeaders) {
if (include.endsWith(catchHeader))
return true;
}
}
return false;

View File

@@ -623,10 +623,6 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item)
bool foundPartiallyChecked = false;
item->forFirstLevelChildren([&](ITestTreeItem *child) {
if (foundPartiallyChecked || (foundChecked && foundUnchecked)) {
newState = Qt::PartiallyChecked;
return;
}
switch (child->type()) {
case TestTreeItem::TestDataFunction:
case TestTreeItem::TestSpecialFunction:
@@ -638,6 +634,11 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item)
foundChecked |= (child->checked() == Qt::Checked);
foundUnchecked |= (child->checked() == Qt::Unchecked);
foundPartiallyChecked |= (child->checked() == Qt::PartiallyChecked);
if (foundPartiallyChecked || (foundChecked && foundUnchecked)) {
newState = Qt::PartiallyChecked;
return;
}
});
if (newState != Qt::PartiallyChecked)

View File

@@ -1102,10 +1102,12 @@ void CppModelManager::watchForCanceledProjectIndexer(const QFuture<void> &future
connect(watcher, &QFutureWatcher<void>::canceled, this, [this, project, watcher]() {
if (d->m_projectToIndexerCanceled.contains(project)) // Project not yet removed
d->m_projectToIndexerCanceled.insert(project, true);
watcher->disconnect(this);
watcher->deleteLater();
});
connect(watcher, &QFutureWatcher<void>::finished, this, [this, project, watcher]() {
d->m_projectToIndexerCanceled.remove(project);
watcher->disconnect(this);
watcher->deleteLater();
});
watcher->setFuture(future);

View File

@@ -53,7 +53,7 @@ CppProjectUpdater::~CppProjectUpdater()
void CppProjectUpdater::update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo)
{
// Stop previous update.
cancelAndWaitForFinished();
cancel();
m_projectUpdateInfo = projectUpdateInfo;
@@ -93,7 +93,7 @@ void CppProjectUpdater::onToolChainRemoved(ProjectExplorer::ToolChain *t)
{
QTC_ASSERT(t, return);
if (t == m_projectUpdateInfo.cToolChain || t == m_projectUpdateInfo.cxxToolChain)
cancelAndWaitForFinished();
cancel();
}
void CppProjectUpdater::onProjectInfoGenerated()

View File

@@ -87,6 +87,13 @@ protected:
void supportDisablingForSubdirs() { m_disablingForSubDirsSupported = true; }
virtual QStringList displayArguments() const;
Utils::StringAspect *makeCommandAspect() const { return m_makeCommandAspect; }
Utils::MultiSelectionAspect *buildTargetsAspect() const { return m_buildTargetsAspect; }
Utils::StringAspect *userArgumentsAspect() const { return m_userArgumentsAspect; }
Utils::AspectContainer *jobCountContainer() const { return m_jobCountContainer; }
Utils::BoolAspect *disabledForSubdirsAspect() const { return m_disabledForSubdirsAspect; }
private:
static int defaultJobCount();
QStringList jobArguments() const;

View File

@@ -64,11 +64,18 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
{
auto comboBox = new QComboBox(parent);
comboBox->setToolTip(tr(enabledTooltip));
// The Default style was renamed to Basic in Qt 6. In Qt 6, "Default"
// will result in a platform-specific style being chosen.
comboBox->addItem("Basic");
comboBox->addItem("Default");
comboBox->addItem("Fusion");
comboBox->addItem("Imagine");
if (Utils::HostOsInfo::isMacHost())
comboBox->addItem("macOS");
comboBox->addItem("Material");
comboBox->addItem("Universal");
if (Utils::HostOsInfo::isWindowsHost())
comboBox->addItem("Windows");
comboBox->setEditable(true);
comboBox->setCurrentIndex(0);
@@ -128,7 +135,7 @@ void ChangeStyleAction::currentContextChanged(const SelectionContext &selectionC
if (Utils::FilePath::fromString(confFileName).exists()) {
QSettings infiFile(confFileName, QSettings::IniFormat);
m_action->handleModelUpdate(infiFile.value("Controls/Style", "Default").toString());
m_action->handleModelUpdate(infiFile.value("Controls/Style", "Basic").toString());
} else {
m_action->handleModelUpdate("");
}

View File

@@ -93,6 +93,11 @@ AnimationCurve::AnimationCurve(const QEasingCurve &easing, const QPointF &start,
analyze();
}
bool AnimationCurve::isEmpty() const
{
return m_frames.empty();
}
bool AnimationCurve::isValid() const
{
return m_frames.size() >= 2;
@@ -352,45 +357,43 @@ void AnimationCurve::insert(double time)
void AnimationCurve::analyze()
{
if (isValid()) {
m_minY = std::numeric_limits<double>::max();
m_maxY = std::numeric_limits<double>::lowest();
m_minY = std::numeric_limits<double>::max();
m_maxY = std::numeric_limits<double>::lowest();
auto byTime = [](const auto &a, const auto &b) {
return a.position().x() < b.position().x();
};
std::sort(m_frames.begin(), m_frames.end(), byTime);
auto byTime = [](const auto &a, const auto &b) {
return a.position().x() < b.position().x();
};
std::sort(m_frames.begin(), m_frames.end(), byTime);
for (auto e : extrema()) {
if (m_minY > e.y())
m_minY = e.y();
for (auto e : extrema()) {
if (m_minY > e.y())
m_minY = e.y();
if (m_maxY < e.y())
m_maxY = e.y();
if (m_maxY < e.y())
m_maxY = e.y();
}
for (auto &frame : qAsConst(m_frames)) {
if (frame.position().y() < m_minY)
m_minY = frame.position().y();
if (frame.position().y() > m_maxY)
m_maxY = frame.position().y();
if (frame.hasLeftHandle()) {
if (frame.leftHandle().y() < m_minY)
m_minY = frame.leftHandle().y();
if (frame.leftHandle().y() > m_maxY)
m_maxY = frame.leftHandle().y();
}
for (auto &frame : qAsConst(m_frames)) {
if (frame.position().y() < m_minY)
m_minY = frame.position().y();
if (frame.hasRightHandle()) {
if (frame.rightHandle().y() < m_minY)
m_minY = frame.rightHandle().y();
if (frame.position().y() > m_maxY)
m_maxY = frame.position().y();
if (frame.hasLeftHandle()) {
if (frame.leftHandle().y() < m_minY)
m_minY = frame.leftHandle().y();
if (frame.leftHandle().y() > m_maxY)
m_maxY = frame.leftHandle().y();
}
if (frame.hasRightHandle()) {
if (frame.rightHandle().y() < m_minY)
m_minY = frame.rightHandle().y();
if (frame.rightHandle().y() > m_maxY)
m_maxY = frame.rightHandle().y();
}
if (frame.rightHandle().y() > m_maxY)
m_maxY = frame.rightHandle().y();
}
}
}

View File

@@ -46,6 +46,8 @@ public:
AnimationCurve(const QEasingCurve &easing, const QPointF &start, const QPointF &end);
bool isEmpty() const;
bool isValid() const;
bool isFromData() const;

View File

@@ -255,7 +255,7 @@ TreeItem *CurveEditorModel::createTopLevelItem(const QmlDesigner::QmlTimeline &t
for (auto &&grp : timeline.keyframeGroupsForTarget(node)) {
if (grp.isValid()) {
AnimationCurve curve = createAnimationCurve(grp);
if (curve.isValid()) {
if (!curve.isEmpty()) {
QString name = QString::fromUtf8(grp.propertyName());
auto propertyItem = new PropertyTreeItem(name, curve, typeFrom(grp));

View File

@@ -101,6 +101,9 @@ void CurveEditorView::nodeRemoved(const ModelNode &removedNode,
ModelNode parent = parentProperty.parentModelNode();
if (dirtyfiesView(parent))
updateKeyframes();
if (!activeTimeline().isValid())
m_model->reset({});
}
void CurveEditorView::nodeReparented(const ModelNode &node,

View File

@@ -292,7 +292,7 @@ std::vector<AnimationCurve> CurveItem::curves() const
}
}
if (tmp.size() >= 2)
if (!tmp.empty())
out.push_back(AnimationCurve(tmp));
return out;
@@ -372,6 +372,9 @@ void CurveItem::restore()
currItem->setInterpolation(segment.interpolation());
prevItem = currItem;
}
// It is now the last item.
prevItem->setRightHandle(QPointF());
}
void CurveItem::setDirty(bool dirty)
@@ -404,12 +407,12 @@ void CurveItem::setCurve(const AnimationCurve &curve)
item->setLocked(locked());
item->setComponentTransform(m_transform);
m_keyframes.push_back(item);
QObject::connect(item, &KeyframeItem::redrawCurve, this, &CurveItem::emitCurveChanged);
QObject::connect(item, &KeyframeItem::redrawCurve, this, &CurveItem::markDirty);
QObject::connect(item, &KeyframeItem::keyframeMoved, this, &CurveItem::keyframeMoved);
QObject::connect(item, &KeyframeItem::handleMoved, this, &CurveItem::handleMoved);
}
emitCurveChanged();
markDirty();
}
QRectF CurveItem::setComponentTransform(const QTransform &transform)
@@ -499,10 +502,12 @@ void CurveItem::deleteSelectedKeyframes()
m_keyframes.erase(iter, m_keyframes.end());
restore();
emitCurveChanged();
markDirty();
emit curveChanged(id(), curve());
}
void CurveItem::emitCurveChanged()
void CurveItem::markDirty()
{
setDirty(true);
update();

View File

@@ -134,7 +134,7 @@ public:
void deleteSelectedKeyframes();
private:
void emitCurveChanged();
void markDirty();
unsigned int m_id;

View File

@@ -216,6 +216,7 @@ void GraphicsScene::reset()
void GraphicsScene::deleteSelectedKeyframes()
{
m_dirty = true;
for (auto *curve : qAsConst(m_curves))
curve->deleteSelectedKeyframes();
}

View File

@@ -72,8 +72,8 @@ GraphicsView::GraphicsView(CurveEditorModel *model, QWidget *parent)
connect(&m_dialog, &CurveEditorStyleDialog::styleChanged, this, &GraphicsView::setStyle);
auto itemSlot = [this](unsigned int id, const AnimationCurve &curve) {
applyZoom(m_zoomX, m_zoomY);
m_model->setCurve(id, curve);
applyZoom(m_zoomX, m_zoomY);
};
connect(m_scene, &GraphicsScene::curveChanged, itemSlot);
@@ -671,11 +671,15 @@ void GraphicsView::drawValueScale(QPainter *painter, const QRectF &rect)
painter->drawText(textRect, Qt::AlignCenter, valueText);
};
double density = 1. / (static_cast<double>(fm.height()) * m_style.labelDensityY);
Axis axis = Axis::compute(minimumValue(), maximumValue(), rect.height(), density);
const double eps = 1.0e-10;
for (double i = axis.lmin; i <= axis.lmax + eps; i += axis.lstep)
paintLabeledTick(i);
double min = minimumValue();
double max = maximumValue();
if (std::isfinite(min) && std::isfinite(max) && rect.isValid()) {
double density = 1. / (static_cast<double>(fm.height()) * m_style.labelDensityY);
Axis axis = Axis::compute(min, max, rect.height(), density);
const double eps = 1.0e-10;
for (double i = axis.lmin; i <= axis.lmax + eps; i += axis.lstep)
paintLabeledTick(i);
}
painter->restore();
}

View File

@@ -242,13 +242,8 @@ void TimelineFrameHandle::scrollOutOfBoundsMax()
{
const double width = abstractScrollGraphicsScene()->width();
if (QApplication::mouseButtons() == Qt::LeftButton) {
const double frameWidth = abstractScrollGraphicsScene()->rulerScaling();
const double upperThreshold = width - frameWidth;
if (rect().center().x() > upperThreshold) {
abstractScrollGraphicsScene()->setScrollOffset(computeScrollSpeed());
abstractScrollGraphicsScene()->invalidateScrollbar();
}
abstractScrollGraphicsScene()->setScrollOffset(computeScrollSpeed());
abstractScrollGraphicsScene()->invalidateScrollbar();
callSetClampedXPosition(width - (rect().width() / 2) - 1);
m_timer.start();

View File

@@ -25,12 +25,13 @@
#pragma once
#include <QObject>
#include <QDebug>
#include <QDataStream>
#include <QDebug>
#include <QJsonObject>
#include <QObject>
#include "qmldesignercorelib_global.h"
#include "nodeinstanceglobal.h"
#include "qmldesignercorelib_global.h"
namespace QmlDesigner {
@@ -97,6 +98,8 @@ public:
bool isEmpty() const;
QString toQString() const;
QJsonValue toJsonValue() const;
bool fromJsonValue(QJsonValue const &);
friend QDebug &operator<<(QDebug &stream, const Comment &comment);
@@ -130,6 +133,8 @@ public:
QString toQString() const;
void fromQString(const QString &str);
QJsonValue toJsonValue() const;
bool fromJsonValue(QJsonValue const &);
friend QDebug &operator<<(QDebug &stream, const Annotation &annotation);

View File

@@ -487,7 +487,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
#else
const QString controlsStyle;
#endif
if (!controlsStyle.isEmpty() && controlsStyle != "Default") {
if (!controlsStyle.isEmpty()) {
environment.set("QT_QUICK_CONTROLS_STYLE", controlsStyle);
environment.set("QT_LABS_CONTROLS_STYLE", controlsStyle);
}
@@ -498,13 +498,6 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
const QString styleConfigFileName = getStyleConfigFileName();
/* QT_QUICK_CONTROLS_CONF is not supported for Qt Version < 5.8.1,
* but we can manually at least set the correct style. */
if (!styleConfigFileName.isEmpty()) {
QSettings infiFile(styleConfigFileName, QSettings::IniFormat);
environment.set("QT_QUICK_CONTROLS_STYLE", infiFile.value("Controls/Style", "Default").toString());
}
if (!m_qrcMapping.isEmpty()) {
environment.set("QMLDESIGNER_RC_PATHS", m_qrcMapping);
}

View File

@@ -26,6 +26,7 @@
#include "annotation.h"
#include <QDateTime>
#include <QJsonArray>
#include <QString>
namespace QmlDesigner {
@@ -150,6 +151,27 @@ QString Comment::toQString() const
return result.join(s_sep);
}
QJsonValue Comment::toJsonValue() const
{
return QJsonObject{
{{"title", m_title}, {"author", m_author}, {"text", m_text}, {"timestamp", m_timestamp}}};
};
bool Comment::fromJsonValue(QJsonValue const &v)
{
if (!v.isObject())
return false;
auto obj = v.toObject();
Comment comment;
comment.m_title = obj["title"].toString();
comment.m_author = obj["author"].toString();
comment.m_text = obj["text"].toString();
comment.m_timestamp = obj["timestamp"].toInt();
*this = comment;
return true;
}
QDebug &operator<<(QDebug &stream, const Comment &comment)
{
stream << "\"title: " << comment.m_title << "\" ";
@@ -299,6 +321,33 @@ void Annotation::fromQString(const QString &str)
}
}
QJsonValue Annotation::toJsonValue() const
{
QJsonObject obj;
QJsonArray comments;
for (auto &comment : m_comments)
comments.push_back(comment.toJsonValue());
obj["comments"] = comments;
return obj;
}
bool Annotation::fromJsonValue(const QJsonValue &v)
{
if (!v.isObject())
return false;
auto obj = v.toObject();
auto jsonComments = obj["comments"].toArray();
m_comments.clear();
for (auto json : jsonComments) {
Comment comment;
if (comment.fromJsonValue(json))
m_comments.push_back(comment);
}
return true;
}
QDebug &operator<<(QDebug &stream, const Annotation &annotation)
{
stream << "\"Annotation: " << annotation.m_comments << "\" ";

View File

@@ -58,6 +58,12 @@ const char CustomCommandLineAspectId[] = "RemoteLinux.MakeInstall.CustomCommandL
MakeInstallStep::MakeInstallStep(BuildStepList *parent, Utils::Id id) : MakeStep(parent, id)
{
makeCommandAspect()->setVisible(false);
buildTargetsAspect()->setVisible(false);
userArgumentsAspect()->setVisible(false);
jobCountContainer()->setVisible(false);
disabledForSubdirsAspect()->setVisible(false);
const auto makeAspect = addAspect<ExecutableAspect>();
makeAspect->setId(MakeAspectId);
makeAspect->setSettingsKey(MakeAspectId);

View File

@@ -5135,11 +5135,11 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP
TextMarks marks = userData->marks();
TextMarks::const_iterator it = marks.constBegin();
if (marks.size() > 3) {
// We want the 3 with the highest priority so iterate from the back
// We want the 3 with the highest priority that have an icon so iterate from the back
int count = 0;
it = marks.constEnd() - 1;
while (it != marks.constBegin()) {
if ((*it)->isVisible())
if ((*it)->isVisible() && !(*it)->icon().isNull())
++count;
if (count == 3)
break;
@@ -5149,7 +5149,7 @@ void TextEditorWidgetPrivate::paintTextMarks(QPainter &painter, const ExtraAreaP
TextMarks::const_iterator end = marks.constEnd();
for ( ; it != end; ++it) {
TextMark *mark = *it;
if (!mark->isVisible())
if (!mark->isVisible() && !mark->icon().isNull())
continue;
const int height = data.lineSpacing - 1;
const int width = int(.5 + height * mark->widthFactor());