Merge remote-tracking branch 'origin/3.4'

Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
This commit is contained in:
Eike Ziller
2015-05-26 15:12:42 +02:00
38 changed files with 330 additions and 96 deletions

65
dist/changes-3.4.1.md vendored Normal file
View File

@@ -0,0 +1,65 @@
Qt Creator version 3.4.1 contains bug fixes.
The most important changes are listed in this document. For a complete
list of changes, see the Git log for the Qt Creator sources that
you can check out from the public Git repository. For example:
git clone git://code.qt.io/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline v3.4.0..v3.4.1
General
* Fixed that disabling some plugins could disable the plugin
management UI for most plugins
* Fixed auto-expansion of first set of search results (QTCREATORBUG-14320)
Editing
* Fixed that CSS files were opened in C++ editor (QTCREATORBUG-14334)
* Fixed that the completion popup could become huge
(QTCREATORBUG-14331)
Project Management
* Fixed adding static libraries with `Add Library` wizard
(QTCREATORBUG-14382)
* Fixed broken documentation link in session manager
(QTCREATORBUG-14459)
CMake Projects
* Fixed parsing of C++ flags for Ninja projects
Debugging
* Fixed that executables starting with `lldb-platform-` were detected
as debugger (QTCREATORBUG-14309)
* Fixed attaching to running debug server when developing
cross-platform (QTCREATORBUG-14412)
* CDB
* Fixed that stepping into frame without source would step out
instead (QTCREATORBUG-9677)
QML Profiler
* Fixed that events with no duration were not visible
(QTCREATORBUG-14446)
C++ Support
* Added completion for `override` and `final` (QTCREATORBUG-11341)
* Fixed completion after comments starting with `///`
(QTCREATORBUG-8597)
QML Support
* Fixed completion for QtQml and QtQml.Models (QTCREATORBUG-13780)
Platform Specific
OS X
* Fixed broken library paths for qbs executables (QTCREATORBUG-14432)
BareMetal
* Fixed issues when moving from Qt Creator 3.3 to Qt Creator 3.4

View File

@@ -271,9 +271,19 @@
\li Some versions of Perf will not start recording unless given a
certain minimum sampling frequency. Try with a
\uicontrol {Sampling Frequency} of 1000.
\li On some devices, Perf support is not very stable and the Linux
kernel may randomly fail to record data after some time. Reboot the
device and try again.
\li On some devices, for example Boundary Devices i.MX6 Boards, the
Perf support is not very stable and the Linux kernel may randomly
fail to record data after some time. Perf can use different types
of events to trigger samples. You can get a list of available event
types by running \c {perf list} on the device and add
\c {-e <event type>} to the \uicontrol {Additional arguments} field
to change the event type to be used. The choice of event type
affects the performance and stability of the sampling.
\c {-e cpu-clock} is a safe but relatively slow option as it
does not use the hardware performance counters, but drives the
sampling from software. After the sampling has failed, reboot the
device. The kernel may have disabled important parts of the
performance counters system.
\endlist
Output from the helper program that processes the data is displayed in the

View File

@@ -83,6 +83,8 @@ if [ ! -d "$1/Contents/Frameworks/QtCore.framework" ]; then
qml2puppetArgument="-executable=$qml2puppetapp"
fi
qbsapp="$1/Contents/MacOS/qbs"
echo "- Running macdeployqt ($(which macdeployqt))"
macdeployqt "$1" \
@@ -91,6 +93,14 @@ if [ ! -d "$1/Contents/Frameworks/QtCore.framework" ]; then
"-executable=$1/Contents/Resources/ios/iostool" \
"-executable=$1/Contents/Resources/ios/iossim" \
"-executable=$1/Contents/Resources/ios/iossim_1_8_2" \
"-executable=$1/Contents/MacOS/buildoutputparser" \
"-executable=$qbsapp" \
"-executable=$qbsapp-config" \
"-executable=$qbsapp-config-ui" \
"-executable=$qbsapp-qmltypes" \
"-executable=$qbsapp-setup-android" \
"-executable=$qbsapp-setup-qt" \
"-executable=$qbsapp-setup-toolchains" \
"$qmlpuppetArgument" "$qml2puppetArgument" || exit 1
fi

View File

