From 46840046dff74cc1f56027ce769928241f534629 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Jun 2016 15:01:16 +0200 Subject: [PATCH 01/30] Clang: Honor fixits own locations ...when showing the refactoring marker and generating the quick fix operations. Opening main.cpp main.cpp: #include "file.h" void f(char *s) { foo(s); } file.h: // significant line 1 // significant line 2 // significant line 3 bool foo(int fd); led to SOFT ASSERT: "textBlock.isValid()" in file clangdiagnosticmanager.cpp, line 205 and a misbehavior when applying the fixit from the tooltip. We take the line of a diagnostic to display the fixit marker if it has any fixits. But the (child) diagnostic might be issued for an other file (that's what happening here), so better take the line of the location where the fixit is meant to be applied. Same applies for generation of the quick fix entries. Change-Id: I48d38420b285d2d2f86e3faa2319513aa8b47848 Reviewed-by: Christian Kandeler Reviewed-by: David Schulz --- .../clangcodemodel/clangdiagnosticmanager.cpp | 16 +++++---- .../clangfixitoperationsextractor.cpp | 36 +++++++++++-------- .../clangfixitoperationsextractor.h | 5 +-- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp b/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp index 0e3d70ec9dd..71afe79bf17 100644 --- a/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp +++ b/src/plugins/clangcodemodel/clangdiagnosticmanager.cpp @@ -352,13 +352,17 @@ void ClangDiagnosticManager::addFixItAvailableMarker( QSet &lineNumbersWithFixItMarker) { for (auto &&diagnostic : diagnostics) { - const int line = int(diagnostic.location().line()); - if (!diagnostic.fixIts().isEmpty() && !lineNumbersWithFixItMarker.contains(line)) { - const TextEditor::RefactorMarker marker - = createFixItAvailableMarker(m_textDocument->document(), line); + for (auto &&fixit : diagnostic.fixIts()) { + const ClangBackEnd::SourceLocationContainer location = fixit.range().start(); + const int line = int(location.line()); - lineNumbersWithFixItMarker.insert(line); - m_fixItAvailableMarkers.append(marker); + if (location.filePath() == filePath() && !lineNumbersWithFixItMarker.contains(line)) { + const TextEditor::RefactorMarker marker + = createFixItAvailableMarker(m_textDocument->document(), line); + + lineNumbersWithFixItMarker.insert(line); + m_fixItAvailableMarkers.append(marker); + } } addFixItAvailableMarker(diagnostic.children(), lineNumbersWithFixItMarker); diff --git a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp index 08983d2dab2..7203e18dcb0 100644 --- a/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp +++ b/src/plugins/clangcodemodel/clangfixitoperationsextractor.cpp @@ -27,6 +27,8 @@ #include "clangfixitoperation.h" +#include + #include using ClangBackEnd::DiagnosticContainer; @@ -75,13 +77,16 @@ QString tweakedDiagnosticText(const QString &diagnosticText) return tweakedText; } -bool isDiagnosticFromFileAtLine(const DiagnosticContainer &diagnosticContainer, - const QString &filePath, - int line) +bool hasFixItAt(const QVector &fixits, + const Utf8String &filePath, + int line) { - const auto location = diagnosticContainer.location(); - return location.filePath().toString() == filePath - && location.line() == uint(line); + const auto isFixitForLocation = [filePath, line] (const ClangBackEnd::FixItContainer &fixit) { + const ClangBackEnd::SourceLocationContainer location = fixit.range().start(); + return location.filePath() == filePath && location.line() == uint(line); + }; + + return Utils::anyOf(fixits, isFixitForLocation); } } // anonymous namespace @@ -103,17 +108,17 @@ ClangFixItOperationsExtractor::extract(const QString &filePath, int line) return operations; } -void ClangFixItOperationsExtractor::appendFixitOperationsFromDiagnostic( +void ClangFixItOperationsExtractor::appendFixitOperation( const QString &filePath, - const DiagnosticContainer &diagnosticContainer) + const QString &diagnosticText, + const QVector &fixits) { - const auto fixIts = diagnosticContainer.fixIts(); - if (!fixIts.isEmpty()) { - const QString diagnosticText = tweakedDiagnosticText(diagnosticContainer.text().toString()); + if (!fixits.isEmpty()) { + const QString diagnosticTextTweaked = tweakedDiagnosticText(diagnosticText); TextEditor::QuickFixOperation::Ptr operation( new ClangFixItOperation(filePath, - diagnosticText, - fixIts)); + diagnosticTextTweaked, + fixits)); operations.append(operation); } } @@ -123,8 +128,9 @@ void ClangFixItOperationsExtractor::extractFromDiagnostic( const QString &filePath, int line) { - if (isDiagnosticFromFileAtLine(diagnosticContainer, filePath, line)) { - appendFixitOperationsFromDiagnostic(filePath, diagnosticContainer); + const QVector fixIts = diagnosticContainer.fixIts(); + if (hasFixItAt(fixIts, filePath, line)) { + appendFixitOperation(filePath, diagnosticContainer.text().toString(), fixIts); foreach (const auto &child, diagnosticContainer.children()) extractFromDiagnostic(child, filePath, line); diff --git a/src/plugins/clangcodemodel/clangfixitoperationsextractor.h b/src/plugins/clangcodemodel/clangfixitoperationsextractor.h index e504d27dea8..6c49a3da181 100644 --- a/src/plugins/clangcodemodel/clangfixitoperationsextractor.h +++ b/src/plugins/clangcodemodel/clangfixitoperationsextractor.h @@ -42,8 +42,9 @@ private: void extractFromDiagnostic(const ClangBackEnd::DiagnosticContainer &diagnosticContainer, const QString &filePath, int line); - void appendFixitOperationsFromDiagnostic(const QString &filePath, - const ClangBackEnd::DiagnosticContainer &diagnosticContainer); + void appendFixitOperation(const QString &filePath, + const QString &diagnosticText, + const QVector &fixits); private: const QVector &diagnosticContainers; From 0a3f59659915f4c1cb974d20bb2ba3ff40cba79d Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 28 Jun 2016 13:16:22 +0200 Subject: [PATCH 02/30] QmlDesigner: Fix regression caused by semantic check States can of course contain PropertyChanges. Change-Id: Ie78be1db58c6820a49356b1cd70102e10211030b Reviewed-by: Christian Stenger --- src/libs/qmljs/qmljscheck.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 6756e7b2ed3..26b5b3ff19b 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -820,7 +820,8 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId, const QString typeName = getRightMostIdentifier(typeId)->name.toString(); - if (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("State")) + if (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("State") + && typeId->name.toString() != "PropertyChanges") addMessage(StateCannotHaveChildItem, typeErrorLocation, typeName); if (checkTypeForDesignerSupport(typeId)) From 06b2df0e2731c60cefa7a2655204431f16110310 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 28 Jun 2016 13:35:37 +0200 Subject: [PATCH 03/30] QmlJSEditor: Fix compile with Qt5.5 Avoid using functionality introduced with Qt5.6. Change-Id: Icfa4eeb547b651a19aa745b5de1cb413f9b6b4ef Reviewed-by: Orgad Shaneh --- src/plugins/qmljseditor/qmljsoutlinetreeview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp b/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp index f20715ad506..996c17dca97 100644 --- a/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp +++ b/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp @@ -57,8 +57,10 @@ void QmlJSOutlineTreeView::contextMenuEvent(QContextMenuEvent *event) QMenu contextMenu; - contextMenu.addAction(tr("Expand All"), this, [this] { expandAll(); }); - contextMenu.addAction(tr("Collapse All"), this, [this] { collapseAllExceptRoot(); }); + QAction *action = contextMenu.addAction(tr("Expand All")); + connect(action, &QAction::triggered, this, [this] () { expandAll(); }); + action = contextMenu.addAction(tr("Collapse All")); + connect(action, &QAction::triggered, this, [this] () { collapseAllExceptRoot(); }); contextMenu.exec(event->globalPos()); From ccc46bbe46f6385968f5e4fb71bb20a4fc37f73a Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 28 Jun 2016 13:28:28 +0200 Subject: [PATCH 04/30] Fix crashes with (Runnable|Connection)::is() Another regression of 3f11ef92167 Default constructed Runnables/Connections have zero d pointer. Task-number: QTCREATORBUG-16507 Change-Id: I230b661eba4c408a353a711f93f3163160980793 Reviewed-by: Maurice Kalinowski Reviewed-by: hjk --- src/plugins/projectexplorer/runconfiguration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h index 225c04bf437..fd4fa288429 100644 --- a/src/plugins/projectexplorer/runconfiguration.h +++ b/src/plugins/projectexplorer/runconfiguration.h @@ -195,7 +195,7 @@ public: void operator=(Runnable other) { d = std::move(other.d); } template bool is() const { - return d.get()->typeId() == T::staticTypeId; + return d.get() && (d.get()->typeId() == T::staticTypeId); } template const T &as() const { @@ -219,7 +219,7 @@ public: void operator=(Connection other) { d = std::move(other.d); } template bool is() const { - return d.get()->typeId() == T::staticTypeId; + return d.get() && (d.get()->typeId() == T::staticTypeId); } template const T &as() const { From c48721777126095140cc2168818429d21fbf21e9 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2016 13:46:46 +0200 Subject: [PATCH 05/30] Debugger: Use a typed root item in ThreadModel ... and remove casts where possible. Change-Id: I10305efbe336de7aa5efdb73a52c5f89cd2d089e Reviewed-by: Christian Stenger --- src/plugins/debugger/threadshandler.cpp | 8 ++++---- src/plugins/debugger/threadshandler.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index 306cd6146bf..b5a2d343b86 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -266,9 +266,9 @@ int ThreadsHandler::currentThreadIndex() const void ThreadsHandler::sort(int column, Qt::SortOrder order) { - rootItem()->sortChildren([order, column](const TreeItem *item1, const TreeItem *item2) -> bool { - const QVariant v1 = static_cast(item1)->threadPart(column); - const QVariant v2 = static_cast(item2)->threadPart(column); + rootItem()->sortChildren([order, column](const ThreadItem *item1, const ThreadItem *item2) -> bool { + const QVariant v1 = item1->threadPart(column); + const QVariant v2 = item2->threadPart(column); if (v1 == v2) return false; if (column == 0) @@ -286,7 +286,7 @@ ThreadId ThreadsHandler::currentThread() const ThreadId ThreadsHandler::threadAt(int index) const { QTC_ASSERT(index >= 0 && index < rootItem()->childCount(), return ThreadId()); - return static_cast(rootItem()->childAt(index))->threadData.id; + return rootItem()->childAt(index)->threadData.id; } void ThreadsHandler::setCurrentThread(ThreadId id) diff --git a/src/plugins/debugger/threadshandler.h b/src/plugins/debugger/threadshandler.h index 9a29b5314e7..feeb57aa174 100644 --- a/src/plugins/debugger/threadshandler.h +++ b/src/plugins/debugger/threadshandler.h @@ -41,7 +41,7 @@ namespace Internal { class GdbMi; class ThreadItem; -class ThreadsHandler : public Utils::LeveledTreeModel +class ThreadsHandler : public Utils::LeveledTreeModel, ThreadItem> { Q_OBJECT From 4d9f79964dc0eb1c24c84c753942f0c73488a414 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2016 13:56:16 +0200 Subject: [PATCH 06/30] Debugger: Make RegisterModel a LeveledTreeModel Change-Id: I59e7df86e24f4be5c2c69313883fdc182f3071d2 Reviewed-by: Christian Stenger --- src/plugins/debugger/registerhandler.cpp | 5 ++--- src/plugins/debugger/registerhandler.h | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/debugger/registerhandler.cpp b/src/plugins/debugger/registerhandler.cpp index 6d3749b45f9..e96532e60ed 100644 --- a/src/plugins/debugger/registerhandler.cpp +++ b/src/plugins/debugger/registerhandler.cpp @@ -562,9 +562,8 @@ void RegisterHandler::setNumberFormat(const QString &name, RegisterFormat format RegisterMap RegisterHandler::registerMap() const { RegisterMap result; - Utils::TreeItem *root = rootItem(); - for (int i = 0, n = root->rowCount(); i != n; ++i) { - RegisterItem *reg = static_cast(root->child(i)); + for (int i = 0, n = rootItem()->childCount(); i != n; ++i) { + RegisterItem *reg = rootItem()->childAt(i); quint64 value = reg->addressValue(); if (value) result.insert(value, reg->m_reg.name); diff --git a/src/plugins/debugger/registerhandler.h b/src/plugins/debugger/registerhandler.h index 96293cfa1e0..5394eee00ed 100644 --- a/src/plugins/debugger/registerhandler.h +++ b/src/plugins/debugger/registerhandler.h @@ -115,9 +115,13 @@ public: }; class RegisterItem; +class RegisterSubItem; +using RegisterRootItem = Utils::TypedTreeItem; + typedef QMap RegisterMap; -class RegisterHandler : public Utils::TreeModel +class RegisterHandler + : public Utils::LeveledTreeModel { Q_OBJECT From 847637708f398af968d2163c907dbe3b93587699 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 27 Jun 2016 22:34:13 +0300 Subject: [PATCH 07/30] Tests: Use Qt5-style connects The heavy lifting was done by clazy. Change-Id: If3332a2b4a6d011d2cb74996f5dd750452093f31 Reviewed-by: Christian Stenger --- .../qmldesigner/coretests/tst_testcore.cpp | 2 +- tests/auto/valgrind/callgrind/modeltest.cpp | 8 +-- .../debugger/qquick1/myplugin/mytype.cpp | 2 +- .../manual/debugger/qquick1/myplugin/mytype.h | 3 +- .../debugger/qquick2/myplugin/mytype.cpp | 2 +- .../manual/debugger/qquick2/myplugin/mytype.h | 3 +- .../debugger/simple/simple_test_app.cpp | 19 ++++--- .../debugger/spacy path/app with space.cpp | 4 +- .../debugger/spacy-file/app with space.cpp | 4 +- tests/manual/fakevim/main.cpp | 26 +++++----- tests/manual/pluginview/plugindialog.h | 3 +- tests/manual/process/mainwindow.cpp | 6 +-- tests/manual/process/mainwindow.h | 3 -- tests/manual/ssh/errorhandling/main.cpp | 11 ++--- .../ssh/remoteprocess/remoteprocesstest.cpp | 49 +++++++++++-------- .../ssh/remoteprocess/remoteprocesstest.h | 13 +++-- tests/manual/ssh/sftp/sftptest.cpp | 28 +++++------ tests/manual/ssh/sftp/sftptest.h | 19 ++++--- tests/manual/ssh/sftpfsmodel/window.cpp | 15 +++--- tests/manual/ssh/sftpfsmodel/window.h | 3 +- tests/manual/ssh/shell/shell.cpp | 18 ++++--- tests/manual/ssh/shell/shell.h | 3 +- tests/manual/ssh/tunnel/directtunnel.cpp | 24 +++++---- tests/manual/ssh/tunnel/directtunnel.h | 3 +- tests/manual/ssh/tunnel/forwardtunnel.h | 3 +- 25 files changed, 137 insertions(+), 137 deletions(-) diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 5188b2278cc..7b5c93e5000 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -149,7 +149,7 @@ static QmlDesigner::Model* createModel(const QString &typeName, int major = 2, i QmlDesigner::Model *model = QmlDesigner::Model::create(typeName.toUtf8(), major, minor, metaInfoPropxyModel); QPlainTextEdit *textEdit = new QPlainTextEdit; - QObject::connect(model, SIGNAL(destroyed()), textEdit, SLOT(deleteLater())); + QObject::connect(model, &QObject::destroyed, textEdit, &QObject::deleteLater); textEdit->setPlainText(QString("import %1 %3.%4; %2{}").arg(typeName.split(".").first()) .arg(typeName.split(".").last()) .arg(major) diff --git a/tests/auto/valgrind/callgrind/modeltest.cpp b/tests/auto/valgrind/callgrind/modeltest.cpp index c844f12d307..94c0fd2dde3 100644 --- a/tests/auto/valgrind/callgrind/modeltest.cpp +++ b/tests/auto/valgrind/callgrind/modeltest.cpp @@ -85,8 +85,8 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler) m_format->addItem("absolute", CostDelegate::FormatAbsolute); m_format->addItem("relative", CostDelegate::FormatRelative); m_format->addItem("rel. to parent", CostDelegate::FormatRelativeToParent); - connect(m_format, SIGNAL(activated(int)), - this, SLOT(formatChanged(int))); + connect(m_format, static_cast(&QComboBox::activated), + this, &ModelTestWidget::formatChanged); h->addWidget(m_format); QDoubleSpinBox *minimumCost = new QDoubleSpinBox; @@ -94,8 +94,8 @@ ModelTestWidget::ModelTestWidget(CallgrindWidgetHandler *handler) minimumCost->setRange(0, 1); minimumCost->setDecimals(4); minimumCost->setSingleStep(0.01); - connect(minimumCost, SIGNAL(valueChanged(double)), - m_handler->proxyModel(), SLOT(setMinimumInclusiveCostRatio(double))); + connect(minimumCost, &QDoubleSpinBox::valueChanged, + m_handler->proxyModel(), &DataProxyModel::setMinimumInclusiveCostRatio); minimumCost->setValue(0.0001); h->addWidget(minimumCost); diff --git a/tests/manual/debugger/qquick1/myplugin/mytype.cpp b/tests/manual/debugger/qquick1/myplugin/mytype.cpp index d8e52755713..10127323b6e 100644 --- a/tests/manual/debugger/qquick1/myplugin/mytype.cpp +++ b/tests/manual/debugger/qquick1/myplugin/mytype.cpp @@ -10,7 +10,7 @@ MyType::MyType(QObject *parent) updateTimerText(); m_timer = new QTimer(this); m_timer->setInterval(1000); - connect(m_timer, SIGNAL(timeout()), SLOT(updateTimerText())); + connect(m_timer, &QTimer::timeout, this, &MyType::updateTimerText); m_timer->start(); } diff --git a/tests/manual/debugger/qquick1/myplugin/mytype.h b/tests/manual/debugger/qquick1/myplugin/mytype.h index 30c90c9ef6c..e833fe81b86 100644 --- a/tests/manual/debugger/qquick1/myplugin/mytype.h +++ b/tests/manual/debugger/qquick1/myplugin/mytype.h @@ -20,10 +20,9 @@ public: signals: void timeChanged(const QString &newText); -private slots: +private: void updateTimerText(); -private: QString m_timeText; QTimer *m_timer; diff --git a/tests/manual/debugger/qquick2/myplugin/mytype.cpp b/tests/manual/debugger/qquick2/myplugin/mytype.cpp index f3232af8703..f36105528c3 100644 --- a/tests/manual/debugger/qquick2/myplugin/mytype.cpp +++ b/tests/manual/debugger/qquick2/myplugin/mytype.cpp @@ -10,7 +10,7 @@ MyType::MyType(QObject *parent) updateTimerText(); m_timer = new QTimer(this); m_timer->setInterval(1000); - connect(m_timer, SIGNAL(timeout()), SLOT(updateTimerText())); + connect(m_timer, &QTimer::timeout, this, &MyType::updateTimerText); m_timer->start(); } diff --git a/tests/manual/debugger/qquick2/myplugin/mytype.h b/tests/manual/debugger/qquick2/myplugin/mytype.h index 30c90c9ef6c..e833fe81b86 100644 --- a/tests/manual/debugger/qquick2/myplugin/mytype.h +++ b/tests/manual/debugger/qquick2/myplugin/mytype.h @@ -20,10 +20,9 @@ public: signals: void timeChanged(const QString &newText); -private slots: +private: void updateTimerText(); -private: QString m_timeText; QTimer *m_timer; diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 695de846c7f..20f74e347c8 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -1792,10 +1792,10 @@ namespace qobject { parent.setObjectName("A Parent"); QObject child(&parent); child.setObjectName("A Child"); - QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater())); - QObject::connect(&child, SIGNAL(destroyed()), &child, SLOT(deleteLater())); - QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater())); - QObject::disconnect(&child, SIGNAL(destroyed()), &child, SLOT(deleteLater())); + QObject::connect(&child, &QObject::destroyed, &parent, &QObject::deleteLater); + QObject::connect(&child, &QObject::destroyed, &child, &QObject::deleteLater); + QObject::disconnect(&child, &QObject::destroyed, &parent, &QObject::deleteLater); + QObject::disconnect(&child, &QObject::destroyed, &child, &QObject::deleteLater); child.setObjectName("A renamed Child"); BREAK_HERE; // Check child "A renamed Child" QObject. @@ -1889,11 +1889,11 @@ namespace qobject { QObject ob1; ob1.setObjectName("Another Object"); - QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); - QObject::connect(&ob1, SIGNAL(destroyed()), &ob, SLOT(deleteLater())); + QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater); + QObject::connect(&ob1, &QObject::destroyed, &ob, &QObject::deleteLater); BREAK_HERE; - QObject::disconnect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); - QObject::disconnect(&ob1, SIGNAL(destroyed()), &ob, SLOT(deleteLater())); + QObject::disconnect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater); + QObject::disconnect(&ob1, &QObject::destroyed, &ob, &QObject::deleteLater); dummyStatement(&ob, &ob1); #endif } @@ -1930,7 +1930,6 @@ namespace qobject { Q_OBJECT public: Receiver() { setObjectName("Receiver"); } - public slots: void aSlot() { QObject *s = sender(); if (s) { @@ -1945,7 +1944,7 @@ namespace qobject { { Sender sender; Receiver receiver; - QObject::connect(&sender, SIGNAL(aSignal()), &receiver, SLOT(aSlot())); + QObject::connect(&sender, &Sender::aSignal, &receiver, &Receiver::aSlot); // Break here. // Single step through signal emission. sender.doEmit(); diff --git a/tests/manual/debugger/spacy path/app with space.cpp b/tests/manual/debugger/spacy path/app with space.cpp index af7226bbc37..1dfa82c0efd 100644 --- a/tests/manual/debugger/spacy path/app with space.cpp +++ b/tests/manual/debugger/spacy path/app with space.cpp @@ -222,8 +222,8 @@ void testObject(int &argc, char *argv[]) QObject ob1; ob1.setObjectName("Another Object"); - QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); - QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater())); + QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater); + QObject::connect(&app, &QGuiApplication::lastWindowClosed, &ob, &QObject::deleteLater); QList obs; obs.append(&ob); diff --git a/tests/manual/debugger/spacy-file/app with space.cpp b/tests/manual/debugger/spacy-file/app with space.cpp index af7226bbc37..1dfa82c0efd 100644 --- a/tests/manual/debugger/spacy-file/app with space.cpp +++ b/tests/manual/debugger/spacy-file/app with space.cpp @@ -222,8 +222,8 @@ void testObject(int &argc, char *argv[]) QObject ob1; ob1.setObjectName("Another Object"); - QObject::connect(&ob, SIGNAL(destroyed()), &ob1, SLOT(deleteLater())); - QObject::connect(&app, SIGNAL(lastWindowClosed()), &ob, SLOT(deleteLater())); + QObject::connect(&ob, &QObject::destroyed, &ob1, &QObject::deleteLater); + QObject::connect(&app, &QGuiApplication::lastWindowClosed, &ob, &QObject::deleteLater); QList obs; obs.append(&ob); diff --git a/tests/manual/fakevim/main.cpp b/tests/manual/fakevim/main.cpp index fa561381b73..4250676dea2 100644 --- a/tests/manual/fakevim/main.cpp +++ b/tests/manual/fakevim/main.cpp @@ -84,7 +84,6 @@ public: : QObject(parent), m_widget(widget), m_mainWindow(mw) {} -public slots: void changeSelection(const QList &s) { if (QPlainTextEdit *ed = qobject_cast(m_widget)) @@ -230,19 +229,18 @@ void readFile(FakeVimHandler &handler, const QString &editFileName) void connectSignals(FakeVimHandler &handler, Proxy &proxy) { - QObject::connect(&handler, SIGNAL(commandBufferChanged(QString,int,int,int,QObject*)), - &proxy, SLOT(changeStatusMessage(QString,int))); - QObject::connect(&handler, - SIGNAL(selectionChanged(QList)), - &proxy, SLOT(changeSelection(QList))); - QObject::connect(&handler, SIGNAL(extraInformationChanged(QString)), - &proxy, SLOT(changeExtraInformation(QString))); - QObject::connect(&handler, SIGNAL(statusDataChanged(QString)), - &proxy, SLOT(changeStatusData(QString))); - QObject::connect(&handler, SIGNAL(highlightMatches(QString)), - &proxy, SLOT(highlightMatches(QString))); - QObject::connect(&handler, SIGNAL(handleExCommandRequested(bool*,ExCommand)), - &proxy, SLOT(handleExCommand(bool*,ExCommand))); + QObject::connect(&handler, &FakeVimHandler::commandBufferChanged, + &proxy, &Proxy::changeStatusMessage); + QObject::connect(&handler, &FakeVimHandler::selectionChanged, + &proxy, &Proxy::changeSelection); + QObject::connect(&handler, &FakeVimHandler::extraInformationChanged, + &proxy, &Proxy::changeExtraInformation); + QObject::connect(&handler, &FakeVimHandler::statusDataChanged, + &proxy, &Proxy::changeStatusData); + QObject::connect(&handler, &FakeVimHandler::highlightMatches, + &proxy, &Proxy::highlightMatches); + QObject::connect(&handler, &FakeVimHandler::handleExCommandRequested, + &proxy, &Proxy::handleExCommand); } int main(int argc, char *argv[]) diff --git a/tests/manual/pluginview/plugindialog.h b/tests/manual/pluginview/plugindialog.h index 6206f3556d5..27d0eea7951 100644 --- a/tests/manual/pluginview/plugindialog.h +++ b/tests/manual/pluginview/plugindialog.h @@ -38,12 +38,11 @@ class PluginDialog : public QWidget public: PluginDialog(); -private slots: +private: void updateButtons(); void openDetails(ExtensionSystem::PluginSpec *spec = nullptr); void openErrorDetails(); -private: ExtensionSystem::PluginView *m_view; QPushButton *m_detailsButton; diff --git a/tests/manual/process/mainwindow.cpp b/tests/manual/process/mainwindow.cpp index a3ca20196d4..bd89d935cf8 100644 --- a/tests/manual/process/mainwindow.cpp +++ b/tests/manual/process/mainwindow.cpp @@ -37,7 +37,7 @@ MainWindow::MainWindow(QWidget *parent) : m_logWindow(new QPlainTextEdit) { setCentralWidget(m_logWindow); - QTimer::singleShot(200, this, SLOT(test())); + QTimer::singleShot(200, this, &MainWindow::test); } void MainWindow::append(const QString &s) @@ -54,8 +54,8 @@ void MainWindow::test() Utils::SynchronousProcess process; process.setTimeoutS(2); qDebug() << "Async: " << cmd << args; - connect(&process, SIGNAL(stdOut(QString,bool)), this, SLOT(append(QString))); - connect(&process, SIGNAL(stdErr(QString,bool)), this, SLOT(append(QString))); + connect(&process, &Utils::SynchronousProcess::stdOut, this, &MainWindow::append); + connect(&process, &Utils::SynchronousProcess::stdErr, this, &MainWindow::append); const Utils::SynchronousProcessResponse resp = process.run(cmd, args); qDebug() << resp; } diff --git a/tests/manual/process/mainwindow.h b/tests/manual/process/mainwindow.h index 6dfe3874000..3171b841f8b 100644 --- a/tests/manual/process/mainwindow.h +++ b/tests/manual/process/mainwindow.h @@ -37,9 +37,6 @@ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); -signals: - -public slots: void test(); void append(const QString &s); diff --git a/tests/manual/ssh/errorhandling/main.cpp b/tests/manual/ssh/errorhandling/main.cpp index 9eb44277c9e..7aab5d0bc18 100644 --- a/tests/manual/ssh/errorhandling/main.cpp +++ b/tests/manual/ssh/errorhandling/main.cpp @@ -110,7 +110,7 @@ public: delete m_connection; } -private slots: +private: void handleConnected() { qDebug("Error: Received unexpected connected() signal."); @@ -162,7 +162,6 @@ private slots: qDebug("Error: The following test timed out: %s", testItem.description); } -private: void runNextTest() { if (m_connection) { @@ -170,10 +169,10 @@ private: delete m_connection; } m_connection = new SshConnection(m_testSet.first().params); - connect(m_connection, SIGNAL(connected()), SLOT(handleConnected())); - connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected())); - connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleDataAvailable(QString))); - connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError(QSsh::SshError))); + connect(m_connection, &SshConnection::connected, this, &Test::handleConnected); + connect(m_connection, &SshConnection::disconnected, this, &Test::handleDisconnected); + connect(m_connection, &SshConnection::dataAvailable, this, &Test::handleDataAvailable); + connect(m_connection, &SshConnection::error, this, &Test::handleError); const TestItem &nextItem = m_testSet.first(); m_timeoutTimer.stop(); m_timeoutTimer.setInterval(qMax(10000, nextItem.params.timeout * 1000)); diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp index 44c90470051..062a974282b 100644 --- a/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp +++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.cpp @@ -45,7 +45,7 @@ RemoteProcessTest::RemoteProcessTest(const SshConnectionParameters ¶ms) m_state(Inactive) { m_timeoutTimer->setInterval(5000); - connect(m_timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout())); + connect(m_timeoutTimer, &QTimer::timeout, this, &RemoteProcessTest::handleTimeout); } RemoteProcessTest::~RemoteProcessTest() @@ -55,14 +55,16 @@ RemoteProcessTest::~RemoteProcessTest() void RemoteProcessTest::run() { - connect(m_remoteRunner, SIGNAL(connectionError()), - SLOT(handleConnectionError())); - connect(m_remoteRunner, SIGNAL(processStarted()), - SLOT(handleProcessStarted())); - connect(m_remoteRunner, SIGNAL(readyReadStandardOutput()), SLOT(handleProcessStdout())); - connect(m_remoteRunner, SIGNAL(readyReadStandardError()), SLOT(handleProcessStderr())); - connect(m_remoteRunner, SIGNAL(processClosed(int)), - SLOT(handleProcessClosed(int))); + connect(m_remoteRunner, &SshRemoteProcessRunner::connectionError, + this, &RemoteProcessTest::handleConnectionError); + connect(m_remoteRunner, &SshRemoteProcessRunner::processStarted, + this, &RemoteProcessTest::handleProcessStarted); + connect(m_remoteRunner, &SshRemoteProcessRunner::readyReadStandardOutput, + this, &RemoteProcessTest::handleProcessStdout); + connect(m_remoteRunner, &SshRemoteProcessRunner::readyReadStandardError, + this, &RemoteProcessTest::handleProcessStderr); + connect(m_remoteRunner, &SshRemoteProcessRunner::processClosed, + this, &RemoteProcessTest::handleProcessClosed); std::cout << "Testing successful remote process... " << std::flush; m_state = TestingSuccess; @@ -91,7 +93,8 @@ void RemoteProcessTest::handleProcessStarted() SshRemoteProcessRunner * const killer = new SshRemoteProcessRunner(this); killer->run("pkill -9 sleep", m_sshParams); } else if (m_state == TestingIoDevice) { - connect(m_catProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead())); + connect(m_catProcess.data(), &QIODevice::readyRead, + this, &RemoteProcessTest::handleReadyRead); m_textStream = new QTextStream(m_catProcess.data()); *m_textStream << testString(); m_textStream->flush(); @@ -209,9 +212,10 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus) std::cout << "Ok.\nTesting I/O device functionality... " << std::flush; m_state = TestingIoDevice; m_sshConnection = new SshConnection(m_sshParams); - connect(m_sshConnection, SIGNAL(connected()), SLOT(handleConnected())); - connect(m_sshConnection, SIGNAL(error(QSsh::SshError)), - SLOT(handleConnectionError())); + connect(m_sshConnection, &SshConnection::connected, + this, &RemoteProcessTest::handleConnected); + connect(m_sshConnection, &SshConnection::error, + this, &RemoteProcessTest::handleConnectionError); m_sshConnection->connectToHost(); m_timeoutTimer->start(); break; @@ -280,8 +284,10 @@ void RemoteProcessTest::handleConnected() Q_ASSERT(m_state == TestingIoDevice); m_catProcess = m_sshConnection->createRemoteProcess(QString::fromLatin1("/bin/cat").toUtf8()); - connect(m_catProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted())); - connect(m_catProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int))); + connect(m_catProcess.data(), &SshRemoteProcess::started, + this, &RemoteProcessTest::handleProcessStarted); + connect(m_catProcess.data(), &SshRemoteProcess::closed, + this, &RemoteProcessTest::handleProcessClosed); m_started = false; m_timeoutTimer->start(); m_catProcess->start(); @@ -347,11 +353,14 @@ void RemoteProcessTest::handleSuccessfulIoTest() m_remoteStderr.clear(); m_echoProcess = m_sshConnection->createRemoteProcess("printf " + StderrOutput + " >&2"); m_echoProcess->setReadChannel(QProcess::StandardError); - connect(m_echoProcess.data(), SIGNAL(started()), SLOT(handleProcessStarted())); - connect(m_echoProcess.data(), SIGNAL(closed(int)), SLOT(handleProcessClosed(int))); - connect(m_echoProcess.data(), SIGNAL(readyRead()), SLOT(handleReadyRead())); - connect(m_echoProcess.data(), SIGNAL(readyReadStandardError()), - SLOT(handleReadyReadStderr())); + connect(m_echoProcess.data(), &SshRemoteProcess::started, + this, &RemoteProcessTest::handleProcessStarted); + connect(m_echoProcess.data(), &SshRemoteProcess::closed, + this, &RemoteProcessTest::handleProcessClosed); + connect(m_echoProcess.data(), &QIODevice::readyRead, + this, &RemoteProcessTest::handleReadyRead); + connect(m_echoProcess.data(), &SshRemoteProcess::readyReadStandardError, + this, &RemoteProcessTest::handleReadyReadStderr); m_echoProcess->start(); m_timeoutTimer->start(); } diff --git a/tests/manual/ssh/remoteprocess/remoteprocesstest.h b/tests/manual/ssh/remoteprocess/remoteprocesstest.h index 44c02169e78..b3c8ebc3e3f 100644 --- a/tests/manual/ssh/remoteprocess/remoteprocesstest.h +++ b/tests/manual/ssh/remoteprocess/remoteprocesstest.h @@ -40,7 +40,12 @@ public: ~RemoteProcessTest(); void run(); -private slots: +private: + enum State { + Inactive, TestingSuccess, TestingFailure, TestingCrash, TestingTerminal, TestingIoDevice, + TestingProcessChannels + }; + void handleConnectionError(); void handleProcessStarted(); void handleProcessStdout(); @@ -52,12 +57,6 @@ private slots: void handleReadyReadStderr(); void handleConnected(); -private: - enum State { - Inactive, TestingSuccess, TestingFailure, TestingCrash, TestingTerminal, TestingIoDevice, - TestingProcessChannels - }; - QString testString() const; void handleSuccessfulCrashTest(); void handleSuccessfulIoTest(); diff --git a/tests/manual/ssh/sftp/sftptest.cpp b/tests/manual/ssh/sftp/sftptest.cpp index 007f261822b..40c3157fd0d 100644 --- a/tests/manual/ssh/sftp/sftptest.cpp +++ b/tests/manual/ssh/sftp/sftptest.cpp @@ -56,9 +56,9 @@ SftpTest::~SftpTest() void SftpTest::run() { m_connection = new SshConnection(m_parameters.sshParams); - connect(m_connection, SIGNAL(connected()), SLOT(handleConnected())); - connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError())); - connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected())); + connect(m_connection, &SshConnection::connected, this, &SftpTest::handleConnected); + connect(m_connection, &SshConnection::error, this, &SftpTest::handleError); + connect(m_connection, &SshConnection::disconnected, this, &SftpTest::handleDisconnected); std::cout << "Connecting to host '" << qPrintable(m_parameters.sshParams.host) << "'..." << std::endl; m_state = Connecting; @@ -74,17 +74,17 @@ void SftpTest::handleConnected() } else { std::cout << "Connected. Initializing SFTP channel..." << std::endl; m_channel = m_connection->createSftpChannel(); - connect(m_channel.data(), SIGNAL(initialized()), this, - SLOT(handleChannelInitialized())); - connect(m_channel.data(), SIGNAL(channelError(QString)), this, - SLOT(handleChannelInitializationFailure(QString))); - connect(m_channel.data(), SIGNAL(finished(QSsh::SftpJobId,QString)), - this, SLOT(handleJobFinished(QSsh::SftpJobId,QString))); - connect(m_channel.data(), - SIGNAL(fileInfoAvailable(QSsh::SftpJobId,QList)), - SLOT(handleFileInfo(QSsh::SftpJobId,QList))); - connect(m_channel.data(), SIGNAL(closed()), this, - SLOT(handleChannelClosed())); + connect(m_channel.data(), &SftpChannel::initialized, + this, &SftpTest::handleChannelInitialized); + connect(m_channel.data(), &SftpChannel::channelError, + this, &SftpTest::handleChannelInitializationFailure); + connect(m_channel.data(), &SftpChannel::finished, + this, static_cast( + &SftpTest::handleJobFinished)); + connect(m_channel.data(), &SftpChannel::fileInfoAvailable, + this, &SftpTest::handleFileInfo); + connect(m_channel.data(), &SftpChannel::closed, + this, &SftpTest::handleChannelClosed); m_state = InitializingChannel; m_channel->initialize(); } diff --git a/tests/manual/ssh/sftp/sftptest.h b/tests/manual/ssh/sftp/sftptest.h index 1b984c41544..97b13217eeb 100644 --- a/tests/manual/ssh/sftp/sftptest.h +++ b/tests/manual/ssh/sftp/sftptest.h @@ -46,16 +46,6 @@ public: ~SftpTest(); void run(); -private slots: - void handleConnected(); - void handleError(); - void handleDisconnected(); - void handleChannelInitialized(); - void handleChannelInitializationFailure(const QString &reason); - void handleJobFinished(QSsh::SftpJobId job, const QString &error); - void handleFileInfo(QSsh::SftpJobId job, const QList &fileInfoList); - void handleChannelClosed(); - private: typedef QHash JobMap; typedef QSharedPointer FilePtr; @@ -65,6 +55,15 @@ private: CheckingDirAttributes, CheckingDirContents, RemovingDir, ChannelClosing, Disconnecting }; + void handleConnected(); + void handleError(); + void handleDisconnected(); + void handleChannelInitialized(); + void handleChannelInitializationFailure(const QString &reason); + void handleJobFinished(QSsh::SftpJobId job, const QString &error); + void handleFileInfo(QSsh::SftpJobId job, const QList &fileInfoList); + void handleChannelClosed(); + void removeFile(const FilePtr &filePtr, bool remoteToo); void removeFiles(bool remoteToo); QString cmpFileName(const QString &localFileName) const; diff --git a/tests/manual/ssh/sftpfsmodel/window.cpp b/tests/manual/ssh/sftpfsmodel/window.cpp index fdbfab0f45b..79a05fad38a 100644 --- a/tests/manual/ssh/sftpfsmodel/window.cpp +++ b/tests/manual/ssh/sftpfsmodel/window.cpp @@ -44,8 +44,8 @@ using namespace QSsh; SftpFsWindow::SftpFsWindow(QWidget *parent) : QDialog(parent), m_ui(new Ui::Window) { m_ui->setupUi(this); - connect(m_ui->connectButton, SIGNAL(clicked()), SLOT(connectToHost())); - connect(m_ui->downloadButton, SIGNAL(clicked()), SLOT(downloadFile())); + connect(m_ui->connectButton, &QAbstractButton::clicked, this, &SftpFsWindow::connectToHost); + connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &SftpFsWindow::downloadFile); } SftpFsWindow::~SftpFsWindow() @@ -67,11 +67,12 @@ void SftpFsWindow::connectToHost() m_fsModel = new SftpFileSystemModel(this); if (m_ui->useModelTesterCheckBox->isChecked()) new ModelTest(m_fsModel, this); - connect(m_fsModel, SIGNAL(sftpOperationFailed(QString)), - SLOT(handleSftpOperationFailed(QString))); - connect(m_fsModel, SIGNAL(connectionError(QString)), SLOT(handleConnectionError(QString))); - connect(m_fsModel, SIGNAL(sftpOperationFinished(QSsh::SftpJobId,QString)), - SLOT(handleSftpOperationFinished(QSsh::SftpJobId,QString))); + connect(m_fsModel, &SftpFileSystemModel::sftpOperationFailed, + this, &SftpFsWindow::handleSftpOperationFailed); + connect(m_fsModel, &SftpFileSystemModel::connectionError, + this, &SftpFsWindow::handleConnectionError); + connect(m_fsModel, &SftpFileSystemModel::sftpOperationFinished, + this, &SftpFsWindow::handleSftpOperationFinished); m_fsModel->setSshConnection(sshParams); m_ui->fsView->setModel(m_fsModel); } diff --git a/tests/manual/ssh/sftpfsmodel/window.h b/tests/manual/ssh/sftpfsmodel/window.h index 6b8dde1329e..d3ba03c1345 100644 --- a/tests/manual/ssh/sftpfsmodel/window.h +++ b/tests/manual/ssh/sftpfsmodel/window.h @@ -40,14 +40,13 @@ public: SftpFsWindow(QWidget *parent = 0); ~SftpFsWindow(); -private slots: +private: void connectToHost(); void downloadFile(); void handleConnectionError(const QString &errorMessage); void handleSftpOperationFailed(const QString &errorMessage); void handleSftpOperationFinished(QSsh::SftpJobId jobId, const QString &error); -private: QSsh::SftpFileSystemModel *m_fsModel; Ui::Window *m_ui; }; diff --git a/tests/manual/ssh/shell/shell.cpp b/tests/manual/ssh/shell/shell.cpp index 48f3f18bf75..c3997eed647 100644 --- a/tests/manual/ssh/shell/shell.cpp +++ b/tests/manual/ssh/shell/shell.cpp @@ -42,9 +42,9 @@ Shell::Shell(const SshConnectionParameters ¶meters, QObject *parent) m_connection(new SshConnection(parameters)), m_stdin(new QFile(this)) { - connect(m_connection, SIGNAL(connected()), SLOT(handleConnected())); - connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleShellMessage(QString))); - connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError())); + connect(m_connection, &SshConnection::connected, this, &Shell::handleConnected); + connect(m_connection, &SshConnection::dataAvailable, this, &Shell::handleShellMessage); + connect(m_connection, &SshConnection::error, this, &Shell::handleConnectionError); } Shell::~Shell() @@ -77,17 +77,19 @@ void Shell::handleShellMessage(const QString &message) void Shell::handleConnected() { m_shell = m_connection->createRemoteShell(); - connect(m_shell.data(), SIGNAL(started()), SLOT(handleShellStarted())); - connect(m_shell.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleRemoteStdout())); - connect(m_shell.data(), SIGNAL(readyReadStandardError()), SLOT(handleRemoteStderr())); - connect(m_shell.data(), SIGNAL(closed(int)), SLOT(handleChannelClosed(int))); + connect(m_shell.data(), &SshRemoteProcess::started, this, &Shell::handleShellStarted); + connect(m_shell.data(), &SshRemoteProcess::readyReadStandardOutput, + this, &Shell::handleRemoteStdout); + connect(m_shell.data(), &SshRemoteProcess::readyReadStandardError, + this, &Shell::handleRemoteStderr); + connect(m_shell.data(), &SshRemoteProcess::closed, this, &Shell::handleChannelClosed); m_shell->start(); } void Shell::handleShellStarted() { QSocketNotifier * const notifier = new QSocketNotifier(0, QSocketNotifier::Read, this); - connect(notifier, SIGNAL(activated(int)), SLOT(handleStdin())); + connect(notifier, &QSocketNotifier::activated, this, &Shell::handleStdin); } void Shell::handleRemoteStdout() diff --git a/tests/manual/ssh/shell/shell.h b/tests/manual/ssh/shell/shell.h index 3fae9bf18be..ed5f4d82b37 100644 --- a/tests/manual/ssh/shell/shell.h +++ b/tests/manual/ssh/shell/shell.h @@ -49,7 +49,7 @@ public: void run(); -private slots: +private: void handleConnected(); void handleConnectionError(); void handleRemoteStdout(); @@ -59,7 +59,6 @@ private slots: void handleShellStarted(); void handleStdin(); -private: QSsh::SshConnection *m_connection; QSharedPointer m_shell; QFile * const m_stdin; diff --git a/tests/manual/ssh/tunnel/directtunnel.cpp b/tests/manual/ssh/tunnel/directtunnel.cpp index 5c23669d716..54f4c3a3e5d 100644 --- a/tests/manual/ssh/tunnel/directtunnel.cpp +++ b/tests/manual/ssh/tunnel/directtunnel.cpp @@ -47,8 +47,8 @@ DirectTunnel::DirectTunnel(const SshConnectionParameters ¶meters, QObject *p m_targetServer(new QTcpServer(this)), m_expectingChannelClose(false) { - connect(m_connection, SIGNAL(connected()), SLOT(handleConnected())); - connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError())); + connect(m_connection, &SshConnection::connected, this, &DirectTunnel::handleConnected); + connect(m_connection, &SshConnection::error, this, &DirectTunnel::handleConnectionError); } DirectTunnel::~DirectTunnel() @@ -77,14 +77,16 @@ void DirectTunnel::handleConnected() return; } m_targetPort = m_targetServer->serverPort(); - connect(m_targetServer, SIGNAL(newConnection()), SLOT(handleNewConnection())); + connect(m_targetServer, &QTcpServer::newConnection, this, &DirectTunnel::handleNewConnection); m_tunnel = m_connection->createDirectTunnel(QLatin1String("localhost"), 1024, // made-up values QLatin1String("localhost"), m_targetPort); - connect(m_tunnel.data(), SIGNAL(initialized()), SLOT(handleInitialized())); - connect(m_tunnel.data(), SIGNAL(error(QString)), SLOT(handleTunnelError(QString))); - connect(m_tunnel.data(), SIGNAL(readyRead()), SLOT(handleServerData())); - connect(m_tunnel.data(), SIGNAL(aboutToClose()), SLOT(handleTunnelClosed())); + connect(m_tunnel.data(), &SshDirectTcpIpTunnel::initialized, + this, &DirectTunnel::handleInitialized); + connect(m_tunnel.data(), &SshDirectTcpIpTunnel::error, + this, &DirectTunnel::handleTunnelError); + connect(m_tunnel.data(), &QIODevice::readyRead, this, &DirectTunnel::handleServerData); + connect(m_tunnel.data(), &QIODevice::aboutToClose, this, &DirectTunnel::handleTunnelClosed); std::cout << "Initializing tunnel..." << std::endl; m_tunnel->initialize(); @@ -95,7 +97,7 @@ void DirectTunnel::handleInitialized() std::cout << "Writing data into the tunnel..." << std::endl; m_tunnel->write(TestData); QTimer * const timeoutTimer = new QTimer(this); - connect(timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout())); + connect(timeoutTimer, &QTimer::timeout, this, &DirectTunnel::handleTimeout); timeoutTimer->start(10000); } @@ -131,8 +133,10 @@ void DirectTunnel::handleNewConnection() { m_targetSocket = m_targetServer->nextPendingConnection(); m_targetServer->close(); - connect(m_targetSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(handleSocketError())); - connect(m_targetSocket, SIGNAL(readyRead()), SLOT(handleClientData())); + connect(m_targetSocket, + static_cast(&QAbstractSocket::error), + this, &DirectTunnel::handleSocketError); + connect(m_targetSocket, &QIODevice::readyRead, this, &DirectTunnel::handleClientData); handleClientData(); } diff --git a/tests/manual/ssh/tunnel/directtunnel.h b/tests/manual/ssh/tunnel/directtunnel.h index 26c1898b1c5..b73fcd9d63b 100644 --- a/tests/manual/ssh/tunnel/directtunnel.h +++ b/tests/manual/ssh/tunnel/directtunnel.h @@ -51,7 +51,7 @@ public: signals: void finished(int errorCode); -private slots: +private: void handleConnected(); void handleConnectionError(); void handleServerData(); @@ -63,7 +63,6 @@ private slots: void handleClientData(); void handleTimeout(); -private: QSsh::SshConnection * const m_connection; QSharedPointer m_tunnel; QTcpServer * const m_targetServer; diff --git a/tests/manual/ssh/tunnel/forwardtunnel.h b/tests/manual/ssh/tunnel/forwardtunnel.h index d5cc23ff627..fd3bf35d40d 100644 --- a/tests/manual/ssh/tunnel/forwardtunnel.h +++ b/tests/manual/ssh/tunnel/forwardtunnel.h @@ -51,7 +51,7 @@ public: signals: void finished(int exitCode); -private slots: +private: void handleConnected(); void handleConnectionError(QSsh::SshError error); void handleInitialized(); @@ -60,7 +60,6 @@ private slots: void handleNewConnection(); void handleSocketError(); -private: QSsh::SshConnection * const m_connection; QSharedPointer m_server; QTcpSocket *m_targetSocket; From dc01319cd720be5c980bcc7c3c3cfc4c1b65823a Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 27 Jun 2016 12:28:34 +0200 Subject: [PATCH 08/30] C++: Fix compilation of tst_lexer.cpp ...with MSVC2013. tst_lexer.cpp(406) : error C2398: Element '1': conversion from 'CPlusPlus::Kind' to 'unsigned int' requires a narrowing conversion Change-Id: I1c9415cb02d2f0fa85d48a1abbc688d8f53b5b43 Reviewed-by: Christian Stenger (cherry picked from commit 04b21947812863018b20fcb56d550fa9f72b0c98) --- tests/auto/cplusplus/lexer/tst_lexer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp index ecbd0f4ace9..fd365409028 100644 --- a/tests/auto/cplusplus/lexer/tst_lexer.cpp +++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp @@ -403,7 +403,7 @@ void tst_SimpleLexer::ppOpOrPunc() QFETCH(Kind, expectedTokenKind); const QByteArray source = QTest::currentDataTag(); - run(source, toTokens({expectedTokenKind}), false, CompareKind, true); + run(source, toTokens({unsigned(expectedTokenKind)}), false, CompareKind, true); } void tst_SimpleLexer::ppOpOrPunc_data() From 2ac7300f0e50d17ed65bc2fd63adc16ae6a209b8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 28 Jun 2016 13:49:02 +0200 Subject: [PATCH 09/30] QmlDesigner: Fix crash in tests In the tests we have cases with no rewriter attached. We warn in these cases. Change-Id: Ibc89ff501bf6d48ed3a2f230ee6e1afda5d4d06c Reviewed-by: Christian Stenger --- .../designercore/rewritertransaction.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/rewritertransaction.cpp b/src/plugins/qmldesigner/designercore/rewritertransaction.cpp index 7dbc5463772..755b667a063 100644 --- a/src/plugins/qmldesigner/designercore/rewritertransaction.cpp +++ b/src/plugins/qmldesigner/designercore/rewritertransaction.cpp @@ -27,6 +27,8 @@ #include #include +#include + #ifndef QMLDESIGNER_TEST #include #include @@ -82,13 +84,22 @@ void RewriterTransaction::commit() { if (m_valid) { m_valid = false; - bool oldSemanticChecks = view()->rewriterView()->checkSemanticErrors(); - if (m_ignoreSemanticChecks) - view()->rewriterView()->setCheckSemanticErrors(false); + + RewriterView *rewriterView = view()->rewriterView(); + + QTC_ASSERT(rewriterView, qWarning() << Q_FUNC_INFO << "No rewriter attached"); + + bool oldSemanticChecks = false; + if (rewriterView) { + oldSemanticChecks = rewriterView->checkSemanticErrors(); + if (m_ignoreSemanticChecks) + rewriterView->setCheckSemanticErrors(false); + } view()->emitRewriterEndTransaction(); - view()->rewriterView()->setCheckSemanticErrors(oldSemanticChecks); + if (rewriterView) + view()->rewriterView()->setCheckSemanticErrors(oldSemanticChecks); if (m_activeIdentifier) { qDebug() << "Commit RewriterTransaction:" << m_identifier << m_identifierNumber; From 8e1e987dd5c9fd333dce5160b2d5cc894931b7b8 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 28 Jun 2016 12:49:35 +0200 Subject: [PATCH 10/30] QmlJS: Do not try the canonical file path This is a real bottle neck on Windows and I do not know of a case where it is required. Change-Id: I99ebf3bfdd22cfb0ed82d6d39eeb83f079f654d6 Reviewed-by: Marco Benelli --- src/libs/qmljs/qmljslink.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 606475a35be..d9f21183f4f 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -426,13 +426,8 @@ bool LinkPrivate::importLibrary(Document::Ptr doc, QString libraryPath = libraryPath_; LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath); - if (!libraryInfo.isValid()) { - // try canonical path - libraryPath = QFileInfo(libraryPath).canonicalFilePath(); - libraryInfo = snapshot.libraryInfo(libraryPath); - if (!libraryInfo.isValid()) - return false; - } + if (!libraryInfo.isValid()) + return false; import->libraryPath = libraryPath; From 031bfa6711e029dfcfc91648dc8584dd234a3097 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 28 Jun 2016 11:23:47 +0200 Subject: [PATCH 11/30] Qmake: Update description of Qt:QMAKE_MKSPECS expando Change-Id: Id955967e57c12839dec5a54511662ec92f1e43e5 Reviewed-by: Oswald Buddenhagen --- src/plugins/qtsupport/baseqtversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 56c13bd8206..673045bc7f3 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -341,7 +341,7 @@ void BaseQtVersion::setupExpander() [this] { return qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS"); }); m_expander.registerVariable("Qt:QMAKE_MKSPECS", - QtKitInformation::tr("The current Qt version's default mkspecs."), + QtKitInformation::tr("The current Qt version's default mkspecs (Qt 4)."), [this] { return qmakeProperty(m_versionInfo, "QMAKE_MKSPECS"); }); m_expander.registerVariable("Qt:QMAKE_VERSION", From a721a6f0c9619a85ce6900f89a7353fa68e12c69 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 28 Jun 2016 11:24:07 +0200 Subject: [PATCH 12/30] Qmake: Add Qt:QMAKE_SPEC and Qt:QMAKE_XSPEC expandos Change-Id: Ice7e751609503a55ebcd8a488e42feecd0a293c0 Reviewed-by: Oswald Buddenhagen --- src/plugins/qtsupport/baseqtversion.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 673045bc7f3..8f5ad2855a3 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -343,6 +343,12 @@ void BaseQtVersion::setupExpander() m_expander.registerVariable("Qt:QMAKE_MKSPECS", QtKitInformation::tr("The current Qt version's default mkspecs (Qt 4)."), [this] { return qmakeProperty(m_versionInfo, "QMAKE_MKSPECS"); }); + m_expander.registerVariable("Qt:QMAKE_SPEC", + QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; host system)"), + [this] { return qmakeProperty(m_versionInfo, "QMAKE_SPEC"); }); + m_expander.registerVariable("Qt:QMAKE_XSPEC", + QtKitInformation::tr("The current Qt version's default mkspec (Qt 5; target system)."), + [this] { return qmakeProperty(m_versionInfo, "QMAKE_XSPEC"); }); m_expander.registerVariable("Qt:QMAKE_VERSION", QtKitInformation::tr("The current Qt's qmake version."), From 5199f84f60ed07d75bb071ba2d2de375adeefec7 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2016 16:40:23 +0200 Subject: [PATCH 13/30] Debugger: Clean up debuggerengine.cpp Some leftover stringfreeze workaround, plus QLatin1*. Change-Id: I5e143af5cda64cb29b7769174187fc86185a89cb Reviewed-by: Orgad Shaneh --- src/plugins/debugger/debuggerengine.cpp | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 8cb0ea8a2d1..8aa4c3aaddc 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -37,7 +37,6 @@ #include "logwindow.h" #include "memoryagent.h" #include "moduleshandler.h" -#include "gdb/gdbengine.h" // REMOVE #include "registerhandler.h" #include "sourcefileshandler.h" #include "sourceutils.h" @@ -564,7 +563,7 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) d->m_runControl->setApplicationProcessHandle(ProcessHandle(d->m_inferiorPid)); if (isNativeMixedActive()) - d->m_runParameters.inferior.environment.set(QLatin1String("QV4_FORCE_INTERPRETER"), QLatin1String("1")); + d->m_runParameters.inferior.environment.set("QV4_FORCE_INTERPRETER", "1"); action(OperateByInstruction)->setEnabled(hasCapability(DisassemblerCapability)); @@ -609,7 +608,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) } if (loc.fileName().isEmpty()) { - showMessage(QLatin1String("CANNOT GO TO THIS LOCATION")); + showMessage("CANNOT GO TO THIS LOCATION"); return; } const QString file = QDir::cleanPath(loc.fileName()); @@ -633,7 +632,7 @@ void DebuggerEngine::gotoLocation(const Location &loc) // Called from RunControl. void DebuggerEngine::handleStartFailed() { - showMessage(QLatin1String("HANDLE RUNCONTROL START FAILED")); + showMessage("HANDLE RUNCONTROL START FAILED"); d->m_runControl = 0; d->m_progress.setProgressValue(900); d->m_progress.reportCanceled(); @@ -643,7 +642,7 @@ void DebuggerEngine::handleStartFailed() // Called from RunControl. void DebuggerEngine::handleFinished() { - showMessage(QLatin1String("HANDLE RUNCONTROL FINISHED")); + showMessage("HANDLE RUNCONTROL FINISHED"); d->m_runControl = 0; d->m_progress.setProgressValue(1000); d->m_progress.reportFinished(); @@ -905,7 +904,7 @@ void DebuggerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &re if (result.gdbServerPort.isValid()) { QString &rc = d->m_runParameters.remoteChannel; - const int sepIndex = rc.lastIndexOf(QLatin1Char(':')); + const int sepIndex = rc.lastIndexOf(':'); if (sepIndex != -1) { rc.replace(sepIndex + 1, rc.count() - sepIndex - 1, QString::number(result.gdbServerPort.number())); @@ -1785,9 +1784,9 @@ QString DebuggerEngine::msgInterrupted() void DebuggerEngine::showStoppedBySignalMessageBox(QString meaning, QString name) { if (name.isEmpty()) - name = QLatin1Char(' ') + tr("", "name") + QLatin1Char(' '); + name = ' ' + tr("", "name") + ' '; if (meaning.isEmpty()) - meaning = QLatin1Char(' ') + tr("", "meaning") + QLatin1Char(' '); + meaning = ' ' + tr("", "meaning") + ' '; const QString msg = tr("