@@ -16,7 +16,7 @@ while (my $line = <STDIN> ) {
chomp($line);
# --- extract file name based matching:
# c:\foo.cpp(395) : warning C4800: 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
if ($line =~ /^([^(]+)\((\d+)\) : warning (C\d+:.*)$/) {
if ($line =~ /^([^(]+)\((\d+)\) ?: warning (C\d+:.*)$/) {
my $fileName = $1;
my $lineNumber = $2;
my $text = $3;

View File

@@ -10190,14 +10190,6 @@ This feature is only available for GDB.</source>
<source>There is no CDB executable specified.</source>
<translation>Программа CDB не указана.</translation>
</message>
<message>
<source>CDB crashed</source>
<translation>CDB завершился крахом</translation>
</message>
<message>
<source>CDB exited (%1)</source>
<translation>CDB завершился (%1)</translation>
</message>
<message>
<source>Unable to add expression</source>
<translation>Не удалось добавить выражение</translation>
@@ -19672,6 +19664,10 @@ Ids must begin with a lowercase letter.</source>
<source>CMake Project file</source>
<translation>Файл проекта CMake</translation>
</message>
<message>
<source>C source code</source>
<translation>Файл исходных текстов C</translation>
</message>
<message>
<source>C header</source>
<translation>Заголовочный файл C</translation>

View File

@@ -42,6 +42,7 @@
#define CPLUSPLUS_NO_DEBUG_RULE
#define MAX_EXPRESSION_DEPTH 100
#define MAX_STATEMENT_DEPTH 100
#define MAX_INITIALIZER_CLAUSE_DEPTH 2000
using namespace CPlusPlus;
@@ -2785,6 +2786,8 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
ExpressionListAST **expression_list_ptr = &node;
ExpressionAST *expression = 0;
_initializerClauseDepth.push(1);
if (parseInitializerClause0x(expression)) {
*expression_list_ptr = new (_pool) ExpressionListAST;
(*expression_list_ptr)->value = expression;
@@ -2793,7 +2796,11 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
if (_languageFeatures.cxx11Enabled && LA() == T_DOT_DOT_DOT && (LA(2) == T_COMMA || LA(2) == T_RBRACE || LA(2) == T_RPAREN))
consumeToken(); // ### create an argument pack
while (LA() == T_COMMA && LA(2) != T_RBRACE) {
for (++_initializerClauseDepth.top();
LA() == T_COMMA
&& LA(2) != T_RBRACE
&& _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH;
++_initializerClauseDepth.top()) {
consumeToken(); // consume T_COMMA
if (parseInitializerClause0x(expression)) {
@@ -2808,7 +2815,11 @@ bool Parser::parseInitializerList0x(ExpressionListAST *&node)
}
}
return true;
const bool result = _initializerClauseDepth.top() <= MAX_INITIALIZER_CLAUSE_DEPTH;
_initializerClauseDepth.pop();
if (!result)
warning(cursor(), "Reached parse limit for initializer clause");
return result;
}
bool Parser::parseBracedInitList0x(ExpressionAST *&node)

View File

@@ -27,6 +27,7 @@
#include "TranslationUnit.h"
#include "MemoryPool.h"
#include <map>
#include <stack>
namespace CPlusPlus {
@@ -321,6 +322,7 @@ private:
bool _inExpressionStatement: 1;
int _expressionDepth;
int _statementDepth;
std::stack<int> _initializerClauseDepth;
MemoryPool _expressionStatementTempPool;
std::map<unsigned, TemplateArgumentListEntry> _templateArgumentList;

View File

@@ -985,7 +985,7 @@ public:
const ASTObjectValue *asAstObjectValue() const Q_DECL_OVERRIDE;
bool getSourceLocation(QString *fileName, int *line, int *column) const;
bool getSourceLocation(QString *fileName, int *line, int *column) const Q_DECL_OVERRIDE;
void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE;
QString defaultPropertyName() const;
@@ -1059,7 +1059,7 @@ public:
virtual const Value *lookupMember(const QString &name, const Context *context,
const ObjectValue **foundInObject = 0,
bool examinePrototypes = true) const;
bool examinePrototypes = true) const Q_DECL_OVERRIDE;
void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE;
const TypeScope *asTypeScope() const Q_DECL_OVERRIDE;
private:
@@ -1073,7 +1073,7 @@ public:
virtual const Value *lookupMember(const QString &name, const Context *context,
const ObjectValue **foundInObject = 0,
bool examinePrototypes = true) const;
bool examinePrototypes = true) const Q_DECL_OVERRIDE;
void processMembers(MemberProcessor *processor) const Q_DECL_OVERRIDE;
const JSImportScope *asJSImportScope() const Q_DECL_OVERRIDE;
private:

View File

@@ -48,7 +48,7 @@ void main()
// Make very narrow events somewhat wider so that they don't collapse into 0 pixels
float scaledWidth = scale.x * rectSize.x;
float shift = sign(scaledWidth) * max(0.0, 3.0 - abs(scaledWidth)) * 0.0005;
float shift = sign(rectSize.x) * max(0.0, 3.0 - abs(scaledWidth)) * 0.0005;
gl_Position.x += shift;
// Ditto for events with very small height

View File

@@ -216,7 +216,7 @@ static void updateNodes(int from, int to, const TimelineModel *model,
for (int i = from; i < to; ++i) {
qint64 start = qMax(parentState->start(), model->startTime(i));
qint64 end = qMin(parentState->end(), model->startTime(i) + model->duration(i));
if (start >= end)
if (start > end)
continue;
float itemTop = (1.0 - model->relativeHeight(i)) * defaultRowHeight;
@@ -244,7 +244,7 @@ static void updateNodes(int from, int to, const TimelineModel *model,
for (int i = from; i < to; ++i) {
qint64 start = qMax(parentState->start(), model->startTime(i));
qint64 end = qMin(parentState->end(), model->startTime(i) + model->duration(i));
if (start >= end)
if (start > end)
continue;
QColor color = model->color(i);
@@ -252,7 +252,8 @@ static void updateNodes(int from, int to, const TimelineModel *model,
uchar green = color.green();
uchar blue = color.blue();
float itemWidth = (end - start) * parentState->scale();
float itemWidth = end > start ? (end - start) * parentState->scale() :
std::numeric_limits<float>::min();
float itemLeft = (start - parentState->start()) * parentState->scale();
// This has to be the exact same expression as above, to guarantee determinism.

View File

@@ -586,8 +586,10 @@ void TimelineModel::clear()
d->endTimes.clear();
if (hadRowHeights)
emit expandedRowHeightChanged(-1, -1);
if (!wasEmpty)
if (!wasEmpty) {
emit emptyChanged();
emit heightChanged();
}
}
int TimelineModel::nextItemBySelectionId(int selectionId, qint64 time, int currentItem) const

View File

@@ -209,17 +209,11 @@ void TimelineRenderer::TimelineRendererPrivate::manageClicked()
{
Q_Q(TimelineRenderer);
if (currentSelection.eventIndex != -1) {
if (currentSelection.eventIndex == selectedItem)
q->setSelectionLocked(!selectionLocked);
else
q->setSelectionLocked(true);
// itemPressed() will trigger an update of the events and JavaScript views. Make sure the
// correct event is already selected when that happens, to prevent confusion.
q->setSelectedItem(currentSelection.eventIndex);
emit q->itemPressed(currentSelection.eventIndex);
} else {
q->setSelectionLocked(false);
q->setSelectedItem(-1);
emit q->itemPressed(-1);
}

View File

@@ -85,7 +85,6 @@ public:
private:
QPoint m_startPos;
QWidget *m_inner;
TitleBarWidget *m_titleBar;
QTimer m_timer;
};
@@ -245,7 +244,7 @@ public:
};
DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent)
: QDockWidget(parent), q(parent), m_inner(inner)
: QDockWidget(parent), q(parent)
{
setWidget(inner);
setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
@@ -288,7 +287,7 @@ bool DockWidget::eventFilter(QObject *, QEvent *event)
int y = me->pos().y();
int x = me->pos().x();
int h = m_titleBar->m_floatButton->height();
if (!isFloating() && 0 <= x && x < m_inner->width() && 0 <= y && y <= h) {
if (!isFloating() && widget() && 0 <= x && x < widget()->width() && 0 <= y && y <= h) {
m_timer.start();
m_startPos = mapToGlobal(me->pos());
}

View File

@@ -93,7 +93,7 @@ bool BeautifierPlugin::initialize(const QStringList &arguments, QString *errorSt
m_tools << new Uncrustify::Uncrustify(this);
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
menu->menu()->setTitle(QLatin1String("Beautifier"));
menu->menu()->setTitle(QCoreApplication::translate("Beautifier", Constants::OPTION_TR_CATEGORY));
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
for (int i = 0, total = m_tools.count(); i < total; ++i) {

View File

@@ -53,7 +53,7 @@ QtcPlugin {
property string llvmIncludeDir: QtcProcessOutputReader.readOutput(llvmConfig, ["--includedir"])
property string llvmLibDir: QtcProcessOutputReader.readOutput(llvmConfig, ["--libdir"])
property string llvmVersion: QtcProcessOutputReader.readOutput(llvmConfig, ["--version"])
.replace(/(\d+\.\d+).*/, "$1")
.replace(/(\d+\.\d+\.\d+).*/, "$1")
cpp.includePaths: base.concat(llvmIncludeDir)
cpp.libraryPaths: base.concat(llvmLibDir)

View File

@@ -135,7 +135,13 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
m_container->addWidget(empty);
m_widgetEditorMap.insert(empty, 0);
auto dropSupport = new FileDropSupport(this, [this](QDropEvent *event) {
auto dropSupport = new FileDropSupport(this, [this](QDropEvent *event) -> bool {
// do not accept move events except from other editor views (i.e. their tool bars)
// otherwise e.g. item views that support moving items within themselves would
// also "move" the item into the editor view, i.e. the item would be removed from the
// item view
if (!qobject_cast<EditorToolBar*>(event->source()))
event->setDropAction(Qt::CopyAction);
return event->source() != m_toolBar; // do not accept drops on ourselves
});
connect(dropSupport, &FileDropSupport::filesDropped,

View File

@@ -57,9 +57,21 @@ SearchResultTreeModel::~SearchResultTreeModel()
void SearchResultTreeModel::setShowReplaceUI(bool show)
{
beginResetModel();
m_showReplaceUI = show;
endResetModel();
// We cannot send dataChanged for the whole hierarchy in one go,
// because all items in a dataChanged must have the same parent.
// Send dataChanged for each parent of children individually...
QList<QModelIndex> changeQueue;
changeQueue.append(QModelIndex());
while (!changeQueue.isEmpty()) {
const QModelIndex current = changeQueue.takeFirst();
int childCount = rowCount(current);
if (childCount > 0) {
emit dataChanged(index(0, 0, current), index(childCount - 1, 0, current));
for (int r = 0; r < childCount; ++r)
changeQueue.append(index(r, 0, current));
}
}
}
void SearchResultTreeModel::setTextEditorFont(const QFont &font, const SearchResultColor &color)

View File

@@ -670,7 +670,8 @@ void MainWindow::registerDefaultActions()
// Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr(Constants::TR_SHOW_SIDEBAR), this);
QCoreApplication::translate("Core", Constants::TR_SHOW_SIDEBAR),
this);
m_toggleSideBarAction->setCheckable(true);
cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR);
cmd->setAttribute(Command::CA_UpdateText);

View File

@@ -40,6 +40,7 @@
#include "id.h"
#include "imode.h"
#include <QCoreApplication>
#include <QDebug>
#include <QSettings>
@@ -222,9 +223,9 @@ void NavigationWidget::updateToggleText()
d->m_toggleSideBarAction->setEnabled(haveData && NavigationWidgetPlaceHolder::m_current);
if (isShown())
d->m_toggleSideBarAction->setToolTip(tr(Constants::TR_HIDE_SIDEBAR));
d->m_toggleSideBarAction->setToolTip(QCoreApplication::translate("Core", Constants::TR_HIDE_SIDEBAR));
else
d->m_toggleSideBarAction->setToolTip(tr(Constants::TR_SHOW_SIDEBAR));
d->m_toggleSideBarAction->setToolTip(QCoreApplication::translate("Core", Constants::TR_SHOW_SIDEBAR));
}
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)

View File

@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-csrc">
<comment>C source code</comment>
<sub-class-of type="text/plain"/>
<alias type="text/x-c"/>
<glob pattern="*.c" case-sensitive="true"/>
</mime-type>
<mime-type type="text/vnd.nvidia.cuda.csrc">
<sub-class-of type="text/x-csrc"/>
<comment>NVIDIA CUDA C source code</comment>

View File

@@ -114,7 +114,7 @@ void CppHighlighter::highlightBlock(const QString &text)
const unsigned firstNonSpace = tokens.first().utf16charsBegin();
Parentheses parentheses;
parentheses.reserve(20); // assume wizard level ;-)
parentheses.reserve(5);
bool expectPreprocessorKeyword = false;
bool onlyHighlightComments = false;

View File

@@ -42,6 +42,7 @@
#include "cppsourceprocessor.h"
#include "cpptoolsconstants.h"
#include "cpptoolsplugin.h"
#include "cpptoolsreuse.h"
#include "editordocumenthandle.h"
#include <coreplugin/documentmanager.h>
@@ -585,15 +586,38 @@ QByteArray CppModelManager::codeModelConfiguration() const
return QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration));
}
static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSizeLimit)
{
if (fileSizeLimit == 0)
return files;
QSet<QString> result;
QFileInfo fileInfo;
QSetIterator<QString> i(files);
while (i.hasNext()) {
const QString filePath = i.next();
fileInfo.setFile(filePath);
if (skipFileDueToSizeLimit(fileInfo), fileSizeLimit)
continue;
result << filePath;
}
return result;
}
QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles,
ProgressNotificationMode mode)
{
if (sourceFiles.isEmpty() || !d->m_indexerEnabled)
return QFuture<void>();
const auto filteredFiles = tooBigFilesRemoved(sourceFiles, fileSizeLimit());
if (d->m_indexingSupporter)
d->m_indexingSupporter->refreshSourceFiles(sourceFiles, mode);
return d->m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode);
d->m_indexingSupporter->refreshSourceFiles(filteredFiles, mode);
return d->m_internalIndexingSupport->refreshSourceFiles(filteredFiles, mode);
}
QList<ProjectInfo> CppModelManager::projectInfos() const

View File

@@ -31,6 +31,7 @@
#include "cppsourceprocessor.h"
#include "cppmodelmanager.h"
#include "cpptoolsreuse.h"
#include <coreplugin/editormanager/editormanager.h>
@@ -454,6 +455,10 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In
return;
}
const QFileInfo info(absoluteFileName);
if (skipFileDueToSizeLimit(info))
return; // TODO: Add diagnostic message
// Otherwise get file contents
unsigned editorRevision = 0;
QByteArray contents;
@@ -473,7 +478,6 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In
Document::Include inc(include, include, 0, IncludeLocal);
document->addIncludeFile(inc);
}
const QFileInfo info(absoluteFileName);
if (info.exists())
document->setLastModified(info.lastModified());

View File

@@ -38,6 +38,7 @@
#include <cplusplus/LookupContext.h>
#include <utils/qtcassert.h>
#include <QDebug>
#include <QSet>
#include <QStringRef>
#include <QTextCursor>
@@ -250,4 +251,33 @@ TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol)
return Link(filename, line, column);
}
int fileSizeLimit()
{
static const QByteArray fileSizeLimitAsByteArray = qgetenv("QTC_CPP_FILE_SIZE_LIMIT_MB");
static int fileSizeLimitAsInt = -1;
if (fileSizeLimitAsInt == -1) {
bool ok;
const int limit = fileSizeLimitAsByteArray.toInt(&ok);
fileSizeLimitAsInt = ok && limit >= 0 ? limit : 0;
}
return fileSizeLimitAsInt;
}
bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB)
{
if (limitInMB == 0) // unlimited
return false;
const int fileSizeInMB = fileInfo.size() * 1000 * 1000;
if (fileSizeInMB > limitInMB) {
qWarning() << "Files to process limited by QTC_CPP_FILE_SIZE_LIMIT_MB, skipping"
<< fileInfo.absoluteFilePath();
return true;
}
return false;
}
} // CppTools

View File

@@ -39,6 +39,7 @@
QT_BEGIN_NAMESPACE
class QChar;
class QFileInfo;
class QStringRef;
class QTextCursor;
QT_END_NAMESPACE
@@ -74,6 +75,9 @@ const CPlusPlus::Macro CPPTOOLS_EXPORT *findCanonicalMacro(const QTextCursor &cu
QString CPPTOOLS_EXPORT correspondingHeaderOrSource(const QString &fileName, bool *wasHeader = 0);
void CPPTOOLS_EXPORT switchHeaderSource();
int fileSizeLimit();
bool skipFileDueToSizeLimit(const QFileInfo &fileInfo, int limitInMB = fileSizeLimit());
} // CppTools
#endif // CPPTOOLSREUSE_H

View File

@@ -1185,11 +1185,14 @@ void Breakpoint::gotoLocation() const
if (b->m_params.type == BreakpointByAddress) {
engine->gotoLocation(b->m_params.address);
} else {
// Don't use gotoLocation as this ends up in disassembly
// if OperateByInstruction is on.
// Don't use gotoLocation unconditionally as this ends up in
// disassembly if OperateByInstruction is on. But fallback
// to disassembly if we can't open the file.
const QString file = QDir::cleanPath(b->markerFileName());
IEditor *editor = EditorManager::openEditor(file);
editor->gotoLine(b->markerLineNumber(), 0);
if (IEditor *editor = EditorManager::openEditor(file))
editor->gotoLine(b->markerLineNumber(), 0);
else
engine->openDisassemblerView(Location(b->m_response.address));
}
}
}
@@ -1329,11 +1332,12 @@ BreakpointItem::~BreakpointItem()
void BreakpointItem::destroyMarker()
{
BreakpointMarker *m = m_marker;
QTC_ASSERT(m, return);
m->m_bp = 0;
m_marker = 0;
delete m;
if (m_marker) {
BreakpointMarker *m = m_marker;
m->m_bp = 0;
m_marker = 0;
delete m;
}
}
QString BreakpointItem::markerFileName() const