The inferior stopped because it received a " "signal from the operating system.

" "" @@ -1856,14 +1855,14 @@ void DebuggerEngine::validateExecutable(DebuggerRunParameters *sp) "experience for this binary format."); return; } else if (warnOnRelease) { - if (!symbolFile.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive)) - symbolFile.append(QLatin1String(".exe")); + if (!symbolFile.endsWith(".exe", Qt::CaseInsensitive)) + symbolFile.append(".exe"); QString errorMessage; QStringList rc; if (getPDBFiles(symbolFile, &rc, &errorMessage) && !rc.isEmpty()) return; if (!errorMessage.isEmpty()) { - detailedWarning.append(QLatin1Char('\n')); + detailedWarning.append('\n'); detailedWarning.append(errorMessage); } } else { @@ -1979,12 +1978,12 @@ void DebuggerEngine::validateExecutable(DebuggerRunParameters *sp) tr("The selected debugger may be inappropiate for the inferior.\n" "Examining symbols and setting breakpoints by file name and line number " "may fail.\n") - + QLatin1Char('\n') + detailedWarning); + + '\n' + detailedWarning); } else if (warnOnRelease) { AsynchronousMessageBox::information(tr("Warning"), tr("This does not seem to be a \"Debug\" build.\n" "Setting breakpoints by file name and line number may fail.") - + QLatin1Char('\n') + detailedWarning); + + '\n' + detailedWarning); } } @@ -2007,7 +2006,7 @@ void DebuggerEngine::updateLocalsView(const GdbMi &all) static int count = 0; showMessage(QString("") .arg(++count).arg(LogWindow::logTimeStamp()), LogMiscInput); - showStatusMessage(GdbEngine::tr("Finished retrieving data"), 400); // FIXME: String + showStatusMessage(tr("Finished retrieving data"), 400); DebuggerToolTipManager::updateEngine(this); From 2a104dcfe7329cb264a27b154ab122b51efad10d Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 27 Jun 2016 14:38:36 +0200 Subject: [PATCH 14/30] Debugger: Consolidate icon storage handling We settled now on global objects being fine for the purpose in Core and ProjectExplorer, so there's no point in using something more fancy in the debugger. Change-Id: I72e45f398c09d22894419c274dfbea77da0fc153 Reviewed-by: Christian Stenger --- src/plugins/debugger/breakhandler.cpp | 50 ++------- src/plugins/debugger/breakhandler.h | 7 -- src/plugins/debugger/debugger.pro | 3 +- src/plugins/debugger/debugger.qbs | 2 +- src/plugins/debugger/debuggercore.h | 1 - src/plugins/debugger/debuggerengine.cpp | 3 +- src/plugins/debugger/debuggericons.cpp | 128 ++++++++++++++++++++++ src/plugins/debugger/debuggericons.h | 132 +++++++---------------- src/plugins/debugger/debuggerplugin.cpp | 9 -- src/plugins/debugger/snapshothandler.cpp | 5 +- src/plugins/debugger/snapshothandler.h | 2 - src/plugins/debugger/sourceagent.cpp | 4 +- src/plugins/debugger/stackhandler.cpp | 8 +- src/plugins/debugger/stackhandler.h | 2 - src/plugins/debugger/threadshandler.cpp | 15 +-- 15 files changed, 188 insertions(+), 183 deletions(-) create mode 100644 src/plugins/debugger/debuggericons.cpp diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 35b682bfc43..823a750b91c 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -259,44 +259,6 @@ BreakHandler::BreakHandler() << tr("Address") << tr("Condition") << tr("Ignore") << tr("Threads")); } -QIcon BreakHandler::breakpointIcon() -{ - static QIcon icon = Icons::BREAKPOINT.icon(); - return icon; -} - -QIcon BreakHandler::disabledBreakpointIcon() -{ - static QIcon icon = Icons::BREAKPOINT_DISABLED.icon(); - return icon; -} - -QIcon BreakHandler::pendingBreakpointIcon() -{ - static QIcon icon = Icons::BREAKPOINT_PENDING.icon(); - return icon; -} - -QIcon BreakHandler::watchpointIcon() -{ - static QIcon icon = Icons::WATCHPOINT.icon(); - return icon; -} - -QIcon BreakHandler::tracepointIcon() -{ - static QIcon icon = Icons::TRACEPOINT.icon(); - return icon; -} - -QIcon BreakHandler::emptyIcon() -{ - static QIcon icon = Icons::BREAKPOINT_PENDING.icon(); - //static QIcon icon = Icons::WATCHPOINT.icon(); - //static QIcon icon = Icons::EMPTY.icon(); - return icon; -} - static inline bool fileNameMatch(const QString &f1, const QString &f2) { if (HostOsInfo::fileNameCaseSensitivity() == Qt::CaseInsensitive) @@ -1401,16 +1363,16 @@ QIcon BreakpointItem::icon() const // FIXME: This seems to be called on each cursor blink as soon as the // cursor is near a line with a breakpoint marker (+/- 2 lines or so). if (m_params.isTracepoint()) - return BreakHandler::tracepointIcon(); + return Icons::TRACEPOINT.icon(); if (m_params.type == WatchpointAtAddress) - return BreakHandler::watchpointIcon(); + return Icons::WATCHPOINT.icon(); if (m_params.type == WatchpointAtExpression) - return BreakHandler::watchpointIcon(); + return Icons::WATCHPOINT.icon(); if (!m_params.enabled) - return BreakHandler::disabledBreakpointIcon(); + return Icons::BREAKPOINT_DISABLED.icon(); if (m_state == BreakpointInserted && !m_response.pending) - return BreakHandler::breakpointIcon(); - return BreakHandler::pendingBreakpointIcon(); + return Icons::BREAKPOINT.icon(); + return Icons::BREAKPOINT_PENDING.icon(); } QString BreakpointItem::toToolTip() const diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 7fda24c4c1c..97d16f6fa8f 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -187,13 +187,6 @@ public: Breakpoints findBreakpointsByIndex(const QList &list) const; void updateMarkers(); - static QIcon breakpointIcon(); - static QIcon disabledBreakpointIcon(); - static QIcon pendingBreakpointIcon(); - static QIcon emptyIcon(); - static QIcon watchpointIcon(); - static QIcon tracepointIcon(); - Breakpoint findBreakpointByFileAndLine(const QString &fileName, int lineNumber, bool useMarkerPosition = true); Breakpoint findBreakpointByAddress(quint64 address) const; diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index a09fbb72321..e3a95138142 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -123,7 +123,8 @@ SOURCES += \ localsandexpressionswindow.cpp \ imageviewer.cpp \ simplifytype.cpp \ - unstartedappwatcherdialog.cpp + unstartedappwatcherdialog.cpp \ + debuggericons.cpp RESOURCES += debugger.qrc diff --git a/src/plugins/debugger/debugger.qbs b/src/plugins/debugger/debugger.qbs index 351cd076fad..581424113aa 100644 --- a/src/plugins/debugger/debugger.qbs +++ b/src/plugins/debugger/debugger.qbs @@ -49,7 +49,7 @@ Project { "debugger_global.h", "debuggeractions.cpp", "debuggeractions.h", "debuggerconstants.h", - "debuggericons.h", + "debuggericons.h", "debuggericons.cpp", "debuggercore.h", "debuggerdialogs.cpp", "debuggerdialogs.h", "debuggerengine.cpp", "debuggerengine.h", diff --git a/src/plugins/debugger/debuggercore.h b/src/plugins/debugger/debuggercore.h index c8398a7a14b..11237e2712f 100644 --- a/src/plugins/debugger/debuggercore.h +++ b/src/plugins/debugger/debuggercore.h @@ -61,7 +61,6 @@ enum TestCases // Some convenience. void updateState(DebuggerEngine *engine); void updateWatchersWindow(bool showWatch, bool showReturn); -QIcon locationMarkIcon(); const CPlusPlus::Snapshot &cppCodeModelSnapshot(); bool hasSnapshots(); void openTextEditor(const QString &titlePattern, const QString &contents); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 8aa4c3aaddc..e1e89e17c25 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -28,6 +28,7 @@ #include "debuggerinternalconstants.h" #include "debuggeractions.h" #include "debuggercore.h" +#include "debuggericons.h" #include "debuggerruncontrol.h" #include "debuggerstartparameters.h" #include "debuggertooltipmanager.h" @@ -131,7 +132,7 @@ Location::Location(const StackFrame &frame, bool marker) LocationMark::LocationMark(DebuggerEngine *engine, const QString &file, int line) : TextMark(file, line, Constants::TEXT_MARK_CATEGORY_LOCATION), m_engine(engine) { - setIcon(Internal::locationMarkIcon()); + setIcon(Icons::LOCATION.icon()); setPriority(TextMark::HighPriority); } diff --git a/src/plugins/debugger/debuggericons.cpp b/src/plugins/debugger/debuggericons.cpp new file mode 100644 index 00000000000..af974ac38bc --- /dev/null +++ b/src/plugins/debugger/debuggericons.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "debuggericons.h" + +using namespace Utils; + +namespace Debugger { +namespace Icons { + +const Icon BREAKPOINT({ + {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}}, Icon::Tint); +const Icon BREAKPOINT_DISABLED({ + {":/debugger/images/breakpoint_disabled.png", Theme::IconsErrorColor}}, Icon::Tint); +const Icon BREAKPOINT_PENDING({ + {":/debugger/images/breakpoint.png", Theme::IconsErrorColor}, + {":/debugger/images/breakpoint_pending_overlay.png", Theme::PanelTextColorDark}}, Icon::IconStyleOptions(Icon::Tint | Icon::PunchEdges)); +const Icon BREAKPOINTS( + ":/debugger/images/debugger_breakpoints.png"); +const Icon WATCHPOINT({ + {":/core/images/eye_open.png", Theme::TextColorNormal}}, Icon::Tint); +const Icon TRACEPOINT({ + {":/core/images/eye_open.png", Theme::TextColorNormal}, + {":/debugger/images/tracepointoverlay.png", Theme::TextColorNormal}}, Icon::Tint | Icon::PunchEdges); +const Icon CONTINUE( + ":/debugger/images/debugger_continue.png"); +const Icon CONTINUE_FLAT({ + {":/debugger/images/debugger_continue_1_mask.png", Theme::IconsInterruptToolBarColor}, + {":/debugger/images/debugger_continue_2_mask.png", Theme::IconsRunToolBarColor}, + {":/projectexplorer/images/debugger_beetle_mask.png", Theme::IconsDebugColor}}); +const Icon DEBUG_CONTINUE_SMALL({ + {":/projectexplorer/images/continue_1_small.png", Theme::IconsInterruptColor}, + {":/projectexplorer/images/continue_2_small.png", Theme::IconsRunColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon DEBUG_CONTINUE_SMALL_TOOLBAR({ + {":/projectexplorer/images/continue_1_small.png", Theme::IconsInterruptToolBarColor}, + {":/projectexplorer/images/continue_2_small.png", Theme::IconsRunToolBarColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::IconsDebugColor}}); +const Icon INTERRUPT( + ":/debugger/images/debugger_interrupt.png"); +const Icon INTERRUPT_FLAT({ + {":/debugger/images/debugger_interrupt_mask.png", Theme::IconsInterruptToolBarColor}, + {":/projectexplorer/images/debugger_beetle_mask.png", Theme::IconsDebugColor}}); +const Icon DEBUG_INTERRUPT_SMALL({ + {":/core/images/interrupt_small.png", Theme::IconsInterruptColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon DEBUG_INTERRUPT_SMALL_TOOLBAR({ + {":/core/images/interrupt_small.png", Theme::IconsInterruptToolBarColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::IconsDebugColor}}); +const Icon DEBUG_EXIT_SMALL({ + {":/core/images/stop_small.png", Theme::IconsStopColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon DEBUG_EXIT_SMALL_TOOLBAR({ + {":/core/images/stop_small.png", Theme::IconsStopToolBarColor}, + {":/projectexplorer/images/debugger_overlay_small.png", Theme::IconsDebugColor}}); +const Icon LOCATION({ + {":/debugger/images/location_background.png", Theme::IconsCodeModelOverlayForegroundColor}, + {":/debugger/images/location.png", Theme::IconsWarningToolBarColor}}, Icon::Tint); +const Icon REVERSE_MODE({ + {":/debugger/images/debugger_reversemode_background.png", Theme::IconsCodeModelOverlayForegroundColor}, + {":/debugger/images/debugger_reversemode.png", Theme::IconsInfoColor}}, Icon::Tint); +const Icon APP_ON_TOP({ + {":/debugger/images/qml/app-on-top.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon APP_ON_TOP_TOOLBAR({ + {":/debugger/images/qml/app-on-top.png", Theme::IconsBaseColor}}); +const Icon SELECT({ + {":/debugger/images/qml/select.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon SELECT_TOOLBAR({ + {":/debugger/images/qml/select.png", Theme::IconsBaseColor}}); +const Icon EMPTY( + ":/debugger/images/debugger_empty_14.png"); +const Icon RECORD_ON({ + {":/debugger/images/recordfill.png", Theme::IconsStopColor}, + {":/debugger/images/recordoutline.png", Theme::IconsBaseColor}}, Icon::Tint | Icon::DropShadow); +const Icon RECORD_OFF({ + {":/debugger/images/recordfill.png", Theme::IconsDisabledColor}, + {":/debugger/images/recordoutline.png", Theme::IconsBaseColor}}, Icon::Tint | Icon::DropShadow); + +const Icon STEP_OVER({ + {":/debugger/images/debugger_stepover_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon STEP_OVER_TOOLBAR({ + {":/debugger/images/debugger_stepover_small.png", Theme::IconsBaseColor}}); +const Icon STEP_INTO({ + {":/debugger/images/debugger_stepinto_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon STEP_INTO_TOOLBAR({ + {":/debugger/images/debugger_stepinto_small.png", Theme::IconsBaseColor}}); +const Icon STEP_OUT({ + {":/debugger/images/debugger_stepout_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon STEP_OUT_TOOLBAR({ + {":/debugger/images/debugger_stepout_small.png", Theme::IconsBaseColor}}); +const Icon RESTART({ + {":/debugger/images/debugger_restart_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle); +const Icon RESTART_TOOLBAR({ + {":/debugger/images/debugger_restart_small.png", Theme::IconsRunToolBarColor}}); +const Icon SINGLE_INSTRUCTION_MODE({ + {":/debugger/images/debugger_singleinstructionmode.png", Theme::IconsBaseColor}}); + +const Icon MODE_DEBUGGER_CLASSIC( + ":/debugger/images/mode_debug.png"); +const Icon MODE_DEBUGGER_FLAT({ + {":/debugger/images/mode_debug_mask.png", Theme::IconsBaseColor}}); +const Icon MODE_DEBUGGER_FLAT_ACTIVE({ + {":/debugger/images/mode_debug_mask.png", Theme::IconsModeDebugActiveColor}}); + +} // namespace Icons +} // namespace Debugger diff --git a/src/plugins/debugger/debuggericons.h b/src/plugins/debugger/debuggericons.h index 220b06fe4ca..7306ce920af 100644 --- a/src/plugins/debugger/debuggericons.h +++ b/src/plugins/debugger/debuggericons.h @@ -25,104 +25,54 @@ #pragma once +#include "debugger_global.h" + #include namespace Debugger { namespace Icons { -const Utils::Icon BREAKPOINT({ - {QLatin1String(":/debugger/images/breakpoint.png"), Utils::Theme::IconsErrorColor}}, Utils::Icon::Tint); -const Utils::Icon BREAKPOINT_DISABLED({ - {QLatin1String(":/debugger/images/breakpoint_disabled.png"), Utils::Theme::IconsErrorColor}}, Utils::Icon::Tint); -const Utils::Icon BREAKPOINT_PENDING({ - {QLatin1String(":/debugger/images/breakpoint.png"), Utils::Theme::IconsErrorColor}, - {QLatin1String(":/debugger/images/breakpoint_pending_overlay.png"), Utils::Theme::PanelTextColorDark}}, Utils::Icon::IconStyleOptions(Utils::Icon::Tint | Utils::Icon::PunchEdges)); -const Utils::Icon BREAKPOINTS( - QLatin1String(":/debugger/images/debugger_breakpoints.png")); -const Utils::Icon WATCHPOINT({ - {QLatin1String(":/core/images/eye_open.png"), Utils::Theme::TextColorNormal}}, Utils::Icon::Tint); -const Utils::Icon TRACEPOINT({ - {QLatin1String(":/core/images/eye_open.png"), Utils::Theme::TextColorNormal}, - {QLatin1String(":/debugger/images/tracepointoverlay.png"), Utils::Theme::TextColorNormal}}, Utils::Icon::Tint | Utils::Icon::PunchEdges); -const Utils::Icon CONTINUE( - QLatin1String(":/debugger/images/debugger_continue.png")); -const Utils::Icon CONTINUE_FLAT({ - {QLatin1String(":/debugger/images/debugger_continue_1_mask.png"), Utils::Theme::IconsInterruptToolBarColor}, - {QLatin1String(":/debugger/images/debugger_continue_2_mask.png"), Utils::Theme::IconsRunToolBarColor}, - {QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor}}); -const Utils::Icon DEBUG_CONTINUE_SMALL({ - {QLatin1String(":/projectexplorer/images/continue_1_small.png"), Utils::Theme::IconsInterruptColor}, - {QLatin1String(":/projectexplorer/images/continue_2_small.png"), Utils::Theme::IconsRunColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon DEBUG_CONTINUE_SMALL_TOOLBAR({ - {QLatin1String(":/projectexplorer/images/continue_1_small.png"), Utils::Theme::IconsInterruptToolBarColor}, - {QLatin1String(":/projectexplorer/images/continue_2_small.png"), Utils::Theme::IconsRunToolBarColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor}}); -const Utils::Icon INTERRUPT( - QLatin1String(":/debugger/images/debugger_interrupt.png")); -const Utils::Icon INTERRUPT_FLAT({ - {QLatin1String(":/debugger/images/debugger_interrupt_mask.png"), Utils::Theme::IconsInterruptToolBarColor}, - {QLatin1String(":/projectexplorer/images/debugger_beetle_mask.png"), Utils::Theme::IconsDebugColor}}); -const Utils::Icon DEBUG_INTERRUPT_SMALL({ - {QLatin1String(":/core/images/interrupt_small.png"), Utils::Theme::IconsInterruptColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon DEBUG_INTERRUPT_SMALL_TOOLBAR({ - {QLatin1String(":/core/images/interrupt_small.png"), Utils::Theme::IconsInterruptToolBarColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor}}); -const Utils::Icon DEBUG_EXIT_SMALL({ - {QLatin1String(":/core/images/stop_small.png"), Utils::Theme::IconsStopColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon DEBUG_EXIT_SMALL_TOOLBAR({ - {QLatin1String(":/core/images/stop_small.png"), Utils::Theme::IconsStopToolBarColor}, - {QLatin1String(":/projectexplorer/images/debugger_overlay_small.png"), Utils::Theme::IconsDebugColor}}); -const Utils::Icon LOCATION({ - {QLatin1String(":/debugger/images/location_background.png"), Utils::Theme::IconsCodeModelOverlayForegroundColor}, - {QLatin1String(":/debugger/images/location.png"), Utils::Theme::IconsWarningToolBarColor}}, Utils::Icon::Tint); -const Utils::Icon REVERSE_MODE({ - {QLatin1String(":/debugger/images/debugger_reversemode_background.png"), Utils::Theme::IconsCodeModelOverlayForegroundColor}, - {QLatin1String(":/debugger/images/debugger_reversemode.png"), Utils::Theme::IconsInfoColor}}, Utils::Icon::Tint); -const Utils::Icon APP_ON_TOP({ - {QLatin1String(":/debugger/images/qml/app-on-top.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon APP_ON_TOP_TOOLBAR({ - {QLatin1String(":/debugger/images/qml/app-on-top.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon SELECT({ - {QLatin1String(":/debugger/images/qml/select.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon SELECT_TOOLBAR({ - {QLatin1String(":/debugger/images/qml/select.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon EMPTY( - QLatin1String(":/debugger/images/debugger_empty_14.png")); -const Utils::Icon RECORD_ON({ - {QLatin1String(":/debugger/images/recordfill.png"), Utils::Theme::IconsStopColor}, - {QLatin1String(":/debugger/images/recordoutline.png"), Utils::Theme::IconsBaseColor}}, Utils::Icon::Tint | Utils::Icon::DropShadow); -const Utils::Icon RECORD_OFF({ - {QLatin1String(":/debugger/images/recordfill.png"), Utils::Theme::IconsDisabledColor}, - {QLatin1String(":/debugger/images/recordoutline.png"), Utils::Theme::IconsBaseColor}}, Utils::Icon::Tint | Utils::Icon::DropShadow); +// Used in QmlProfiler. +DEBUGGER_EXPORT extern const Utils::Icon RECORD_ON; +DEBUGGER_EXPORT extern const Utils::Icon RECORD_OFF; -const Utils::Icon STEP_OVER({ - {QLatin1String(":/debugger/images/debugger_stepover_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon STEP_OVER_TOOLBAR({ - {QLatin1String(":/debugger/images/debugger_stepover_small.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon STEP_INTO({ - {QLatin1String(":/debugger/images/debugger_stepinto_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon STEP_INTO_TOOLBAR({ - {QLatin1String(":/debugger/images/debugger_stepinto_small.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon STEP_OUT({ - {QLatin1String(":/debugger/images/debugger_stepout_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon STEP_OUT_TOOLBAR({ - {QLatin1String(":/debugger/images/debugger_stepout_small.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon RESTART({ - {QLatin1String(":/debugger/images/debugger_restart_small.png"), Utils::Theme::PanelTextColorMid}}, Utils::Icon::MenuTintedStyle); -const Utils::Icon RESTART_TOOLBAR({ - {QLatin1String(":/debugger/images/debugger_restart_small.png"), Utils::Theme::IconsRunToolBarColor}}); -const Utils::Icon SINGLE_INSTRUCTION_MODE({ - {QLatin1String(":/debugger/images/debugger_singleinstructionmode.png"), Utils::Theme::IconsBaseColor}}); +extern const Utils::Icon BREAKPOINT; +extern const Utils::Icon BREAKPOINT_DISABLED; +extern const Utils::Icon BREAKPOINT_PENDING; +extern const Utils::Icon BREAKPOINTS; +extern const Utils::Icon WATCHPOINT; +extern const Utils::Icon TRACEPOINT; +extern const Utils::Icon CONTINUE; +extern const Utils::Icon CONTINUE_FLAT; +extern const Utils::Icon DEBUG_CONTINUE_SMALL; +extern const Utils::Icon DEBUG_CONTINUE_SMALL_TOOLBAR; +extern const Utils::Icon INTERRUPT; +extern const Utils::Icon INTERRUPT_FLAT; +extern const Utils::Icon DEBUG_INTERRUPT_SMALL; +extern const Utils::Icon DEBUG_INTERRUPT_SMALL_TOOLBAR; +extern const Utils::Icon DEBUG_EXIT_SMALL; +extern const Utils::Icon DEBUG_EXIT_SMALL_TOOLBAR; +extern const Utils::Icon LOCATION; +extern const Utils::Icon REVERSE_MODE; +extern const Utils::Icon APP_ON_TOP; +extern const Utils::Icon APP_ON_TOP_TOOLBAR; +extern const Utils::Icon SELECT; +extern const Utils::Icon SELECT_TOOLBAR; +extern const Utils::Icon EMPTY; -const Utils::Icon MODE_DEBUGGER_CLASSIC( - QLatin1String(":/debugger/images/mode_debug.png")); -const Utils::Icon MODE_DEBUGGER_FLAT({ - {QLatin1String(":/debugger/images/mode_debug_mask.png"), Utils::Theme::IconsBaseColor}}); -const Utils::Icon MODE_DEBUGGER_FLAT_ACTIVE({ - {QLatin1String(":/debugger/images/mode_debug_mask.png"), Utils::Theme::IconsModeDebugActiveColor}}); +extern const Utils::Icon STEP_OVER; +extern const Utils::Icon STEP_OVER_TOOLBAR; +extern const Utils::Icon STEP_INTO; +extern const Utils::Icon STEP_INTO_TOOLBAR; +extern const Utils::Icon STEP_OUT; +extern const Utils::Icon STEP_OUT_TOOLBAR; +extern const Utils::Icon RESTART; +extern const Utils::Icon RESTART_TOOLBAR; +extern const Utils::Icon SINGLE_INSTRUCTION_MODE; + +extern const Utils::Icon MODE_DEBUGGER_CLASSIC; +extern const Utils::Icon MODE_DEBUGGER_FLAT; +extern const Utils::Icon MODE_DEBUGGER_FLAT_ACTIVE; } // namespace Icons } // namespace Debugger diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index c8213bed9fd..8ef07a30bf5 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -998,8 +998,6 @@ public: QToolButton *m_reverseToolButton = 0; - QIcon m_locationMarkIcon; - QLabel *m_threadLabel = 0; QComboBox *m_threadBox = 0; @@ -1310,8 +1308,6 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, const Context cppDebuggercontext(C_CPPDEBUGGER); const Context cppeditorcontext(CppEditor::Constants::CPPEDITOR_ID); - m_locationMarkIcon = Icons::LOCATION.icon(); - m_busy = false; m_logWindow = new LogWindow; @@ -3107,11 +3103,6 @@ void updateWatchersWindow(bool showWatch, bool showReturn) dd->m_returnWindow->setVisible(showReturn); } -QIcon locationMarkIcon() -{ - return dd->m_locationMarkIcon; -} - bool hasSnapshots() { return dd->m_snapshotHandler->size(); diff --git a/src/plugins/debugger/snapshothandler.cpp b/src/plugins/debugger/snapshothandler.cpp index 7bf37a5e568..d5b161582b9 100644 --- a/src/plugins/debugger/snapshothandler.cpp +++ b/src/plugins/debugger/snapshothandler.cpp @@ -119,8 +119,6 @@ QDebug operator<<(QDebug d, const SnapshotData &f) */ SnapshotHandler::SnapshotHandler() - : m_positionIcon(Icons::LOCATION.icon()), - m_emptyIcon(Icons::EMPTY.icon()) { m_currentIndex = -1; } @@ -178,8 +176,7 @@ QVariant SnapshotHandler::data(const QModelIndex &index, int role) const case Qt::DecorationRole: // Return icon that indicates whether this is the active stack frame. if (index.column() == 0) - return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon; - break; + return (index.row() == m_currentIndex) ? Icons::LOCATION.icon() : Icons::EMPTY.icon(); default: break; diff --git a/src/plugins/debugger/snapshothandler.h b/src/plugins/debugger/snapshothandler.h index b17a498867d..acecb0531d6 100644 --- a/src/plugins/debugger/snapshothandler.h +++ b/src/plugins/debugger/snapshothandler.h @@ -65,8 +65,6 @@ private: int m_currentIndex; QList< QPointer > m_snapshots; - const QVariant m_positionIcon; - const QVariant m_emptyIcon; }; } // namespace Internal diff --git a/src/plugins/debugger/sourceagent.cpp b/src/plugins/debugger/sourceagent.cpp index f04bf49960c..1d9042d16ec 100644 --- a/src/plugins/debugger/sourceagent.cpp +++ b/src/plugins/debugger/sourceagent.cpp @@ -26,8 +26,8 @@ #include "sourceagent.h" #include "debuggerengine.h" +#include "debuggericons.h" #include "debuggerinternalconstants.h" -#include "debuggercore.h" #include "stackhandler.h" #include @@ -141,7 +141,7 @@ void SourceAgent::updateLocationMarker() d->locationMark = new TextMark(QString(), lineNumber, Constants::TEXT_MARK_CATEGORY_LOCATION); - d->locationMark->setIcon(locationMarkIcon()); + d->locationMark->setIcon(Icons::LOCATION.icon()); d->locationMark->setPriority(TextMark::HighPriority); d->editor->textDocument()->addMark(d->locationMark); diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 8ab60b86753..ffcb003d3be 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -54,9 +54,7 @@ namespace Internal { */ StackHandler::StackHandler(DebuggerEngine *engine) - : m_engine(engine), - m_positionIcon(Icons::LOCATION.icon()), - m_emptyIcon(Icons::EMPTY.icon()) + : m_engine(engine) { setObjectName(QLatin1String("StackModel")); m_resetLocationScheduled = false; @@ -93,7 +91,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole && index.column() == StackFunctionNameColumn) return tr(""); if (role == Qt::DecorationRole && index.column() == StackLevelColumn) - return m_emptyIcon; + return Icons::EMPTY.icon(); return QVariant(); } @@ -120,7 +118,7 @@ QVariant StackHandler::data(const QModelIndex &index, int role) const if (role == Qt::DecorationRole && index.column() == StackLevelColumn) { // Return icon that indicates whether this is the active stack frame return (m_contentsValid && index.row() == m_currentIndex) - ? m_positionIcon : m_emptyIcon; + ? Icons::LOCATION.icon() : Icons::EMPTY.icon(); } if (role == Qt::ToolTipRole && boolSetting(UseToolTipsInStackView)) diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index cbc298bb045..6f88b1c3f28 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -88,8 +88,6 @@ private: DebuggerEngine *m_engine; StackFrames m_stackFrames; int m_currentIndex; - const QVariant m_positionIcon; - const QVariant m_emptyIcon; bool m_canExpand; bool m_resetLocationScheduled; bool m_contentsValid; diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index b5a2d343b86..f387a9ae974 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -48,18 +48,6 @@ namespace Internal { // /////////////////////////////////////////////////////////////////////// -static const QIcon &positionIcon() -{ - static QIcon icon = Icons::LOCATION.icon(); - return icon; -} - -static const QIcon &emptyIcon() -{ - static QIcon icon = Icons::EMPTY.icon(); - return icon; -} - class ThreadItem : public TreeItem { Q_DECLARE_TR_FUNCTIONS(Debugger::Internal::ThreadsHandler) @@ -79,7 +67,8 @@ public: case Qt::DecorationRole: // Return icon that indicates whether this is the active stack frame. if (column == 0) - return threadData.id == handler->currentThread() ? positionIcon() : emptyIcon(); + return threadData.id == handler->currentThread() ? Icons::LOCATION.icon() + : Icons::EMPTY.icon(); break; case ThreadData::IdRole: return threadData.id.raw(); From ba7016ab1e2eccdb32764a28c88971de7e52c474 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 28 Jun 2016 15:57:02 +0200 Subject: [PATCH 15/30] QmlDesigner: Fix UrlChoser We have to set currentIndex to -1 if the url is not in the model. Task-number: QTCREATORBUG-16494 Change-Id: I031a4f99d83b35ea1c0b805194b6aa42338f6509 Reviewed-by: Tim Jenssen --- .../HelperWidgets/UrlChooser.qml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/UrlChooser.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/UrlChooser.qml index 2c2e4087c60..74320b4dbbc 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/UrlChooser.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/UrlChooser.qml @@ -54,9 +54,20 @@ RowLayout { property bool isComplete: false - property string textValue: backendValue.value + function setCurrentText(text) { + if (text === "") + return + + + var index = comboBox.find(textValue) + if (index === -1) + currentIndex = -1 + editText = textValue + } + + property string textValue: backendValue.valueToString onTextValueChanged: { - comboBox.editText = textValue + setCurrentText(textValue) } Layout.fillWidth: true @@ -72,7 +83,7 @@ RowLayout { if (!comboBox.isComplete) return; - editText = backendValue.valueToString + setCurrentText(textValue) } onCurrentTextChanged: { @@ -95,7 +106,7 @@ RowLayout { } } comboBox.isComplete = true - editText = backendValue.valueToString + setCurrentText(textValue) } } From e0b05758c0fab85664439cde4c80f04b35a46dcf Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 8 Jun 2016 18:25:32 +0200 Subject: [PATCH 16/30] Squish: Fix getHelpViewer() for Qt 5.6 Change-Id: Ica23ec912f95fe10e838e2055d8294be33ef959b Reviewed-by: Christian Stenger --- tests/system/shared/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index bdd64fcdcd8..7f9a9cbc598 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -650,6 +650,11 @@ def getChildByClass(parent, classToSearchFor, occurrence=1): def getHelpViewer(): try: return waitForObject(":Qt Creator_Help::Internal::HelpViewer", 3000) + except: + pass + try: + return waitForObject("{type='QWebEngineView' unnamed='1' " + "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 1000) except: return waitForObject("{type='Help::Internal::TextBrowserHelpWidget' unnamed='1' " "visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 1000) From b1a1e169a62f5ad0210e3aa05f7c43ce3f9ac793 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 28 Jun 2016 17:25:52 +0200 Subject: [PATCH 17/30] Tests: Remove invalid qml file File seems to be useless and is not used at all. Change-Id: I7b6d7f8804cdf07c6027abb9822d99bdf5ad9dbf Reviewed-by: Tim Jenssen --- .../qml/qmldesigner/data/qwidget/test.qml | 52 ------------------- tests/auto/qml/qmldesigner/data/testfiles.qrc | 1 - 2 files changed, 53 deletions(-) delete mode 100644 tests/auto/qml/qmldesigner/data/qwidget/test.qml diff --git a/tests/auto/qml/qmldesigner/data/qwidget/test.qml b/tests/auto/qml/qmldesigner/data/qwidget/test.qml deleted file mode 100644 index 17e0331e4bd..00000000000 --- a/tests/auto/qml/qmldesigner/data/qwidget/test.qml +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** 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. -** -****************************************************************************/ - - - - - PushButton - - - ... - - - PushButton - - - PushButton - - - PushButton - - - PushButton - - - PushButton - - - PushButton - - diff --git a/tests/auto/qml/qmldesigner/data/testfiles.qrc b/tests/auto/qml/qmldesigner/data/testfiles.qrc index 15662d0986c..b96ba33de42 100644 --- a/tests/auto/qml/qmldesigner/data/testfiles.qrc +++ b/tests/auto/qml/qmldesigner/data/testfiles.qrc @@ -4,7 +4,6 @@ fx/empty.qml fx/helloworld.qml fx/properties.qml - qwidget/test.qml fx/topitem.qml fx/subitems/SubItem.qml fx/states.qml From 943c76f4ab46c208159dfe079f638492729ae449 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 Jun 2016 22:38:54 +0300 Subject: [PATCH 18/30] AutoTest: De-slot and complete Qt5-style connects Change-Id: I013b42523f163e123a0cee85f9d232815ad284e3 Reviewed-by: Christian Stenger --- src/plugins/autotest/testcodeparser.cpp | 2 +- src/plugins/autotest/testcodeparser.h | 2 +- src/plugins/autotest/testnavigationwidget.h | 6 +----- src/plugins/autotest/testresultdelegate.h | 2 -- src/plugins/autotest/testresultspane.h | 9 +++------ src/plugins/autotest/testrunner.h | 8 +++----- src/plugins/autotest/testtreemodel.h | 2 -- 7 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/plugins/autotest/testcodeparser.cpp b/src/plugins/autotest/testcodeparser.cpp index 857c16b25f3..7e6e0b3c3c4 100644 --- a/src/plugins/autotest/testcodeparser.cpp +++ b/src/plugins/autotest/testcodeparser.cpp @@ -143,7 +143,7 @@ void TestCodeParser::emitUpdateTestTree() qCDebug(LOG) << "adding singleShot"; m_singleShotScheduled = true; - QTimer::singleShot(1000, this, SLOT(updateTestTree())); + QTimer::singleShot(1000, this, &TestCodeParser::updateTestTree); } void TestCodeParser::updateTestTree() diff --git a/src/plugins/autotest/testcodeparser.h b/src/plugins/autotest/testcodeparser.h index 9bb1480b0a7..19b58dfa468 100644 --- a/src/plugins/autotest/testcodeparser.h +++ b/src/plugins/autotest/testcodeparser.h @@ -70,7 +70,7 @@ signals: void parsingFinished(); void parsingFailed(); -public slots: +public: void emitUpdateTestTree(); void updateTestTree(); void onCppDocumentUpdated(const CPlusPlus::Document::Ptr &document); diff --git a/src/plugins/autotest/testnavigationwidget.h b/src/plugins/autotest/testnavigationwidget.h index d64bf661e95..b52eeb941a1 100644 --- a/src/plugins/autotest/testnavigationwidget.h +++ b/src/plugins/autotest/testnavigationwidget.h @@ -65,16 +65,12 @@ public: signals: -public slots: - -private slots: +private: void onItemActivated(const QModelIndex &index); void onSortClicked(); void onFilterMenuTriggered(QAction *action); void onParsingStarted(); void onParsingFinished(); - -private: void initializeFilterMenu(); void onRunThisTestTriggered(TestRunner::Mode runMode); diff --git a/src/plugins/autotest/testresultdelegate.h b/src/plugins/autotest/testresultdelegate.h index c01c156f10a..5d1c713ff01 100644 --- a/src/plugins/autotest/testresultdelegate.h +++ b/src/plugins/autotest/testresultdelegate.h @@ -41,8 +41,6 @@ public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; - -public slots: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); private: diff --git a/src/plugins/autotest/testresultspane.h b/src/plugins/autotest/testresultspane.h index 4955783f894..a226e8df44d 100644 --- a/src/plugins/autotest/testresultspane.h +++ b/src/plugins/autotest/testresultspane.h @@ -87,20 +87,17 @@ public: void goToNext(); void goToPrev(); -signals: - -public slots: void addTestResult(const TestResultPtr &result); -private slots: +private: + explicit TestResultsPane(QObject *parent = 0); + void onItemActivated(const QModelIndex &index); void onRunAllTriggered(); void onRunSelectedTriggered(); void enableAllFilter(); void filterMenuTriggered(QAction *action); -private: - explicit TestResultsPane(QObject *parent = 0); void initializeFilterMenu(); void updateSummaryLabel(); void createToolButtons(); diff --git a/src/plugins/autotest/testrunner.h b/src/plugins/autotest/testrunner.h index b79840b2653..2e3621b29d0 100644 --- a/src/plugins/autotest/testrunner.h +++ b/src/plugins/autotest/testrunner.h @@ -56,21 +56,19 @@ public: void setSelectedTests(const QList &selected); bool isTestRunning() const { return m_executingTests; } + void prepareToRunTests(Mode mode); + signals: void testRunStarted(); void testRunFinished(); void requestStopTestRun(); void testResultReady(const TestResultPtr &result); -public slots: - void prepareToRunTests(Mode mode); - -private slots: +private: void buildProject(ProjectExplorer::Project *project); void buildFinished(bool success); void onFinished(); -private: void runTests(); void debugTests(); void runOrDebugTests(); diff --git a/src/plugins/autotest/testtreemodel.h b/src/plugins/autotest/testtreemodel.h index d2c3467ce32..71291019375 100644 --- a/src/plugins/autotest/testtreemodel.h +++ b/src/plugins/autotest/testtreemodel.h @@ -83,8 +83,6 @@ signals: void sweepingDone(); #endif -public slots: - private: void onParseResultReady(const TestParseResultPtr result); void handleParseResult(const TestParseResult *result, TestTreeItem *rootNode); From b6bc52065c0470d57f6238d9a42259989d949e54 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 29 Jun 2016 08:25:13 +0300 Subject: [PATCH 19/30] QmlJSEditor: Minor cleanup Remove unneeded variable, and connect directly to member functions. Change-Id: I2c5077676fc8d3f975d03a71b3e566b692e6b7c6 Reviewed-by: Christian Stenger --- src/plugins/qmljseditor/qmljsoutlinetreeview.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp b/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp index 996c17dca97..d89b84a3b58 100644 --- a/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp +++ b/src/plugins/qmljseditor/qmljsoutlinetreeview.cpp @@ -57,10 +57,10 @@ void QmlJSOutlineTreeView::contextMenuEvent(QContextMenuEvent *event) QMenu contextMenu; - QAction *action = contextMenu.addAction(tr("Expand All")); - connect(action, &QAction::triggered, this, [this] () { expandAll(); }); - action = contextMenu.addAction(tr("Collapse All")); - connect(action, &QAction::triggered, this, [this] () { collapseAllExceptRoot(); }); + connect(contextMenu.addAction(tr("Expand All")), &QAction::triggered, + this, &QmlJSOutlineTreeView::expandAll); + connect(contextMenu.addAction(tr("Collapse All")), &QAction::triggered, + this, &QmlJSOutlineTreeView::collapseAllExceptRoot); contextMenu.exec(event->globalPos()); From b14d9c00ff14fc21037cbb7801d150e6897a42e0 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 Jun 2016 23:06:39 +0300 Subject: [PATCH 20/30] GenericPM: Use Qt5-style connects Change-Id: Ia94373846f0125a42686d6ed69b3111762b00c04 Reviewed-by: Tobias Hunger --- .../genericprojectmanager/genericmakestep.cpp | 12 ++++++------ src/plugins/genericprojectmanager/genericmakestep.h | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index 0e581fa1552..c12ba79dd72 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -239,13 +239,13 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt connect(m_ui->makeArgumentsLineEdit, &QLineEdit::textEdited, this, &GenericMakeStepConfigWidget::makeArgumentsLineEditTextEdited); - connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()), - this, SLOT(updateMakeOverrrideLabel())); - connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()), - this, SLOT(updateDetails())); + connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, + this, &GenericMakeStepConfigWidget::updateMakeOverrrideLabel); + connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged, + this, &GenericMakeStepConfigWidget::updateDetails); - connect(m_makeStep->target(), SIGNAL(kitChanged()), - this, SLOT(updateMakeOverrrideLabel())); + connect(m_makeStep->target(), &Target::kitChanged, + this, &GenericMakeStepConfigWidget::updateMakeOverrrideLabel); connect(pro, &GenericProject::environmentChanged, this, &GenericMakeStepConfigWidget::updateMakeOverrrideLabel); diff --git a/src/plugins/genericprojectmanager/genericmakestep.h b/src/plugins/genericprojectmanager/genericmakestep.h index 031366dfa2f..e36315c87bf 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.h +++ b/src/plugins/genericprojectmanager/genericmakestep.h @@ -87,14 +87,13 @@ public: QString displayName() const override; QString summaryText() const override; -private slots: +private: void itemChanged(QListWidgetItem *item); void makeLineEditTextEdited(); void makeArgumentsLineEditTextEdited(); void updateMakeOverrrideLabel(); void updateDetails(); -private: Ui::GenericMakeStep *m_ui; GenericMakeStep *m_makeStep; QString m_summaryText; From eacd012b96d86074b5f351f7c1a59ffb7a1e7a16 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 Jun 2016 22:31:02 +0300 Subject: [PATCH 21/30] Utils: De-slot and complete Qt5 connects The only Qt4-style [dis]connects left are in BaseTreeView::setModel. Change-Id: I53bb715750c65827005cc96939a6714606e60f81 Reviewed-by: Tobias Hunger --- src/libs/utils/consoleprocess.h | 3 +-- src/libs/utils/crumblepath.h | 4 +--- src/libs/utils/detailswidget.h | 2 +- src/libs/utils/dropsupport.cpp | 4 ++-- src/libs/utils/dropsupport.h | 3 +-- src/libs/utils/fadingindicator.cpp | 5 ++--- src/libs/utils/fancymainwindow.h | 3 +-- src/libs/utils/filesystemwatcher.h | 6 ++---- src/libs/utils/filewizardpage.h | 3 +-- src/libs/utils/newclasswidget.h | 4 +--- src/libs/utils/projectintropage.h | 3 +-- src/libs/utils/proxyaction.h | 4 +--- src/libs/utils/settingsselector.h | 3 +-- src/libs/utils/statuslabel.h | 4 +--- src/libs/utils/synchronousprocess.h | 4 +--- src/libs/utils/textfieldcheckbox.h | 3 +-- src/libs/utils/textfieldcombobox.h | 3 +-- src/libs/utils/wizard.cpp | 4 +--- 18 files changed, 21 insertions(+), 44 deletions(-) diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 59a51d98cf1..4e9de860fd1 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -103,7 +103,7 @@ signals: void stubStarted(); void stubStopped(); -private slots: +private: void stubConnectionAvailable(); void readStubOutput(); void stubExited(); @@ -111,7 +111,6 @@ private slots: void inferiorExited(); #endif -private: static QString modeOption(Mode m); static QString msgCommChannelFailed(const QString &error); static QString msgPromptToClose(); diff --git a/src/libs/utils/crumblepath.h b/src/libs/utils/crumblepath.h index d3d1962535b..434252ae37b 100644 --- a/src/libs/utils/crumblepath.h +++ b/src/libs/utils/crumblepath.h @@ -60,10 +60,8 @@ signals: protected: void resizeEvent(QResizeEvent *); -private slots: - void emitElementClicked(); - private: + void emitElementClicked(); void resizeButtons(); void setBackgroundStyle(); diff --git a/src/libs/utils/detailswidget.h b/src/libs/utils/detailswidget.h index 5ce8c04f5d2..0c69d6f3f08 100644 --- a/src/libs/utils/detailswidget.h +++ b/src/libs/utils/detailswidget.h @@ -87,7 +87,7 @@ signals: void linkActivated(const QString &link); void expanded(bool); -private slots: +private: void setExpanded(bool); protected: diff --git a/src/libs/utils/dropsupport.cpp b/src/libs/utils/dropsupport.cpp index 805a20c0546..9527a2f1e40 100644 --- a/src/libs/utils/dropsupport.cpp +++ b/src/libs/utils/dropsupport.cpp @@ -140,7 +140,7 @@ bool DropSupport::eventFilter(QObject *obj, QEvent *event) // after the drag operation. // If we do not do this, e.g. dragging from Outline view crashes if the editor and // the selected item changes - QTimer::singleShot(100, this, SLOT(emitFilesDropped())); + QTimer::singleShot(100, this, &DropSupport::emitFilesDropped); } } if (fileDropMimeData && !fileDropMimeData->values().isEmpty()) { @@ -150,7 +150,7 @@ bool DropSupport::eventFilter(QObject *obj, QEvent *event) m_values.append(fileDropMimeData->values()); m_dropPos = de->pos(); if (needToScheduleEmit) - QTimer::singleShot(100, this, SLOT(emitValuesDropped())); + QTimer::singleShot(100, this, &DropSupport::emitValuesDropped); } } if (!accepted) { diff --git a/src/libs/utils/dropsupport.h b/src/libs/utils/dropsupport.h index c91f2c5c8ae..979089f0908 100644 --- a/src/libs/utils/dropsupport.h +++ b/src/libs/utils/dropsupport.h @@ -68,11 +68,10 @@ public: protected: bool eventFilter(QObject *obj, QEvent *event); -private slots: +private: void emitFilesDropped(); void emitValuesDropped(); -private: DropFilterFunction m_filterFunction; QList m_files; QList m_values; diff --git a/src/libs/utils/fadingindicator.cpp b/src/libs/utils/fadingindicator.cpp index 0910aa3c850..6799465829d 100644 --- a/src/libs/utils/fadingindicator.cpp +++ b/src/libs/utils/fadingindicator.cpp @@ -87,7 +87,7 @@ public: { show(); raise(); - QTimer::singleShot(ms, this, SLOT(runInternal())); + QTimer::singleShot(ms, this, &FadingIndicatorPrivate::runInternal); } protected: @@ -104,7 +104,7 @@ protected: } } -private slots: +private: void runInternal() { QPropertyAnimation *anim = new QPropertyAnimation(m_effect, "opacity", this); @@ -114,7 +114,6 @@ private slots: anim->start(QAbstractAnimation::DeleteWhenStopped); } -private: QGraphicsOpacityEffect *m_effect; QLabel *m_label; QPixmap m_pixmap; diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h index 1960bea3842..f66287e6cf1 100644 --- a/src/libs/utils/fancymainwindow.h +++ b/src/libs/utils/fancymainwindow.h @@ -79,10 +79,9 @@ protected: void showEvent(QShowEvent *event); void contextMenuEvent(QContextMenuEvent *event); -private slots: +private: void onDockActionTriggered(); -private: void handleVisibilityChanged(bool visible); FancyMainWindowPrivate *d; diff --git a/src/libs/utils/filesystemwatcher.h b/src/libs/utils/filesystemwatcher.h index 59f5938204b..c40c6dae800 100644 --- a/src/libs/utils/filesystemwatcher.h +++ b/src/libs/utils/filesystemwatcher.h @@ -66,16 +66,14 @@ public: bool watchesDirectory(const QString &file) const; QStringList directories() const; -private slots: - void slotFileChanged(const QString &path); - void slotDirectoryChanged(const QString &path); - signals: void fileChanged(const QString &path); void directoryChanged(const QString &path); private: void init(); + void slotFileChanged(const QString &path); + void slotDirectoryChanged(const QString &path); FileSystemWatcherPrivate *d; }; diff --git a/src/libs/utils/filewizardpage.h b/src/libs/utils/filewizardpage.h index e0f19d03db4..12897e782da 100644 --- a/src/libs/utils/filewizardpage.h +++ b/src/libs/utils/filewizardpage.h @@ -65,11 +65,10 @@ public slots: void setPath(const QString &path); void setFileName(const QString &name); -private slots: +private: void slotValidChanged(); void slotActivated(); -private: FileWizardPagePrivate *d; }; diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h index 18a5029f5bc..e91ff6a13af 100644 --- a/src/libs/utils/newclasswidget.h +++ b/src/libs/utils/newclasswidget.h @@ -149,15 +149,13 @@ public slots: */ void suggestClassNameFromBase(); -private slots: +private: void slotUpdateFileNames(const QString &t); void slotValidChanged(); void slotActivated(); void classNameEdited(); void slotFormInputChecked(); void slotBaseClassEdited(const QString &); - -private: void setFormInputCheckable(bool checkable, bool force); QString fixSuffix(const QString &suffix); diff --git a/src/libs/utils/projectintropage.h b/src/libs/utils/projectintropage.h index eb26a839c20..da34f550e30 100644 --- a/src/libs/utils/projectintropage.h +++ b/src/libs/utils/projectintropage.h @@ -73,11 +73,10 @@ public slots: void setUseAsDefaultPath(bool u); void setProjectNameRegularExpression(const QRegularExpression ®Ex); -private slots: +private: void slotChanged(); void slotActivated(); -private: enum StatusLabelMode { Error, Warning, Hint }; bool validate(); diff --git a/src/libs/utils/proxyaction.h b/src/libs/utils/proxyaction.h index 3307a0c0ae8..a5c423098ef 100644 --- a/src/libs/utils/proxyaction.h +++ b/src/libs/utils/proxyaction.h @@ -60,12 +60,10 @@ public: static QString stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut); static ProxyAction *proxyActionWithIcon(QAction *original, const QIcon &newIcon); -private slots: +private: void actionChanged(); void updateState(); void updateToolTipWithKeySequence(); - -private: void disconnectAction(); void connectAction(); void update(QAction *action, bool initialize); diff --git a/src/libs/utils/settingsselector.h b/src/libs/utils/settingsselector.h index 6df875a6e4a..7c5220afadc 100644 --- a/src/libs/utils/settingsselector.h +++ b/src/libs/utils/settingsselector.h @@ -67,12 +67,11 @@ signals: void rename(int index, const QString &newName); void currentChanged(int index); -private slots: +private: void removeButtonClicked(); void renameButtonClicked(); void updateButtonState(); -private: QLabel *m_label; QComboBox *m_configurationCombo; QPushButton *m_addButton; diff --git a/src/libs/utils/statuslabel.h b/src/libs/utils/statuslabel.h index 8531a66d1b7..8a2ffc22328 100644 --- a/src/libs/utils/statuslabel.h +++ b/src/libs/utils/statuslabel.h @@ -43,10 +43,8 @@ public slots: void showStatusMessage(const QString &message, int timeoutMS = 5000); void clearStatusMessage(); -private slots: - void slotTimeout(); - private: + void slotTimeout(); void stopTimer(); QTimer *m_timer; diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h index 40c6aea5bf8..5c4f8bc7608 100644 --- a/src/libs/utils/synchronousprocess.h +++ b/src/libs/utils/synchronousprocess.h @@ -155,14 +155,12 @@ signals: public slots: bool terminate(); -private slots: +private: void slotTimeout(); void finished(int exitCode, QProcess::ExitStatus e); void error(QProcess::ProcessError); void stdOutReady(); void stdErrReady(); - -private: void processStdOut(bool emitSignals); void processStdErr(bool emitSignals); QString convertOutput(const QByteArray &, QTextCodec::ConverterState *state) const; diff --git a/src/libs/utils/textfieldcheckbox.h b/src/libs/utils/textfieldcheckbox.h index 456e156370d..9bcc17c9ad6 100644 --- a/src/libs/utils/textfieldcheckbox.h +++ b/src/libs/utils/textfieldcheckbox.h @@ -51,10 +51,9 @@ public: signals: void textChanged(const QString &); -private slots: +private: void slotStateChanged(int); -private: QString m_trueText; QString m_falseText; }; diff --git a/src/libs/utils/textfieldcombobox.h b/src/libs/utils/textfieldcombobox.h index 943e7a677c2..136b85de3c7 100644 --- a/src/libs/utils/textfieldcombobox.h +++ b/src/libs/utils/textfieldcombobox.h @@ -46,10 +46,9 @@ public: signals: void text4Changed(const QString &); // Do not conflict with Qt 3 compat signal. -private slots: +private: void slotCurrentIndexChanged(int); -private: inline QString valueAt(int) const; }; diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index 81fc5a18478..8e747ab0b1d 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -99,7 +99,7 @@ class LinearProgressWidget : public QWidget public: LinearProgressWidget(WizardProgress *progress, QWidget *parent = 0); -private slots: +private: void slotItemAdded(WizardProgressItem *item); void slotItemRemoved(WizardProgressItem *item); void slotItemChanged(WizardProgressItem *item); @@ -107,8 +107,6 @@ private slots: void slotNextShownItemChanged(WizardProgressItem *item, WizardProgressItem *nextItem); void slotStartItemChanged(WizardProgressItem *item); void slotCurrentItemChanged(WizardProgressItem *item); - -private: void recreateLayout(); void updateProgress(); void disableUpdates(); From 76781b40a767663e58e1ba38a4a4a14469528a33 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 29 Jun 2016 13:43:01 +0200 Subject: [PATCH 22/30] Squish: Adapt suite_qtquick to 4.1 changes Change-Id: Ic1d178820a3c2b6ce61f9e4fc424bc701eca87e5 Reviewed-by: Robert Loehning --- tests/system/shared/project.py | 2 +- .../tst_qml_outline/testdata/focus.qml_mod3_outline.tsv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/shared/project.py b/tests/system/shared/project.py index a8d16c9e3ad..d5cf7030aac 100644 --- a/tests/system/shared/project.py +++ b/tests/system/shared/project.py @@ -125,7 +125,7 @@ def __createProjectSetNameAndPath__(path, projectName = None, checks = True, lib return str(projectName) def __createProjectHandleQtQuickSelection__(minimumQtVersion): - comboBox = waitForObject("{buddy=':Minimal required Qt version:_QLabel' name='QtVersion' " + comboBox = waitForObject("{leftWidget=':Minimal required Qt version:_QLabel' name='QtVersion' " "type='Utils::TextFieldComboBox' visible='1'}") try: selectFromCombo(comboBox, "Qt %s" % minimumQtVersion) diff --git a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv index 6aac83e07ba..086c391d2ea 100644 --- a/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv +++ b/tests/system/suite_qtquick/tst_qml_outline/testdata/focus.qml_mod3_outline.tsv @@ -3,7 +3,7 @@ "id" "1" "window" "txtCnt" "1" """Property""" "clicked" "1" "" -"clicked" "1" "" +"clicked()" "1" "" "width" "1" "800" "height" "1" "480" "color" "1" """white""" From a22d8bcaa35d44ed3a92238ed80672f94439dc31 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 28 Jun 2016 23:29:21 +0300 Subject: [PATCH 23/30] QbsPM: Use Qt5-style connects The heavy lifting was done by clazy. Change-Id: I841454b0815bc697ae2372dbc6d2caa59d7dc3e8 Reviewed-by: Christian Kandeler --- .../customqbspropertiesdialog.cpp | 10 ++-- .../customqbspropertiesdialog.h | 2 +- .../qbsprojectmanager/qbsbuildconfiguration.h | 3 +- .../qbsbuildconfigurationwidget.h | 2 +- .../qbsprojectmanager/qbsbuildstep.cpp | 56 +++++++++++-------- src/plugins/qbsprojectmanager/qbsbuildstep.h | 6 +- .../qbsprojectmanager/qbscleanstep.cpp | 22 +++++--- src/plugins/qbsprojectmanager/qbscleanstep.h | 6 +- .../qbsprojectmanager/qbsinstallstep.cpp | 32 ++++++----- .../qbsprojectmanager/qbsinstallstep.h | 5 +- src/plugins/qbsprojectmanager/qbslogsink.cpp | 18 +++--- src/plugins/qbsprojectmanager/qbslogsink.h | 5 +- src/plugins/qbsprojectmanager/qbsparser.h | 4 +- .../qbsprofilessettingspage.cpp | 17 +++--- src/plugins/qbsprojectmanager/qbsproject.cpp | 24 ++++---- src/plugins/qbsprojectmanager/qbsproject.h | 5 +- .../qbsprojectmanagerplugin.cpp | 47 +++++++++------- .../qbsprojectmanagerplugin.h | 3 +- .../qbsprojectmanager/qbsprojectparser.cpp | 12 ++-- .../qbsprojectmanager/qbsprojectparser.h | 3 +- .../qbsprojectmanager/qbsrunconfiguration.h | 4 +- 21 files changed, 152 insertions(+), 134 deletions(-) diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp index ea5c3a2404f..649ca978567 100644 --- a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.cpp @@ -51,10 +51,12 @@ CustomQbsPropertiesDialog::CustomQbsPropertiesDialog(const QVariantMap &properti m_ui->propertiesTable->setItem(currentRow, 1, valueItem); ++currentRow; } - connect(m_ui->addButton, SIGNAL(clicked()), SLOT(addProperty())); - connect(m_ui->removeButton, SIGNAL(clicked()), SLOT(removeSelectedProperty())); - connect(m_ui->propertiesTable, SIGNAL(currentItemChanged(QTableWidgetItem*,QTableWidgetItem*)), - SLOT(handleCurrentItemChanged())); + connect(m_ui->addButton, &QAbstractButton::clicked, + this, &CustomQbsPropertiesDialog::addProperty); + connect(m_ui->removeButton, &QAbstractButton::clicked, + this, &CustomQbsPropertiesDialog::removeSelectedProperty); + connect(m_ui->propertiesTable, &QTableWidget::currentItemChanged, + this, &CustomQbsPropertiesDialog::handleCurrentItemChanged); handleCurrentItemChanged(); } diff --git a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h index 0668f77720e..cbbc757945d 100644 --- a/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h +++ b/src/plugins/qbsprojectmanager/customqbspropertiesdialog.h @@ -42,7 +42,7 @@ public: QVariantMap properties() const; ~CustomQbsPropertiesDialog(); -private slots: +private: void addProperty(); void removeSelectedProperty(); void handleCurrentItemChanged(); diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h index 1dd37792bcc..c399e14fffa 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfiguration.h @@ -86,10 +86,9 @@ protected: QbsBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); bool fromMap(const QVariantMap &map) override; -private slots: +private: void buildStepInserted(int pos); -private: static QbsBuildConfiguration *setup(ProjectExplorer::Target *t, const QString &defaultDisplayName, const QString &displayName, diff --git a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h index b8309ede833..bdb6f6352b8 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h +++ b/src/plugins/qbsprojectmanager/qbsbuildconfigurationwidget.h @@ -43,7 +43,7 @@ class QbsBuildConfigurationWidget : public ProjectExplorer::NamedWidget public: QbsBuildConfigurationWidget(Internal::QbsBuildConfiguration *bc); -private slots: +private: void buildDirEdited(); // Changes triggered from creator diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index ae589981ead..20221d42a92 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -112,8 +112,10 @@ bool QbsBuildStep::init(QList &earlierSteps) m_activeFileTags = bc->activeFileTags(); m_products = bc->products(); - connect(m_parser, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)), - this, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat))); + connect(m_parser, &ProjectExplorer::IOutputParser::addOutput, + this, [this](const QString &string, ProjectExplorer::BuildStep::OutputFormat format) { + emit addOutput(string, format); + }); connect(m_parser, &ProjectExplorer::IOutputParser::addTask, this, &QbsBuildStep::addTask); return true; @@ -259,7 +261,7 @@ void QbsBuildStep::buildingDone(bool success) void QbsBuildStep::reparsingDone(bool success) { - disconnect(qbsProject(), SIGNAL(projectParsingDone(bool)), this, SLOT(reparsingDone(bool))); + disconnect(qbsProject(), &QbsProject::projectParsingDone, this, &QbsBuildStep::reparsingDone); m_parsingProject = false; if (m_job) { // This was a scheduled reparsing after building. finish(); @@ -398,7 +400,7 @@ void QbsBuildStep::setCleanInstallRoot(bool clean) void QbsBuildStep::parseProject() { m_parsingProject = true; - connect(qbsProject(), SIGNAL(projectParsingDone(bool)), SLOT(reparsingDone(bool))); + connect(qbsProject(), &QbsProject::projectParsingDone, this, &QbsBuildStep::reparsingDone); qbsProject()->parseCurrentBuildConfiguration(); } @@ -419,15 +421,15 @@ void QbsBuildStep::build() m_progressBase = 0; - connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(buildingDone(bool))); - connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), - this, SLOT(handleTaskStarted(QString,int))); - connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)), - this, SLOT(handleProgress(int))); - connect(m_job, SIGNAL(reportCommandDescription(QString,QString)), - this, SLOT(handleCommandDescriptionReport(QString,QString))); - connect(m_job, SIGNAL(reportProcessResult(qbs::ProcessResult)), - this, SLOT(handleProcessResultReport(qbs::ProcessResult))); + connect(m_job, &qbs::AbstractJob::finished, this, &QbsBuildStep::buildingDone); + connect(m_job, &qbs::AbstractJob::taskStarted, + this, &QbsBuildStep::handleTaskStarted); + connect(m_job, &qbs::AbstractJob::taskProgress, + this, &QbsBuildStep::handleProgress); + connect(m_job, &qbs::BuildJob::reportCommandDescription, + this, &QbsBuildStep::handleCommandDescriptionReport); + connect(m_job, &qbs::BuildJob::reportProcessResult, + this, &QbsBuildStep::handleProcessResultReport); } @@ -455,9 +457,12 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : m_step(step), m_ignoreChange(false) { - connect(m_step, SIGNAL(displayNameChanged()), this, SLOT(updateState())); - connect(m_step, SIGNAL(qbsConfigurationChanged()), this, SLOT(updateState())); - connect(m_step, SIGNAL(qbsBuildOptionsChanged()), this, SLOT(updateState())); + connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged, + this, &QbsBuildStepConfigWidget::updateState); + connect(m_step, &QbsBuildStep::qbsConfigurationChanged, + this, &QbsBuildStepConfigWidget::updateState); + connect(m_step, &QbsBuildStep::qbsBuildOptionsChanged, + this, &QbsBuildStepConfigWidget::updateState); connect(&QbsProjectManagerSettings::instance(), &QbsProjectManagerSettings::settingsBaseChanged, this, &QbsBuildStepConfigWidget::updateState); connect(step->buildConfiguration()->target(), &ProjectExplorer::Target::buildDirectoryChanged, @@ -474,10 +479,13 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : }); m_ui->qmlDebuggingWarningText->setPixmap(Core::Icons::WARNING.pixmap()); - connect(m_ui->buildVariantComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(changeBuildVariant(int))); - connect(m_ui->keepGoingCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeKeepGoing(bool))); - connect(m_ui->jobSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeJobCount(int))); + connect(m_ui->buildVariantComboBox, + static_cast(&QComboBox::currentIndexChanged), + this, &QbsBuildStepConfigWidget::changeBuildVariant); + connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled, + this, &QbsBuildStepConfigWidget::changeKeepGoing); + connect(m_ui->jobSpinBox, static_cast(&QSpinBox::valueChanged), + this, &QbsBuildStepConfigWidget::changeJobCount); connect(m_ui->showCommandLinesCheckBox, &QCheckBox::toggled, this, &QbsBuildStepConfigWidget::changeShowCommandLines); connect(m_ui->installCheckBox, &QCheckBox::toggled, this, @@ -486,10 +494,10 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) : &QbsBuildStepConfigWidget::changeCleanInstallRoot); connect(m_ui->forceProbesCheckBox, &QCheckBox::toggled, this, &QbsBuildStepConfigWidget::changeForceProbes); - connect(m_ui->qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)), - this, SLOT(linkQmlDebuggingLibraryChecked(bool))); - connect(QtSupport::QtVersionManager::instance(), SIGNAL(dumpUpdatedFor(Utils::FileName)), - this, SLOT(updateQmlDebuggingOption())); + connect(m_ui->qmlDebuggingLibraryCheckBox, &QAbstractButton::toggled, + this, &QbsBuildStepConfigWidget::linkQmlDebuggingLibraryChecked); + connect(QtSupport::QtVersionManager::instance(), &QtSupport::QtVersionManager::dumpUpdatedFor, + this, &QbsBuildStepConfigWidget::updateQmlDebuggingOption); updateState(); } diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index e45e7b9ac57..5264b2fa35b 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -80,7 +80,7 @@ signals: void qbsConfigurationChanged(); void qbsBuildOptionsChanged(); -private slots: +private: void buildingDone(bool success); void reparsingDone(bool success); void handleTaskStarted(const QString &desciption, int max); @@ -88,7 +88,6 @@ private slots: void handleCommandDescriptionReport(const QString &highlight, const QString &message); void handleProcessResultReport(const qbs::ProcessResult &result); -private: void createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line); @@ -137,7 +136,7 @@ public: QString summaryText() const; QString displayName() const; -private slots: +private: void updateState(); void updateQmlDebuggingOption(); void updatePropertyEdit(const QVariantMap &data); @@ -154,7 +153,6 @@ private slots: // QML debugging: void linkQmlDebuggingLibraryChecked(bool checked); -private: bool validateProperties(Utils::FancyLineEdit *edit, QString *errorMessage); Ui::QbsBuildStepConfigWidget *m_ui; diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.cpp b/src/plugins/qbsprojectmanager/qbscleanstep.cpp index 363f1ceeb27..faaf2a04e4d 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.cpp +++ b/src/plugins/qbsprojectmanager/qbscleanstep.cpp @@ -106,11 +106,11 @@ void QbsCleanStep::run(QFutureInterface &fi) m_progressBase = 0; - connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(cleaningDone(bool))); - connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), - this, SLOT(handleTaskStarted(QString,int))); - connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)), - this, SLOT(handleProgress(int))); + connect(m_job, &qbs::AbstractJob::finished, this, &QbsCleanStep::cleaningDone); + connect(m_job, &qbs::AbstractJob::taskStarted, + this, &QbsCleanStep::handleTaskStarted); + connect(m_job, &qbs::AbstractJob::taskProgress, + this, &QbsCleanStep::handleProgress); } ProjectExplorer::BuildStepConfigWidget *QbsCleanStep::createConfigWidget() @@ -233,16 +233,20 @@ void QbsCleanStep::setMaxJobs(int jobcount) QbsCleanStepConfigWidget::QbsCleanStepConfigWidget(QbsCleanStep *step) : m_step(step) { - connect(m_step, SIGNAL(displayNameChanged()), this, SLOT(updateState())); - connect(m_step, SIGNAL(changed()), this, SLOT(updateState())); + connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged, + this, &QbsCleanStepConfigWidget::updateState); + connect(m_step, &QbsCleanStep::changed, + this, &QbsCleanStepConfigWidget::updateState); setContentsMargins(0, 0, 0, 0); m_ui = new Ui::QbsCleanStepConfigWidget; m_ui->setupUi(this); - connect(m_ui->dryRunCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeDryRun(bool))); - connect(m_ui->keepGoingCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeKeepGoing(bool))); + connect(m_ui->dryRunCheckBox, &QAbstractButton::toggled, + this, &QbsCleanStepConfigWidget::changeDryRun); + connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled, + this, &QbsCleanStepConfigWidget::changeKeepGoing); updateState(); } diff --git a/src/plugins/qbsprojectmanager/qbscleanstep.h b/src/plugins/qbsprojectmanager/qbscleanstep.h index 433ba50598a..f8814cbcb69 100644 --- a/src/plugins/qbsprojectmanager/qbscleanstep.h +++ b/src/plugins/qbsprojectmanager/qbscleanstep.h @@ -65,12 +65,11 @@ public: signals: void changed(); -private slots: +private: void cleaningDone(bool success); void handleTaskStarted(const QString &desciption, int max); void handleProgress(int value); -private: void createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line); @@ -100,14 +99,13 @@ public: QString summaryText() const; QString displayName() const; -private slots: +private: void updateState(); void changeDryRun(bool dr); void changeKeepGoing(bool kg); void changeJobCount(int jobcount); -private: Ui::QbsCleanStepConfigWidget *m_ui; QbsCleanStep *m_step; diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp index 8e75d2d0a56..14687dac63d 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp @@ -99,11 +99,11 @@ void QbsInstallStep::run(QFutureInterface &fi) m_progressBase = 0; - connect(m_job, SIGNAL(finished(bool,qbs::AbstractJob*)), this, SLOT(installDone(bool))); - connect(m_job, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), - this, SLOT(handleTaskStarted(QString,int))); - connect(m_job, SIGNAL(taskProgress(int,qbs::AbstractJob*)), - this, SLOT(handleProgress(int))); + connect(m_job, &qbs::AbstractJob::finished, this, &QbsInstallStep::installDone); + connect(m_job, &qbs::AbstractJob::taskStarted, + this, &QbsInstallStep::handleTaskStarted); + connect(m_job, &qbs::AbstractJob::taskProgress, + this, &QbsInstallStep::handleProgress); } ProjectExplorer::BuildStepConfigWidget *QbsInstallStep::createConfigWidget() @@ -261,8 +261,10 @@ void QbsInstallStep::setKeepGoing(bool kg) QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) : m_step(step), m_ignoreChange(false) { - connect(m_step, SIGNAL(displayNameChanged()), this, SLOT(updateState())); - connect(m_step, SIGNAL(changed()), this, SLOT(updateState())); + connect(m_step, &ProjectExplorer::ProjectConfiguration::displayNameChanged, + this, &QbsInstallStepConfigWidget::updateState); + connect(m_step, &QbsInstallStep::changed, + this, &QbsInstallStepConfigWidget::updateState); setContentsMargins(0, 0, 0, 0); @@ -275,13 +277,17 @@ QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) : m_ui->installRootChooser->setExpectedKind(Utils::PathChooser::Directory); m_ui->installRootChooser->setHistoryCompleter(QLatin1String("Qbs.InstallRoot.History")); - connect(m_ui->installRootChooser, SIGNAL(rawPathChanged(QString)), this, - SLOT(changeInstallRoot())); - connect(m_ui->removeFirstCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeRemoveFirst(bool))); - connect(m_ui->dryRunCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeDryRun(bool))); - connect(m_ui->keepGoingCheckBox, SIGNAL(toggled(bool)), this, SLOT(changeKeepGoing(bool))); + connect(m_ui->installRootChooser, &Utils::PathChooser::rawPathChanged, this, + &QbsInstallStepConfigWidget::changeInstallRoot); + connect(m_ui->removeFirstCheckBox, &QAbstractButton::toggled, + this, &QbsInstallStepConfigWidget::changeRemoveFirst); + connect(m_ui->dryRunCheckBox, &QAbstractButton::toggled, + this, &QbsInstallStepConfigWidget::changeDryRun); + connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled, + this, &QbsInstallStepConfigWidget::changeKeepGoing); - connect(project, SIGNAL(projectParsingDone(bool)), this, SLOT(updateState())); + connect(project, &QbsProject::projectParsingDone, + this, &QbsInstallStepConfigWidget::updateState); updateState(); } diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.h b/src/plugins/qbsprojectmanager/qbsinstallstep.h index 8ec22fbe924..609a2099dc1 100644 --- a/src/plugins/qbsprojectmanager/qbsinstallstep.h +++ b/src/plugins/qbsprojectmanager/qbsinstallstep.h @@ -68,12 +68,11 @@ public: signals: void changed(); -private slots: +private: void installDone(bool success); void handleTaskStarted(const QString &desciption, int max); void handleProgress(int value); -private: void createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line); @@ -104,7 +103,7 @@ public: QString summaryText() const; QString displayName() const; -private slots: +private: void updateState(); void changeInstallRoot(); diff --git a/src/plugins/qbsprojectmanager/qbslogsink.cpp b/src/plugins/qbsprojectmanager/qbslogsink.cpp index 326076e9618..c9a2f28d641 100644 --- a/src/plugins/qbsprojectmanager/qbslogsink.cpp +++ b/src/plugins/qbsprojectmanager/qbslogsink.cpp @@ -36,6 +36,8 @@ #include #include +using namespace ProjectExplorer; + namespace QbsProjectManager { namespace Internal { @@ -45,9 +47,9 @@ namespace Internal { QbsLogSink::QbsLogSink(QObject *parent) : QObject(parent) { - connect(this, SIGNAL(newTask(ProjectExplorer::Task)), - ProjectExplorer::TaskHub::instance(), - SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection); + connect(this, &QbsLogSink::newTask, + TaskHub::instance(), + [](const Task &task) { TaskHub::addTask(task); }, Qt::QueuedConnection); } void QbsLogSink::sendMessages() @@ -66,11 +68,11 @@ void QbsLogSink::sendMessages() void QbsLogSink::doPrintWarning(const qbs::ErrorInfo &warning) { foreach (const qbs::ErrorItem &item, warning.items()) - emit newTask(ProjectExplorer::Task(ProjectExplorer::Task::Warning, - item.description(), - Utils::FileName::fromString(item.codeLocation().filePath()), - item.codeLocation().line(), - ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); + emit newTask(Task(Task::Warning, + item.description(), + Utils::FileName::fromString(item.codeLocation().filePath()), + item.codeLocation().line(), + Constants::TASK_CATEGORY_BUILDSYSTEM)); } void QbsLogSink::doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag) diff --git a/src/plugins/qbsprojectmanager/qbslogsink.h b/src/plugins/qbsprojectmanager/qbslogsink.h index f17c4833e1b..f3f07f6513c 100644 --- a/src/plugins/qbsprojectmanager/qbslogsink.h +++ b/src/plugins/qbsprojectmanager/qbslogsink.h @@ -45,10 +45,9 @@ public: signals: void newTask(const ProjectExplorer::Task &task); -private slots: - void sendMessages(); - private: + Q_INVOKABLE void sendMessages(); + void doPrintWarning(const qbs::ErrorInfo &warning); void doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag); diff --git a/src/plugins/qbsprojectmanager/qbsparser.h b/src/plugins/qbsprojectmanager/qbsparser.h index 6fa8a86c802..22b3fd1f322 100644 --- a/src/plugins/qbsprojectmanager/qbsparser.h +++ b/src/plugins/qbsprojectmanager/qbsparser.h @@ -41,12 +41,10 @@ class QbsParser : public ProjectExplorer::IOutputParser public: explicit QbsParser(); +private: void setWorkingDirectory(const QString &workingDirectory); - -public slots: void taskAdded(const ProjectExplorer::Task &task, int linkedLines, int skipLines); -private: QDir m_workingDirectory; }; diff --git a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp index 81de2829b79..588a645272d 100644 --- a/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp +++ b/src/plugins/qbsprojectmanager/qbsprofilessettingspage.cpp @@ -54,12 +54,10 @@ public: void apply(); -private slots: +private: void refreshKitsList(); void displayCurrentProfile(); void editProfile(); - -private: void setupCustomProperties(const ProjectExplorer::Kit *kit); void mergeCustomPropertiesIntoModel(); @@ -123,9 +121,12 @@ QbsProfilesSettingsWidget::QbsProfilesSettingsWidget(QWidget *parent) m_model.updateSettingsDir(QbsProjectManagerSettings::qbsSettingsBaseDir()); displayCurrentProfile(); }); - connect(m_ui.expandButton, SIGNAL(clicked()), m_ui.propertiesView, SLOT(expandAll())); - connect(m_ui.collapseButton, SIGNAL(clicked()), m_ui.propertiesView, SLOT(collapseAll())); - connect(m_ui.editButton, SIGNAL(clicked()), SLOT(editProfile())); + connect(m_ui.expandButton, &QAbstractButton::clicked, + m_ui.propertiesView, &QTreeView::expandAll); + connect(m_ui.collapseButton, &QAbstractButton::clicked, + m_ui.propertiesView, &QTreeView::collapseAll); + connect(m_ui.editButton, &QAbstractButton::clicked, + this, &QbsProfilesSettingsWidget::editProfile); refreshKitsList(); } @@ -175,7 +176,9 @@ void QbsProfilesSettingsWidget::refreshKitsList() else if (hasKits) m_ui.kitsComboBox->setCurrentIndex(0); displayCurrentProfile(); - connect(m_ui.kitsComboBox, SIGNAL(currentIndexChanged(int)), SLOT(displayCurrentProfile())); + connect(m_ui.kitsComboBox, + static_cast(&QComboBox::currentIndexChanged), + this, &QbsProfilesSettingsWidget::displayCurrentProfile); } void QbsProfilesSettingsWidget::displayCurrentProfile() diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index b9f6556d108..822001a4e67 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -117,13 +117,11 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) : setProjectContext(Context(Constants::PROJECT_ID)); setProjectLanguages(Context(ProjectExplorer::Constants::LANG_CXX)); - connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)), - this, SLOT(changeActiveTarget(ProjectExplorer::Target*))); - connect(this, SIGNAL(addedTarget(ProjectExplorer::Target*)), - this, SLOT(targetWasAdded(ProjectExplorer::Target*))); - connect(this, SIGNAL(environmentChanged()), this, SLOT(delayParsing())); + connect(this, &Project::activeTargetChanged, this, &QbsProject::changeActiveTarget); + connect(this, &Project::addedTarget, this, &QbsProject::targetWasAdded); + connect(this, &Project::environmentChanged, this, &QbsProject::delayParsing); - connect(&m_parsingDelay, SIGNAL(timeout()), this, SLOT(startParsing())); + connect(&m_parsingDelay, &QTimer::timeout, this, &QbsProject::startParsing); } QbsProject::~QbsProject() @@ -531,9 +529,8 @@ void QbsProject::handleRuleExecutionDone() void QbsProject::targetWasAdded(Target *t) { - connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), - this, SLOT(delayParsing())); - connect(t, SIGNAL(buildDirectoryChanged()), this, SLOT(delayParsing())); + connect(t, &Target::activeBuildConfigurationChanged, this, &QbsProject::delayParsing); + connect(t, &Target::buildDirectoryChanged, this, &QbsProject::delayParsing); } void QbsProject::changeActiveTarget(Target *t) @@ -547,11 +544,13 @@ void QbsProject::changeActiveTarget(Target *t) void QbsProject::buildConfigurationChanged(BuildConfiguration *bc) { if (m_currentBc) - disconnect(m_currentBc, SIGNAL(qbsConfigurationChanged()), this, SLOT(delayParsing())); + disconnect(m_currentBc, &QbsBuildConfiguration::qbsConfigurationChanged, + this, &QbsProject::delayParsing); m_currentBc = qobject_cast(bc); if (m_currentBc) { - connect(m_currentBc, SIGNAL(qbsConfigurationChanged()), this, SLOT(delayParsing())); + connect(m_currentBc, &QbsBuildConfiguration::qbsConfigurationChanged, + this, &QbsProject::delayParsing); delayParsing(); } else { invalidate(); @@ -640,7 +639,8 @@ void QbsProject::registerQbsProjectParser(QbsProjectParser *p) if (p) { connect(m_qbsProjectParser, &QbsProjectParser::ruleExecutionDone, this, &QbsProject::handleRuleExecutionDone); - connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool))); + connect(m_qbsProjectParser, &QbsProjectParser::done, + this, &QbsProject::handleQbsParsingDone); } } diff --git a/src/plugins/qbsprojectmanager/qbsproject.h b/src/plugins/qbsprojectmanager/qbsproject.h index c22a161cd89..7edbd73cbb6 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.h +++ b/src/plugins/qbsprojectmanager/qbsproject.h @@ -106,7 +106,7 @@ public: const qbs::ProductData &product); static QString uniqueProductName(const qbs::ProductData &product); -public slots: +public: void invalidate(); void delayParsing(); @@ -114,7 +114,7 @@ signals: void projectParsingStarted(); void projectParsingDone(bool); -private slots: +private: void handleQbsParsingDone(bool success); void targetWasAdded(ProjectExplorer::Target *t); @@ -122,7 +122,6 @@ private slots: void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc); void startParsing(); -private: RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override; void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index e31de7cec70..04cc9c25ae7 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -127,19 +127,22 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * command = Core::ActionManager::registerAction(m_reparseQbs, Constants::ACTION_REPARSE_QBS, projectContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_reparseQbs, SIGNAL(triggered()), this, SLOT(reparseCurrentProject())); + connect(m_reparseQbs, &QAction::triggered, + this, &QbsProjectManagerPlugin::reparseCurrentProject); m_reparseQbsCtx = new QAction(tr("Reparse Qbs"), this); command = Core::ActionManager::registerAction(m_reparseQbsCtx, Constants::ACTION_REPARSE_QBS_CONTEXT, projectContext); command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); - connect(m_reparseQbsCtx, SIGNAL(triggered()), this, SLOT(reparseSelectedProject())); + connect(m_reparseQbsCtx, &QAction::triggered, + this, &QbsProjectManagerPlugin::reparseSelectedProject); m_buildFileCtx = new QAction(tr("Build"), this); command = Core::ActionManager::registerAction(m_buildFileCtx, Constants::ACTION_BUILD_FILE_CONTEXT, projectContext); command->setAttribute(Core::Command::CA_Hide); mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER); - connect(m_buildFileCtx, SIGNAL(triggered()), this, SLOT(buildFileContextMenu())); + connect(m_buildFileCtx, &QAction::triggered, + this, &QbsProjectManagerPlugin::buildFileContextMenu); m_buildFile = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -149,13 +152,14 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setDescription(m_buildFile->text()); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B"))); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_buildFile, SIGNAL(triggered()), this, SLOT(buildFile())); + connect(m_buildFile, &QAction::triggered, this, &QbsProjectManagerPlugin::buildFile); m_buildProductCtx = new QAction(tr("Build"), this); command = Core::ActionManager::registerAction(m_buildProductCtx, Constants::ACTION_BUILD_PRODUCT_CONTEXT, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); - connect(m_buildProductCtx, SIGNAL(triggered()), this, SLOT(buildProductContextMenu())); + connect(m_buildProductCtx, &QAction::triggered, + this, &QbsProjectManagerPlugin::buildProductContextMenu); m_buildProduct = new Utils::ParameterAction(tr("Build Product"), tr("Build Product \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -165,13 +169,14 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setDescription(m_buildFile->text()); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Shift+B"))); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_buildProduct, SIGNAL(triggered()), this, SLOT(buildProduct())); + connect(m_buildProduct, &QAction::triggered, this, &QbsProjectManagerPlugin::buildProduct); m_buildSubprojectCtx = new QAction(tr("Build"), this); command = Core::ActionManager::registerAction(m_buildSubprojectCtx, Constants::ACTION_BUILD_SUBPROJECT_CONTEXT, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); - connect(m_buildSubprojectCtx, SIGNAL(triggered()), this, SLOT(buildSubprojectContextMenu())); + connect(m_buildSubprojectCtx, &QAction::triggered, + this, &QbsProjectManagerPlugin::buildSubprojectContextMenu); m_buildSubproject = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); @@ -181,24 +186,24 @@ bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString * command->setDescription(m_buildFile->text()); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B"))); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); - connect(m_buildSubproject, SIGNAL(triggered()), this, SLOT(buildSubproject())); + connect(m_buildSubproject, &QAction::triggered, this, &QbsProjectManagerPlugin::buildSubproject); // Connect connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged, this, &QbsProjectManagerPlugin::nodeSelectionChanged); - connect(BuildManager::instance(), SIGNAL(buildStateChanged(ProjectExplorer::Project*)), - this, SLOT(buildStateChanged(ProjectExplorer::Project*))); + connect(BuildManager::instance(), &BuildManager::buildStateChanged, + this, &QbsProjectManagerPlugin::buildStateChanged); - connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), - this, SLOT(currentEditorChanged())); + connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, + this, &QbsProjectManagerPlugin::currentEditorChanged); - connect(SessionManager::instance(), SIGNAL(projectAdded(ProjectExplorer::Project*)), - this, SLOT(projectWasAdded(ProjectExplorer::Project*))); - connect(SessionManager::instance(), SIGNAL(projectRemoved(ProjectExplorer::Project*)), - this, SLOT(projectWasRemoved())); - connect(SessionManager::instance(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), - this, SLOT(currentProjectWasChanged(ProjectExplorer::Project*))); + connect(SessionManager::instance(), &SessionManager::projectAdded, + this, &QbsProjectManagerPlugin::projectWasAdded); + connect(SessionManager::instance(), &SessionManager::projectRemoved, + this, &QbsProjectManagerPlugin::projectWasRemoved); + connect(SessionManager::instance(), &SessionManager::startupProjectChanged, + this, &QbsProjectManagerPlugin::currentProjectWasChanged); // Run initial setup routines updateContextActions(); @@ -218,8 +223,10 @@ void QbsProjectManagerPlugin::projectWasAdded(Project *project) if (!qbsProject) return; - connect(qbsProject, SIGNAL(projectParsingStarted()), this, SLOT(parsingStateChanged())); - connect(qbsProject, SIGNAL(projectParsingDone(bool)), this, SLOT(parsingStateChanged())); + connect(qbsProject, &QbsProject::projectParsingStarted, + this, &QbsProjectManagerPlugin::parsingStateChanged); + connect(qbsProject, &QbsProject::projectParsingDone, + this, &QbsProjectManagerPlugin::parsingStateChanged); } void QbsProjectManagerPlugin::currentProjectWasChanged(Project *project) diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h index eb54681c7df..89df5183441 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.h @@ -58,7 +58,7 @@ public: void extensionsInitialized(); -private slots: +private: void projectWasAdded(ProjectExplorer::Project *project); void currentProjectWasChanged(ProjectExplorer::Project *project); void projectWasRemoved(); @@ -78,7 +78,6 @@ private slots: void reparseCurrentProject(); void reparseProject(QbsProject *project); -private: void updateContextActions(); void updateReparseQbsAction(); void updateBuildActions(); diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp index 4137eeed4cf..d823ddeb465 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.cpp @@ -111,12 +111,12 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, m_qbsSetupProjectJob = m_project.setupProject(params, QbsManager::logSink(), 0); - connect(m_qbsSetupProjectJob, SIGNAL(finished(bool,qbs::AbstractJob*)), - this, SLOT(handleQbsParsingDone(bool))); - connect(m_qbsSetupProjectJob, SIGNAL(taskStarted(QString,int,qbs::AbstractJob*)), - this, SLOT(handleQbsParsingTaskSetup(QString,int))); - connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)), - this, SLOT(handleQbsParsingProgress(int))); + connect(m_qbsSetupProjectJob, &qbs::AbstractJob::finished, + this, &QbsProjectParser::handleQbsParsingDone); + connect(m_qbsSetupProjectJob, &qbs::AbstractJob::taskStarted, + this, &QbsProjectParser::handleQbsParsingTaskSetup); + connect(m_qbsSetupProjectJob, &qbs::AbstractJob::taskProgress, + this, &QbsProjectParser::handleQbsParsingProgress); } void QbsProjectParser::cancel() diff --git a/src/plugins/qbsprojectmanager/qbsprojectparser.h b/src/plugins/qbsprojectmanager/qbsprojectparser.h index 82b45196d7b..0d140233f68 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectparser.h +++ b/src/plugins/qbsprojectmanager/qbsprojectparser.h @@ -57,12 +57,11 @@ signals: void done(bool success); void ruleExecutionDone(); -private slots: +private: void handleQbsParsingDone(bool success); void handleQbsParsingProgress(int progress); void handleQbsParsingTaskSetup(const QString &description, int maximumProgressValue); -private: QString pluginsBaseDirectory() const; QString resourcesBaseDirectory() const; QString libExecDirectory() const; diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h index 9351d30ac3d..51c2f2f384a 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h +++ b/src/plugins/qbsprojectmanager/qbsrunconfiguration.h @@ -85,11 +85,9 @@ signals: protected: QbsRunConfiguration(ProjectExplorer::Target *parent, QbsRunConfiguration *source); -private slots: +private: void installStepChanged(); void installStepToBeRemoved(int pos); - -private: QString baseWorkingDirectory() const; QString defaultDisplayName(); qbs::InstallOptions installOptions() const; From 334273be84c0b71c57a472075d337c705ad3f7cf Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 21 Jun 2016 14:01:41 +0200 Subject: [PATCH 24/30] QmlDesigner: Update qrc files This triggers an update on every qrc file. Change-Id: Id34873e3bd8190d79773fbc3a8a90699d4e49cb0 Reviewed-by: Tim Jenssen --- .../components/integration/designdocument.cpp | 19 +++++++++++++++++++ .../components/integration/designdocument.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index e2ac7235f13..3c96494ba2a 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -46,6 +46,8 @@ #include #include +#include + #include #include #include @@ -243,12 +245,17 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit) this, SIGNAL(dirtyStateChanged(bool))); m_documentTextModifier.reset(new BaseTextEditModifier(dynamic_cast(plainTextEdit()))); + + connect(m_documentTextModifier.data(), &TextModifier::textChanged, this, &DesignDocument::updateQrcFiles); + m_documentModel->setTextModifier(m_documentTextModifier.data()); m_inFileComponentTextModifier.reset(); updateFileName(Utils::FileName(), fileName()); + updateQrcFiles(); + m_documentLoaded = true; } @@ -277,6 +284,18 @@ void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textMod viewManager().attachViewsExceptRewriterAndComponetView(); } +void DesignDocument::updateQrcFiles() +{ + ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(fileName()); + + if (currentProject) { + foreach (const QString &fileName, currentProject->files(ProjectExplorer::Project::SourceFiles)) { + if (fileName.endsWith(".qrc")) + QmlJS::ModelManagerInterface::instance()->updateQrcFile(fileName); + } + } +} + void DesignDocument::changeToSubComponent(const ModelNode &componentNode) { if (QmlDesignerPlugin::instance()->currentDesignDocument() != this) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 8e8e18ecb4f..e7aff639533 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -124,6 +124,8 @@ private slots: private: // functions void changeToInFileComponentModel(ComponentTextModifier *textModifer); + void updateQrcFiles(); + QWidget *centralWidget() const; QString pathToQt() const; From e6be4484a66a0aad38f7b609d9e5ac7e89d56f02 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 29 Jun 2016 14:56:18 +0200 Subject: [PATCH 25/30] QmlDesigner.MetaInfo: Initiliase property info lazily There exists cases where collecting the properties is very slow. We only have to do this on demand for the property editor. Change-Id: I92d7270481db94655c95ab8d69f373488d841b4e Reviewed-by: Tim Jenssen --- .../designercore/metainfo/nodemetainfo.cpp | 53 ++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 67a6840d13e..426f1560bc1 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -40,6 +40,8 @@ #include #include +#include + namespace QmlDesigner { namespace Internal { @@ -565,6 +567,9 @@ private: const CppComponentValue *getNearestCppComponentValue() const; QString fullQualifiedImportAliasType() const; + void ensureProperties() const; + void initialiseProperties(); + TypeName m_qualfiedTypeName; int m_majorVersion; int m_minorVersion; @@ -585,6 +590,8 @@ private: QPointer m_model; static QHash m_nodeMetaInfoCache; + const ObjectValue *m_objectValue = nullptr; + bool m_propertiesSetup = false; }; QHash NodeMetaInfoPrivate::m_nodeMetaInfoCache; @@ -596,16 +603,21 @@ bool NodeMetaInfoPrivate::isFileComponent() const PropertyNameList NodeMetaInfoPrivate::properties() const { + ensureProperties(); + return m_properties; } PropertyNameList NodeMetaInfoPrivate::localProperties() const { + ensureProperties(); + return m_localProperties; } PropertyNameList NodeMetaInfoPrivate::signalNames() const { + ensureProperties(); return m_signals; } @@ -670,12 +682,10 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i m_majorVersion = cppObjectValue->componentVersion().majorVersion(); m_minorVersion = cppObjectValue->componentVersion().minorVersion(); } - setupPropertyInfo(getTypes(cppObjectValue, context())); - setupLocalPropertyInfo(getTypes(cppObjectValue, context(), true)); + m_objectValue = cppObjectValue; m_defaultPropertyName = cppObjectValue->defaultPropertyName().toUtf8(); m_isValid = true; setupPrototypes(); - m_signals = getSignals(cppObjectValue, context()); } else { const ObjectValue *objectValue = getObjectValue(); if (objectValue) { @@ -699,12 +709,10 @@ NodeMetaInfoPrivate::NodeMetaInfoPrivate(Model *model, TypeName type, int maj, i m_minorVersion = importInfo.version().minorVersion(); } } - setupPropertyInfo(getTypes(objectValue, context())); - setupLocalPropertyInfo(getTypes(objectValue, context(), true)); + m_objectValue = objectValue; m_defaultPropertyName = context()->defaultPropertyName(objectValue).toUtf8(); m_isValid = true; setupPrototypes(); - m_signals = getSignals(objectValue, context()); } } } @@ -803,6 +811,8 @@ bool NodeMetaInfoPrivate::isPropertyWritable(const PropertyName &propertyName) c if (!isValid()) return false; + ensureProperties(); + if (propertyName.contains('.')) { const PropertyNameList parts = propertyName.split('.'); const PropertyName objectName = parts.first(); @@ -834,6 +844,8 @@ bool NodeMetaInfoPrivate::isPropertyList(const PropertyName &propertyName) const if (!isValid()) return false; + ensureProperties(); + if (propertyName.contains('.')) { const PropertyNameList parts = propertyName.split('.'); const PropertyName objectName = parts.first(); @@ -861,6 +873,8 @@ bool NodeMetaInfoPrivate::isPropertyPointer(const PropertyName &propertyName) co if (!isValid()) return false; + ensureProperties(); + if (propertyName.contains('.')) { const PropertyNameList parts = propertyName.split('.'); const PropertyName objectName = parts.first(); @@ -888,6 +902,8 @@ bool NodeMetaInfoPrivate::isPropertyEnum(const PropertyName &propertyName) const if (!isValid()) return false; + ensureProperties(); + if (propertyType(propertyName).contains("Qt::")) return true; @@ -918,6 +934,8 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const PropertyName &propertyName) if (!isValid()) return QString(); + ensureProperties(); + if (propertyType(propertyName).contains("Qt::")) return QStringLiteral("Qt"); @@ -1262,6 +1280,29 @@ QString NodeMetaInfoPrivate::fullQualifiedImportAliasType() const return QString::fromUtf8(m_qualfiedTypeName); } +void NodeMetaInfoPrivate::ensureProperties() const +{ + if (m_propertiesSetup) + return; + + const_cast(this)->initialiseProperties(); +} + +void NodeMetaInfoPrivate::initialiseProperties() +{ + if (!isValid()) + return; + + m_propertiesSetup = true; + + QTC_ASSERT(m_objectValue, qDebug() << qualfiedTypeName(); return); + + setupPropertyInfo(getTypes(m_objectValue, context())); + setupLocalPropertyInfo(getTypes(m_objectValue, context(), true)); + + m_signals = getSignals(m_objectValue, context()); +} + } //namespace Internal NodeMetaInfo::NodeMetaInfo() : m_privateData(new Internal::NodeMetaInfoPrivate()) From a63c4319163ac3ccd321959336928882cf1c9d61 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 29 Jun 2016 12:19:48 +0200 Subject: [PATCH 26/30] QmlDesigner: Fix fixResourcePaths() QML does not accept absolute paths (e.g. C:\working\something\) as urls. We need the file:/// prefix. Change-Id: I9df74cd9c0e730fba056af971751f8eb88cdb536 Reviewed-by: Tim Jenssen --- .../qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp index 0fe7f5d2288..15d2aa5dafb 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlprivategate/qmlprivategate_56.cpp @@ -126,7 +126,7 @@ QVariant fixResourcePaths(const QVariant &value) if (QFileInfo(fixedPath).exists()) { fixedPath.replace(QLatin1String("//"), QLatin1String("/")); fixedPath.replace(QLatin1Char('\\'), QLatin1Char('/')); - return fixedPath; + return QUrl::fromLocalFile(fixedPath); } } } From ebffc0555e46c25a27cda2ed9016f27de351c1b3 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 28 Jun 2016 13:31:04 +0200 Subject: [PATCH 27/30] QmlDesigner: Making adding signal handlers more user friendly The "Go to implementation" context menu was adding a new signal handler if no signal handler was already present. This does not change, but I add "Add new Signal Handler" that always adds a new signal handler, even if one already exists. Change-Id: I7d1f012fda114d22598a9dd650ee14d97d48cd1d Reviewed-by: Tim Jenssen --- .../componentcore/componentcore_constants.h | 1 + .../componentcore/designeractionmanager.cpp | 5 +++-- .../componentcore/modelnodeoperations.cpp | 14 ++++++++++++-- .../components/componentcore/modelnodeoperations.h | 4 +++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/components/componentcore/componentcore_constants.h b/src/plugins/qmldesigner/components/componentcore/componentcore_constants.h index 233dc87f6cf..cac7462d75f 100644 --- a/src/plugins/qmldesigner/components/componentcore/componentcore_constants.h +++ b/src/plugins/qmldesigner/components/componentcore/componentcore_constants.h @@ -72,6 +72,7 @@ const char resetPositionDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMen const char goIntoComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Go into Component"); const char goToImplementationDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Go to Implementation"); +const char addSignalHandlerDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Add New Signal Handler"); const char moveToComponentDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Move to Component"); const char setIdDisplayName[] = QT_TRANSLATE_NOOP("QmlDesignerContextMenu", "Set Id"); diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 57f1ca61da6..ea79b5c62e8 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -509,10 +509,11 @@ void DesignerActionManager::createDefaultDesignerActions() addDesignerAction(new ModelNodeAction (goIntoComponentDisplayName, rootCategory, priorityGoIntoComponent, &goIntoComponent, &selectionIsComponent)); addDesignerAction(new ModelNodeAction - (goToImplementationDisplayName, rootCategory, 42, &gotoImplementation, &singleSelectedAndUiFile, &singleSelectedAndUiFile)); + (goToImplementationDisplayName, rootCategory, 42, &goImplementation, &singleSelectedAndUiFile, &singleSelectedAndUiFile)); + addDesignerAction(new ModelNodeAction + (addSignalHandlerDisplayName, rootCategory, 42, &addNewSignalHandler, &singleSelectedAndUiFile, &singleSelectedAndUiFile)); addDesignerAction(new ModelNodeAction (moveToComponentDisplayName, rootCategory, 44, &moveToComponent, &singleSelection, &singleSelection)); - } void DesignerActionManager::addDesignerAction(ActionInterface *newAction) diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 7d3c89a2ee4..a13c86cc7c9 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -637,7 +637,7 @@ static QStringList getSortedSignalNameList(const ModelNode &modelNode) return signalNames; } -void gotoImplementation(const SelectionContext &selectionState) +void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState, bool addAlwaysNewSlot) { ModelNode modelNode; if (selectionState.singleNodeIsSelected()) @@ -687,7 +687,7 @@ void gotoImplementation(const SelectionContext &selectionState) Core::ModeManager::activateMode(Core::Constants::MODE_EDIT); - if (usages.count() == 1) { + if (usages.count() > 0 && (addAlwaysNewSlot || usages.count()< 2)) { Core::EditorManager::openEditorAt(usages.first().path, usages.first().line, usages.first().col); if (!signalNames.isEmpty()) { @@ -782,6 +782,16 @@ void moveToComponent(const SelectionContext &selectionContext) selectionContext.view()->model()->rewriterView()->moveToComponent(modelNode); } +void goImplementation(const SelectionContext &selectionState) +{ + addSignalHandlerOrGotoImplementation(selectionState, false); +} + +void addNewSignalHandler(const SelectionContext &selectionState) +{ + addSignalHandlerOrGotoImplementation(selectionState, true); +} + } // namespace Mode } //QmlDesigner diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h index 560d54d218b..4c447cef23b 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h @@ -63,7 +63,9 @@ void layoutFlowPositioner(const SelectionContext &selectionState); void layoutRowLayout(const SelectionContext &selectionState); void layoutColumnLayout(const SelectionContext &selectionState); void layoutGridLayout(const SelectionContext &selectionState); -void gotoImplementation(const SelectionContext &selectionState); +void goImplementation(const SelectionContext &selectionState); +void addNewSignalHandler(const SelectionContext &selectionState); +void addSignalHandlerOrGotoImplementation(const SelectionContext &selectionState, bool addAlwaysNewSlot); void removeLayout(const SelectionContext &selectionContext); void removePositioner(const SelectionContext &selectionContext); void moveToComponent(const SelectionContext &selectionContext); From e065ab2cd3481076743848892bc0c1652200a275 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 13 Jun 2016 12:49:57 +0200 Subject: [PATCH 28/30] Squish: Handle empty selection in QWebEngineView Change-Id: I7e4d53483f3168e78024dcf87125b44f96453fa2 Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP04/test.py | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/system/suite_HELP/tst_HELP04/test.py b/tests/system/suite_HELP/tst_HELP04/test.py index 5720ff3cd80..7f046e76a45 100755 --- a/tests/system/suite_HELP/tst_HELP04/test.py +++ b/tests/system/suite_HELP/tst_HELP04/test.py @@ -28,14 +28,17 @@ import re # test search in help mode and advanced search searchKeywordDictionary={ "deployment":True, "deplmint":False, "build":True, "bld":False } +urlDictionary = { "deployment":"qthelp://com.trolltech.qt.481/qdoc/gettingstarted-develop.html", + "build":"qthelp://com.trolltech.qt.481/qdoc/sql-driver.html" } def __getSelectedText__(): hv = getHelpViewer() + isWebEngineView = className(hv) == "QWebEngineView" try: selText = hv.selectedText if className(selText) != 'instancemethod': - return str(selText) + return str(selText), isWebEngineView except: pass try: @@ -43,7 +46,7 @@ def __getSelectedText__(): except: test.warning("Could not get highlighted text.") selText = '' - return str(selText) + return str(selText), isWebEngineView def __getUrl__(): helpViewer = getHelpViewer() @@ -66,12 +69,20 @@ def getHighlightsInHtml(htmlCode): return res def verifySelection(expected): - selText = str(__getSelectedText__()) + selText, isWebEngineView = __getSelectedText__() + if isWebEngineView: + test.log("The search results are not a selection in a QWebEngineView", + "Searched strings should still be highlighted") + return + selText = str(selText) if test.verify(selText, "Verify that there is a selection"): # verify if search keyword is found in results test.verify(expected.lower() in selText.lower(), "'%s' search result can be found" % expected) +def verifyUrl(expected): + return test.compare(expected, __getUrl__(), "Expected URL loaded?") + def main(): global sdkPath noMatch = "Your search did not match any documents." @@ -109,14 +120,15 @@ def main(): test.verify(waitFor("re.match('[1-9]\d* - [1-9]\d* of [1-9]\d* Hits'," "str(findObject(':Hits_QLabel').text))", 2000), "Verifying if search results found with 1+ hits for: " + searchKeyword) - selText = __getSelectedText__() + selText = __getSelectedText__()[0] url = __getUrl__() # click in the widget, tab to first item and press enter mouseClick(waitForObject(":Hits_QCLuceneResultWidget"), 1, 1, 0, Qt.LeftButton) type(waitForObject(":Hits_QCLuceneResultWidget"), "") type(waitForObject(":Hits_QCLuceneResultWidget"), "") - waitFor("__getUrl__() != url or selText != __getSelectedText__()", 20000) + waitFor("__getUrl__() != url or selText != __getSelectedText__()[0]", 20000) verifySelection(searchKeyword) + verifyUrl(urlDictionary[searchKeyword]) else: test.verify(waitFor("noMatch in " "str(waitForObject(':Hits_QCLuceneResultWidget').plainText)", 1000), @@ -148,10 +160,12 @@ def main(): type(resultsView, "") type(resultsView, "") verifySelection("printing") + verifyUrl("qthelp://com.trolltech.qt.481/qdoc/overviews.html") for i in range(2): type(resultsView, "") type(resultsView, "") verifySelection("sql") + verifyUrl("qthelp://com.trolltech.qt.481/qdoc/best-practices.html") # verify if simple search is properly disabled test.verify(not searchLineEdit.enabled, "Verifying if simple search is not active in advanced mode.") From 8fbd3cd32e3ecb18259776a789018787696dd828 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 29 Jun 2016 16:00:00 +0200 Subject: [PATCH 29/30] QmlDesigner: fix regression from last code cleanup Task-number: QTCREATORBUG-16516 Change-Id: Ic77d325c131a594f69b6fbbb6b1d6be6374b45a0 Reviewed-by: Thomas Hartmann --- .../qmldesigner/components/integration/designdocument.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 3c96494ba2a..a8dc05650bf 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -172,7 +172,7 @@ QList DesignDocument::qmlParseWarnings() const bool DesignDocument::hasQmlParseWarnings() const { - return m_rewriterView->warnings().isEmpty(); + return !m_rewriterView->warnings().isEmpty(); } QList DesignDocument::qmlParseErrors() const @@ -182,7 +182,7 @@ QList DesignDocument::qmlParseErrors() const bool DesignDocument::hasQmlParseErrors() const { - return m_rewriterView->errors().isEmpty(); + return !m_rewriterView->errors().isEmpty(); } QString DesignDocument::displayName() const From 1ccec9882db0c11554b75bdb1626db6b97b23ecf Mon Sep 17 00:00:00 2001 From: Jochen Becher Date: Fri, 24 Jun 2016 22:44:37 +0200 Subject: [PATCH 30/30] ModelEditor: Zoom with Ctrl + mouse wheel Change-Id: I2e703345a882f0dbd80a0957d5f28bd203f4f26b Reviewed-by: Tobias Hunger (cherry picked from commit 3e776dde5ebd49db6a0e772b09d931f0333a00ae) Reviewed-by: Eike Ziller --- src/plugins/modeleditor/editordiagramview.cpp | 13 +++++++++++++ src/plugins/modeleditor/editordiagramview.h | 10 +++++++++- src/plugins/modeleditor/modeleditor.cpp | 18 ++++++++++++++++++ src/plugins/modeleditor/modeleditor.h | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/plugins/modeleditor/editordiagramview.cpp b/src/plugins/modeleditor/editordiagramview.cpp index 68951cdedba..09621c2335c 100644 --- a/src/plugins/modeleditor/editordiagramview.cpp +++ b/src/plugins/modeleditor/editordiagramview.cpp @@ -33,6 +33,8 @@ #include #include +#include + namespace ModelEditor { namespace Internal { @@ -63,6 +65,17 @@ void EditorDiagramView::setPxNodeController(PxNodeController *pxNodeController) d->pxNodeController = pxNodeController; } +void EditorDiagramView::wheelEvent(QWheelEvent *wheelEvent) +{ + if (wheelEvent->modifiers() == Qt::ControlModifier) { + int degree = wheelEvent->angleDelta().y() / 8; + if (degree > 0) + emit zoomIn(); + else if (degree < 0) + emit zoomOut(); + } +} + void EditorDiagramView::dropProjectExplorerNodes(const QList &values, const QPoint &pos) { foreach (const QVariant &value, values) { diff --git a/src/plugins/modeleditor/editordiagramview.h b/src/plugins/modeleditor/editordiagramview.h index f0183d1dd70..0a90af01617 100644 --- a/src/plugins/modeleditor/editordiagramview.h +++ b/src/plugins/modeleditor/editordiagramview.h @@ -40,10 +40,18 @@ class EditorDiagramView : public: explicit EditorDiagramView(QWidget *parent = 0); - ~EditorDiagramView(); + ~EditorDiagramView() override; +signals: + void zoomIn(); + void zoomOut(); + +public: void setPxNodeController(PxNodeController *pxNodeController); +protected: + void wheelEvent(QWheelEvent *wheelEvent) override; + private: void dropProjectExplorerNodes(const QList &values, const QPoint &pos); diff --git a/src/plugins/modeleditor/modeleditor.cpp b/src/plugins/modeleditor/modeleditor.cpp index 72326cebe83..f1dce77a729 100644 --- a/src/plugins/modeleditor/modeleditor.cpp +++ b/src/plugins/modeleditor/modeleditor.cpp @@ -69,6 +69,7 @@ #include #include #include +#include #include #include @@ -376,6 +377,11 @@ void ModelEditor::initDocument() connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, this, &ModelEditor::onCurrentEditorChanged, Qt::QueuedConnection); + connect(d->diagramView, &EditorDiagramView::zoomIn, + this, &ModelEditor::zoomIn); + connect(d->diagramView, &EditorDiagramView::zoomOut, + this, &ModelEditor::zoomOut); + connect(d->modelTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ModelEditor::onTreeViewSelectionChanged, Qt::QueuedConnection); connect(d->modelTreeView, &qmt::ModelTreeView::treeViewActivated, @@ -564,6 +570,7 @@ void ModelEditor::zoomIn() QTransform transform = d->diagramView->transform(); transform.scale(ZOOM_FACTOR, ZOOM_FACTOR); d->diagramView->setTransform(transform); + showZoomIndicator(); } void ModelEditor::zoomOut() @@ -571,11 +578,13 @@ void ModelEditor::zoomOut() QTransform transform = d->diagramView->transform(); transform.scale(1.0 / ZOOM_FACTOR, 1.0 / ZOOM_FACTOR); d->diagramView->setTransform(transform); + showZoomIndicator(); } void ModelEditor::resetZoom() { d->diagramView->setTransform(QTransform()); + showZoomIndicator(); } qmt::MPackage *ModelEditor::guessSelectedPackage() const @@ -766,6 +775,15 @@ bool ModelEditor::updateButtonIconByTheme(QAbstractButton *button, const QString return false; } +void ModelEditor::showZoomIndicator() +{ + int scale = int(d->diagramView->transform().map(QPointF(100, 100)).x() + 0.5); + Utils::FadingIndicator::showText(d->diagramStack, + QCoreApplication::translate("ModelEditor", + "Zoom: %1%").arg(scale), + Utils::FadingIndicator::SmallText); +} + void ModelEditor::onAddPackage() { ExtDocumentController *documentController = d->document->documentController(); diff --git a/src/plugins/modeleditor/modeleditor.h b/src/plugins/modeleditor/modeleditor.h index 46eb8bba14c..53d4447324c 100644 --- a/src/plugins/modeleditor/modeleditor.h +++ b/src/plugins/modeleditor/modeleditor.h @@ -105,6 +105,7 @@ private: const QIcon &icon, const QString &toolTipBase, QWidget *parent); bool updateButtonIconByTheme(QAbstractButton *button, const QString &name); + void showZoomIndicator(); void onAddPackage(); void onAddComponent();
Signal name : %1