View File

@@ -1241,15 +1241,15 @@ void WatchHandler::insertItem(WatchItem *item)
void WatchModel::insertItem(WatchItem *item)
{
WatchItem *existing = findItem(item->iname);
if (existing)
WatchItem *parent = findItem(parentName(item->iname));
QTC_ASSERT(parent, return);
if (WatchItem *existing = parent->findItem(item->iname))
takeItem(existing);
//item->walkTree([item](TreeItem *sub) { sub->sortChildren(&watchItemSorter); });
item->sortChildren(&watchItemSorter);
WatchItem *parent = findItem(parentName(item->iname));
QTC_ASSERT(parent, return);
const int row = findInsertPosition(parent->children(), item);
parent->insertChild(row, item);

View File

@@ -231,7 +231,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(remoteHelpFilter, SIGNAL(linkActivated(QUrl)), this,
SLOT(showLinkInHelpMode(QUrl)));
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), this, "handleHelpRequest");
QDesktopServices::setUrlHandler(QLatin1String("qthelp"), HelpManager::instance(), "handleHelpRequest");
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*,Core::IMode*)));
@@ -367,24 +367,37 @@ HelpViewer *HelpPlugin::createHelpViewer(qreal zoom)
factories.insert(QLatin1String("textbrowser"), []() { return new TextBrowserHelpViewer(); });
ViewerFactory factory;
// TODO: Visual Studio < 2013 has a bug in std::function's operator bool, which in this case
// leads to succeeding boolean checks on factory which should not succeed.
// So we may not check against "if (!factory)"
bool factoryFound = false;
// check requested backend
const QString backend = QLatin1String(qgetenv("QTC_HELPVIEWER_BACKEND"));
if (!backend.isEmpty()) {
factory = factories.value(backend);
if (!factory)
if (!factories.contains(backend)) {
qWarning("Help viewer backend \"%s\" not found, using default.", qPrintable(backend));
} else {
factory = factories.value(backend);
factoryFound = true;
}
}
// default setting
#ifdef QTC_MAC_NATIVE_HELPVIEWER_DEFAULT
if (!factory)
if (!factoryFound && factories.contains(QLatin1String("native"))) {
factory = factories.value(QLatin1String("native"));
factoryFound = true;
}
#endif
if (!factory)
if (!factoryFound && factories.contains(QLatin1String("qtwebkit"))) {
factory = factories.value(QLatin1String("qtwebkit"));
if (!factory)
factoryFound = true;
}
if (!factoryFound && factories.contains(QLatin1String("textbrowser"))) {
factory = factories.value(QLatin1String("textbrowser"));
QTC_ASSERT(factory, return 0);
factoryFound = true;
}
QTC_ASSERT(factoryFound, return 0);
HelpViewer *viewer = factory();
// initialize font

View File

@@ -53,6 +53,7 @@
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <QCoreApplication>
#include <QHBoxLayout>
#include <QHelpEngine>
#include <QHelpSearchEngine>
@@ -131,15 +132,18 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
}
if (style != SideBarWidget) {
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
tr(Core::Constants::TR_SHOW_SIDEBAR), toolBar);
QCoreApplication::translate("Core", Core::Constants::TR_SHOW_SIDEBAR),
toolBar);
m_toggleSideBarAction->setCheckable(true);
m_toggleSideBarAction->setChecked(false);
cmd = Core::ActionManager::registerAction(m_toggleSideBarAction,
Core::Constants::TOGGLE_SIDEBAR, context);
connect(m_toggleSideBarAction, &QAction::toggled, m_toggleSideBarAction,
[this](bool checked) {
m_toggleSideBarAction->setText(checked ? tr(Core::Constants::TR_HIDE_SIDEBAR)
: tr(Core::Constants::TR_SHOW_SIDEBAR));
m_toggleSideBarAction->setText(
QCoreApplication::translate("Core",
checked ? Core::Constants::TR_HIDE_SIDEBAR
: Core::Constants::TR_SHOW_SIDEBAR));
});
addSideBar();
m_toggleSideBarAction->setChecked(m_sideBar->isVisibleTo(this));

View File

@@ -294,11 +294,6 @@ void QtWebKitHelpWidget::scaleDown()
setZoomFactor(qMax(qreal(0.0), zoomFactor() - qreal(0.1)));
}
void QtWebKitHelpWidget::setOpenInNewPageActionVisible(bool visible)
{
m_openInNewPageActionVisible = visible;
}
// -- public slots
void QtWebKitHelpWidget::copy()
@@ -567,7 +562,7 @@ void QtWebKitHelpViewer::addForwardHistoryItems(QMenu *forwardMenu)
void QtWebKitHelpViewer::setOpenInNewPageActionVisible(bool visible)
{
m_webView->setOpenInNewPageActionVisible(visible);
m_webView->pageAction(QWebPage::OpenLinkInNewWindow)->setVisible(visible);
}
bool QtWebKitHelpViewer::findText(const QString &text, FindFlags flags,

View File

@@ -110,8 +110,6 @@ public:
void scaleUp();
void scaleDown();
void setOpenInNewPageActionVisible(bool visible);
public slots:
void copy();
@@ -134,7 +132,6 @@ private:
bool eventFilter(QObject *obj, QEvent *event);
QtWebKitHelpViewer *m_parent;
bool m_openInNewPageActionVisible;
};
class HelpPage : public QWebPage

View File

@@ -35,7 +35,8 @@
#include <utils/qtcassert.h>
#include <utils/fileutils.h>
static const char FILE_POS_PATTERN[] = "(cl|LINK|.+) : ";
// As of MSVC 2015: "foo.cpp(42) :" -> "foo.cpp(42):"
static const char FILE_POS_PATTERN[] = "(cl|LINK|.+[^ ]) ?: ";
static const char ERROR_PATTERN[] = "[A-Z]+\\d\\d\\d\\d ?:";
static QPair<Utils::FileName, int> parseFileName(const QString &input)
@@ -232,6 +233,16 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("labeled error-2015")
<< QString::fromLatin1("qmlstandalone\\main.cpp(54): error C4716: 'findUnresolvedModule' : must return a value") << OutputParserTester::STDOUT
<< QString() << QString()
<< (QList<Task>()
<< Task(Task::Error,
QLatin1String("C4716: 'findUnresolvedModule' : must return a value"),
Utils::FileName::fromUserInput(QLatin1String("qmlstandalone\\main.cpp")), 54,
Constants::TASK_CATEGORY_COMPILE))
<< QString();
QTest::newRow("labeled warning")
<< QString::fromLatin1("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp(69) : warning C4100: 'something' : unreferenced formal parameter") << OutputParserTester::STDOUT
<< QString() << QString()

View File

@@ -37,6 +37,13 @@
namespace ProjectExplorer {
static inline QByteArray msgFileComparisonFail(const Utils::FileName &f1, const Utils::FileName &f2)
{
const QString result = QLatin1Char('"') + f1.toUserOutput()
+ QLatin1String("\" != \"") + f2.toUserOutput() + QLatin1Char('"');
return result.toLocal8Bit();
}
OutputParserTester::OutputParserTester() :
m_debug(false)
{ }
@@ -83,7 +90,8 @@ void OutputParserTester::testParsing(const QString &lines,
for (int i = 0; i < tasks.size(); ++i) {
QCOMPARE(m_receivedTasks.at(i).category, tasks.at(i).category);
QCOMPARE(m_receivedTasks.at(i).description, tasks.at(i).description);
QCOMPARE(m_receivedTasks.at(i).file, tasks.at(i).file);
QVERIFY2(m_receivedTasks.at(i).file == tasks.at(i).file,
msgFileComparisonFail(m_receivedTasks.at(i).file, tasks.at(i).file));
QCOMPARE(m_receivedTasks.at(i).line, tasks.at(i).line);
QCOMPARE(static_cast<int>(m_receivedTasks.at(i).type), static_cast<int>(tasks.at(i).type));
}
@@ -103,7 +111,8 @@ void OutputParserTester::testTaskMangling(const Task &input,
if (m_receivedTasks.size() == 1) {
QCOMPARE(m_receivedTasks.at(0).category, output.category);
QCOMPARE(m_receivedTasks.at(0).description, output.description);
QCOMPARE(m_receivedTasks.at(0).file, output.file);
QVERIFY2(m_receivedTasks.at(0).file == output.file,
msgFileComparisonFail(m_receivedTasks.at(0).file, output.file));
QCOMPARE(m_receivedTasks.at(0).line, output.line);
QCOMPARE(m_receivedTasks.at(0).type, output.type);
}

View File

@@ -306,7 +306,9 @@ void QmlProfilerFileReader::loadEventData(QXmlStreamReader &stream)
if (elementName == _("bindingType") ||
elementName == _("cacheEventType") ||
elementName == _("sgEventType") ||
elementName == _("memoryEventType")) {
elementName == _("memoryEventType") ||
elementName == _("mouseEvent") ||
elementName == _("keyEvent")) {
event.detailType = readData.toInt();
break;
}
@@ -540,16 +542,29 @@ void QmlProfilerFileWriter::save(QIODevice *device)
if (!event.data.isEmpty())
stream.writeTextElement(_("details"), event.data);
if (event.rangeType == Binding)
if (event.rangeType == Binding) {
stream.writeTextElement(_("bindingType"), QString::number(event.detailType));
if (event.message == Event && event.detailType == AnimationFrame)
stream.writeTextElement(_("animationFrame"), QString::number(event.detailType));
if (event.message == PixmapCacheEvent)
} else if (event.message == Event) {
switch (event.detailType) {
case AnimationFrame:
stream.writeTextElement(_("animationFrame"), QString::number(event.detailType));
break;
case Key:
stream.writeTextElement(_("keyEvent"), QString::number(event.detailType));
break;
case Mouse:
stream.writeTextElement(_("mouseEvent"), QString::number(event.detailType));
break;
default:
break;
}
} else if (event.message == PixmapCacheEvent) {
stream.writeTextElement(_("cacheEventType"), QString::number(event.detailType));
if (event.message == SceneGraphFrame)
} else if (event.message == SceneGraphFrame) {
stream.writeTextElement(_("sgEventType"), QString::number(event.detailType));
if (event.message == MemoryAllocation)
} else if (event.message == MemoryAllocation) {
stream.writeTextElement(_("memoryEventType"), QString::number(event.detailType));
}
stream.writeEndElement();
incrementProgress();
}

View File

@@ -61,6 +61,8 @@ void DummyModel::loadData()
{
for (int i = 0; i < 10; ++i)
insert(i, 1, 1);
insert(5, 0, 10);
}
float DummyModel::relativeHeight(int index) const
@@ -95,7 +97,7 @@ void tst_TimelineItemsRenderPass::update()
result = inst->update(&renderer, &parentState, 0, 0, 0, true, 1);
QCOMPARE(result, nullState);
result = inst->update(&renderer, &parentState, 0, 2, 8, true, 1);
result = inst->update(&renderer, &parentState, 0, 2, 9, true, 1);
QVERIFY(result != nullState);
QCOMPARE(result->expandedOverlay(), nullNode);
QCOMPARE(result->expandedOverlay(), nullNode);
@@ -106,10 +108,10 @@ void tst_TimelineItemsRenderPass::update()
QSGGeometryNode *node = static_cast<QSGGeometryNode *>(result->expandedRows()[0]->firstChild());
QSGMaterial *material1 = node->material();
QVERIFY(material1 != 0);
QCOMPARE(node->geometry()->vertexCount(), 26);
QCOMPARE(node->geometry()->vertexCount(), 30);
node = static_cast<QSGGeometryNode *>(result->collapsedRows()[0]->firstChild());
QSGMaterial *material2 = node->material();
QCOMPARE(node->geometry()->vertexCount(), 26);
QCOMPARE(node->geometry()->vertexCount(), 30);
QVERIFY(material2 != 0);
QCOMPARE(material1->type(), material2->type());
QSGMaterialShader *shader1 = material1->createShader();
@@ -121,17 +123,20 @@ void tst_TimelineItemsRenderPass::update()
delete shader1;
delete shader2;
result = inst->update(&renderer, &parentState, result, 0, 10, true, 1);
result = inst->update(&renderer, &parentState, result, 0, 11, true, 1);
QVERIFY(result != nullState);
QCOMPARE(result->expandedOverlay(), nullNode);
QCOMPARE(result->expandedOverlay(), nullNode);
QCOMPARE(result->expandedRows().count(), 1);
QCOMPARE(result->collapsedRows().count(), 1);
QCOMPARE(result->expandedRows()[0]->childCount(), 2);
QCOMPARE(result->collapsedRows()[0]->childCount(), 2);
node = static_cast<QSGGeometryNode *>(result->expandedRows()[0]->lastChild());
// 0-sized node starting at 8 may also be added. We don't test for this one.
QVERIFY(result->expandedRows()[0]->childCount() > 1);
QVERIFY(result->collapsedRows()[0]->childCount() > 1);
node = static_cast<QSGGeometryNode *>(result->expandedRows()[0]->childAtIndex(1));
QCOMPARE(node->geometry()->vertexCount(), 8);
node = static_cast<QSGGeometryNode *>(result->collapsedRows()[0]->lastChild());
node = static_cast<QSGGeometryNode *>(result->collapsedRows()[0]->childAtIndex(1));
QCOMPARE(node->geometry()->vertexCount(), 8);
model.setExpanded(true);

View File

@@ -38,6 +38,8 @@ def main():
workingDir = tempDir()
# we need a Qt >= 4.8
analyzerTargets = Targets.desktopTargetClasses() & ~Targets.DESKTOP_474_GCC
if platform.system() in ('Windows', 'Microsoft') and JIRA.isBugStillOpen(14307):
analyzerTargets &= ~Targets.DESKTOP_480_DEFAULT & ~Targets.DESKTOP_541_GCC
checkedTargets, projectName = createNewQtQuickApplication(workingDir, targets=analyzerTargets)
editor = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
if placeCursorToLine(editor, "MouseArea.*", True):

View File

@@ -59,7 +59,7 @@ def main():
in commitDetails, "Text file in details view?")
test.verify("src/plugins/find/images/expand.png | Bin 0 -> 931 bytes"
in commitDetails, "Binary file in details view?")
test.verify("1675 files changed, 229938 insertions(+)" in commitDetails,
test.verify(" files changed, 229938 insertions(+)" in commitDetails,
"Summary in details view?")
clickButton(waitForObject(":Select a Git Commit.Show_QPushButton"))
changedEdit = waitForObject(":Qt Creator_DiffEditor::SideDiffEditorWidget")