diff --git a/cmake/QtCreatorTranslations.cmake b/cmake/QtCreatorTranslations.cmake index 4803d66be5e..94f28663483 100644 --- a/cmake/QtCreatorTranslations.cmake +++ b/cmake/QtCreatorTranslations.cmake @@ -30,7 +30,18 @@ function(_extract_ts_data_from_targets outprefix) set(_target_sources "") if(_source_files) - list(FILTER _source_files EXCLUDE REGEX ".*[.]json[.]in|.*[.]svg|.*[.]pro|.*[.]css") + # exclude various funny source files, and anything generated + # like *metatypes.json.gen, moc_*.cpp, qrc_*.cpp, */qmlcache/*.cpp, + # *qmltyperegistrations.cpp + set(_exclude_patterns + .*[.]json[.]in + .*[.]svg + .*[.]pro + .*[.]css + "${PROJECT_BINARY_DIR}/.*" + ) + list(JOIN _exclude_patterns "|" _exclude_pattern) + list(FILTER _source_files EXCLUDE REGEX "${_exclude_pattern}") list(APPEND _target_sources ${_source_files}) endif() if(_extra_translations) diff --git a/dist/changelog/changes-11.0.0.md b/dist/changelog/changes-11.0.0.md index a9811dbeafd..ac70cd2dc99 100644 --- a/dist/changelog/changes-11.0.0.md +++ b/dist/changelog/changes-11.0.0.md @@ -108,7 +108,8 @@ Editing ([QTCREATORBUG-312](https://bugreports.qt.io/browse/QTCREATORBUG-312)) * Added highlighting for typed string literals and user-defined literals ([QTCREATORBUG-28869](https://bugreports.qt.io/browse/QTCREATORBUG-28869)) -* Added the option to create class members from assignments +* Extended the `Add Class Member` refactoring action to create class + members from assignments ([QTCREATORBUG-1918](https://bugreports.qt.io/browse/QTCREATORBUG-1918)) * Fixed that locator showed both the declaration and the definition of symbols ([QTCREATORBUG-13894](https://bugreports.qt.io/browse/QTCREATORBUG-13894)) @@ -119,7 +120,8 @@ Editing ### Language Server Protocol -* Added missing actions for opening the `Call Hierarchy` +* Added actions for opening the `Call Hierarchy` to the context menu of the + editor ([QTCREATORBUG-28839](https://bugreports.qt.io/browse/QTCREATORBUG-28839), [QTCREATORBUG-28842](https://bugreports.qt.io/browse/QTCREATORBUG-28842)) @@ -140,13 +142,19 @@ Editing interpreter selector and the wizard ([PYSIDE-2152](https://bugreports.qt.io/browse/PYSIDE-2152)) + ([Documentation](https://doc-snapshots.qt.io/qtcreator-11.0/creator-python-development.html)) + Projects -------- -* Made it possible to add devices without going through the wizard -* Added support for moving files to a different directory when renaming +* Made it possible to add devices in `Preferences > Devices > Add` without going + through the wizard +* Added support for moving files to a different directory when renaming them in + the `File System` view ([QTCREATORBUG-15981](https://bugreports.qt.io/browse/QTCREATORBUG-15981)) + ([Documentation](https://doc.qt.io/qtcreator/creator-file-system-view.html)) + ### CMake * Implemented adding files to the project @@ -158,17 +166,23 @@ Projects [QTCREATORBUG-28904](https://bugreports.qt.io/browse/QTCREATORBUG-28904), [QTCREATORBUG-28985](https://bugreports.qt.io/browse/QTCREATORBUG-28985), [QTCREATORBUG-29006](https://bugreports.qt.io/browse/QTCREATORBUG-29006)) +* Added `Build > Reload CMake Presets` to reload CMake presets after making + changes to them +* Fixed that CMake Presets were not visible in `Projects` view + ([QTCREATORBUG-28966](https://bugreports.qt.io/browse/QTCREATORBUG-28966)) * Fixed issues with detecting a configured Qt version when importing a build ([QTCREATORBUG-29075](https://bugreports.qt.io/browse/QTCREATORBUG-29075)) ### Python -* Added an option for the interpreter to the wizards +* Added an option for selecting the interpreter to the wizards in + `File > New Project > Application (Qt for Python)` Debugging --------- -* Improved the UI for enabling and disabling debuggers +* Improved the UI for enabling and disabling debuggers in `Projects > Run > + Debugger settings` ([QTCREATORBUG-28627](https://bugreports.qt.io/browse/QTCREATORBUG-28627)) ### C++ diff --git a/doc/qtcreator/images/icons/home.png b/doc/qtcreator/images/icons/home.png new file mode 100644 index 00000000000..21e7d63a104 Binary files /dev/null and b/doc/qtcreator/images/icons/home.png differ diff --git a/doc/qtcreator/images/icons/info.png b/doc/qtcreator/images/icons/info.png new file mode 100644 index 00000000000..eace805de31 Binary files /dev/null and b/doc/qtcreator/images/icons/info.png differ diff --git a/doc/qtcreator/images/qtcreator-axivion-annotation.webp b/doc/qtcreator/images/qtcreator-axivion-annotation.webp new file mode 100644 index 00000000000..5879a1c19f5 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-axivion-annotation.webp differ diff --git a/doc/qtcreator/images/qtcreator-axivion-view-rule.webp b/doc/qtcreator/images/qtcreator-axivion-view-rule.webp new file mode 100644 index 00000000000..30a5427885f Binary files /dev/null and b/doc/qtcreator/images/qtcreator-axivion-view-rule.webp differ diff --git a/doc/qtcreator/images/qtcreator-axivion-view.webp b/doc/qtcreator/images/qtcreator-axivion-view.webp new file mode 100644 index 00000000000..c9003d5cb48 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-axivion-view.webp differ diff --git a/doc/qtcreator/images/qtcreator-edit-dashboard-configuration.webp b/doc/qtcreator/images/qtcreator-edit-dashboard-configuration.webp new file mode 100644 index 00000000000..3f76b4427a3 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-edit-dashboard-configuration.webp differ diff --git a/doc/qtcreator/images/qtcreator-issues.png b/doc/qtcreator/images/qtcreator-issues.png deleted file mode 100644 index b0bde84e455..00000000000 Binary files a/doc/qtcreator/images/qtcreator-issues.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-issues.webp b/doc/qtcreator/images/qtcreator-issues.webp new file mode 100644 index 00000000000..329a66b29b3 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-issues.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-axivion-project.webp b/doc/qtcreator/images/qtcreator-preferences-axivion-project.webp new file mode 100644 index 00000000000..4656ab1d80d Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-axivion-project.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-axivion.webp b/doc/qtcreator/images/qtcreator-preferences-axivion.webp new file mode 100644 index 00000000000..f884259a54a Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-axivion.webp differ diff --git a/doc/qtcreator/src/analyze/creator-analyze.qdoc b/doc/qtcreator/src/analyze/creator-analyze.qdoc index 4a4e05f413c..f1eb052ea02 100644 --- a/doc/qtcreator/src/analyze/creator-analyze.qdoc +++ b/doc/qtcreator/src/analyze/creator-analyze.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // ********************************************************************** @@ -44,6 +44,11 @@ example, and use the results to make the tests more efficient and complete. + \li \l{Static Code Analysis}{Axivion} + + Do static code analysis and architecture analysis to detect and + eliminate unnecessary complexity of code. + \li \l{Using Valgrind Code Analysis Tools}{Valgrind Code Analysis Tools} Detect problems in memory management by using the Memcheck diff --git a/doc/qtcreator/src/analyze/creator-axivion.qdoc b/doc/qtcreator/src/analyze/creator-axivion.qdoc new file mode 100644 index 00000000000..244991c7834 --- /dev/null +++ b/doc/qtcreator/src/analyze/creator-axivion.qdoc @@ -0,0 +1,109 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \previouspage creator-coco.html + \page creator-axivion.html + \nextpage creator-valgrind-overview.html + + \title Static Code Analysis + + \l{https://www.axivion.com/en/products/axivion-suite/}{Axivion Suite} is + a tool suite for protecting software from erosion. Static code analysis, + architecture analysis, and code-smells-detection enable you to: + + \list + \li Check the source code for potential runtime errors. + \li Use metrics to generate quantitative information about the + internal quality of the source code. + \li Run style checks to achieve compliance with coding guidelines. + \li Detect both duplicates and similar pieces of code in the source code. + \li Recognize cyclical dependencies at different levels. + \li Detect unreachable code. + \endlist + + The experimental Axivion plugin integrates the Axivion dashboard server into + \QC. + + To use the plugin, you must set up a project in the Axivion dashboard + server and link to it from \QC. You can then see style violations in the + \uicontrol Edit mode and descriptions and issue counts in the + \uicontrol Axivion view. + + The editor shows style violations as inline annotations. Hover the mouse over + an annotation to bring up a tool tip with a short description of the issue. + + \image qtcreator-axivion-annotation.webp {Annotation popup} + + Select the \inlineimage icons/info.png + button to view detailed information about the issue in the \uicontrol Axivion + view. + + \image qtcreator-axivion-view-rule.webp {Axivion view} + + To view the issue counts, select \inlineimage icons/home.png + (\uicontrol {Show Dashboard}). + + \section1 Enabling the Axivion Plugin + + To enable the Axivion plugin: + + \list 1 + \li Select \uicontrol Help > \uicontrol {About Plugins} > + \uicontrol {Code Analyzer} > \uicontrol Axivion to enable the plugin. + \li Select \uicontrol {Restart Now} to restart \QC and load the plugin. + \endlist + + \section1 Connecting to Axivion Dashboard Servers + + To connect to Axivion: + + \list 1 + \li Select \uicontrol Edit > \uicontrol Preferences > \uicontrol Axivion. + \image qtcreator-preferences-axivion.webp {General tab in Axivion Preferences} + \li Select \uicontrol Edit to create a connection to the Axivion + dashboard server. + \image qtcreator-edit-dashboard-configuration.webp {Edit Dashboard Configuration dialog} + \li In \uicontrol {Dashboard URL}, enter the URL of the server. + \li In \uicontrol Description, enter a free-text description of the + server. + \li In \uicontrol {Access token}, enter the IDE application token that + you created in the server, in user preferences. + \endlist + + \section1 Linking to Dashboards + + To link a project to a dashboard: + + \list 1 + \li \uicontrol Projects > \uicontrol {Project Settings} > + \uicontrol Axivion. + \image qtcreator-preferences-axivion-project.webp {Axivion settings in Project Settings} + \li Select \uicontrol {Fetch Projects} to list projects from Axivion. + \li Select a project, and then select \uicontrol {Link Project} to link + to it. + \endlist + + To unlink a project, select \uicontrol {Unlink Project}. + + \section1 Viewing Issue Counts + + \image qtcreator-axivion-view.webp {Axivion view} + + The \uicontrol Axivion view lists the numbers of the following types of + issues that Axivion found in the linked project: + + \list + \li \uicontrol AV - architecture violations, such as hidden dependencies + \li \uicontrol CL - duplicates and similar pieces of code + \li \uicontrol CY - call, component, and include cycles + \li \uicontrol DE - dead code + \li \uicontrol MV - violations of metrics based on lines and tokens, + nesting, cyclomatic complexity, control flow, and so on. + \li \uicontrol SV - style violations, such as deviations from the naming + or coding conventions + \endlist + + To clear the view, select \inlineimage icons/clean_pane_small.png + (\uicontrol Clear). +*/ diff --git a/doc/qtcreator/src/analyze/creator-coco.qdoc b/doc/qtcreator/src/analyze/creator-coco.qdoc index 3a714d9bc08..0818e9a5b92 100644 --- a/doc/qtcreator/src/analyze/creator-coco.qdoc +++ b/doc/qtcreator/src/analyze/creator-coco.qdoc @@ -4,7 +4,7 @@ /*! \previouspage creator-qml-performance-monitor.html \page creator-coco.html - \nextpage creator-valgrind-overview.html + \nextpage creator-axivion.html \title Checking Code Coverage diff --git a/doc/qtcreator/src/analyze/creator-valgrind-overview.qdoc b/doc/qtcreator/src/analyze/creator-valgrind-overview.qdoc index 96b1195f3e6..9a2f914648f 100644 --- a/doc/qtcreator/src/analyze/creator-valgrind-overview.qdoc +++ b/doc/qtcreator/src/analyze/creator-valgrind-overview.qdoc @@ -8,7 +8,7 @@ // ********************************************************************** /*! - \previouspage creator-coco.html + \previouspage creator-axivion.html \page creator-valgrind-overview.html \nextpage creator-analyzer.html diff --git a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc index f81a54551bc..d9809f09a38 100644 --- a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc +++ b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc @@ -190,6 +190,10 @@ If you use custom API, \QC uses \c {target_sources()} to add the files. + For Qt Quick projects, the files are added to the \c {qt_add_qml_module()} + function, prefixed with the \c QML_FILES, \c SOURCES, or \c RESOURCES + function argument. + When you rename or remove files in the \l {Projects} or \l {File System} view, \QC renames them in the CMakeLists.txt file or removes them from it. diff --git a/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc b/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc index 7634b9ce395..96c63abfd1d 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-cli.qdoc @@ -8,7 +8,7 @@ // ********************************************************************** /*! - \previouspage creator-project-vcpkg.html + \previouspage creator-vcpkg.html \page creator-cli.html \nextpage creator-keyboard-shortcuts.html diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index e1efb659240..9b0cd51c993 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -205,6 +205,7 @@ \list \li \l{Profiling QML Applications} \li \l{Checking Code Coverage} + \li \l{Static Code Analysis} \li \l{Using Valgrind Code Analysis Tools} \list \li \l{Detecting Memory Leaks with Memcheck} diff --git a/doc/qtcreator/src/user-interface/creator-ui.qdoc b/doc/qtcreator/src/user-interface/creator-ui.qdoc index 031e15cedbc..f5e59218f46 100644 --- a/doc/qtcreator/src/user-interface/creator-ui.qdoc +++ b/doc/qtcreator/src/user-interface/creator-ui.qdoc @@ -392,6 +392,10 @@ \li \uicontrol{General Messages} + \if defined(qtcreator) + \li \l {Static Code Analysis}{Axivion} + \endif + \li \uicontrol{Version Control} \if defined(qtcreator) @@ -476,6 +480,9 @@ \list \if defined(qtdesignstudio) + \li \uicontrol {Asset Export} - Errors and warnings encountered + while exporting assets. + \li \uicontrol {Asset Importer Error} - Errors and warnings encountered while importing assets from a design tool. \else @@ -490,6 +497,8 @@ \li \uicontrol {Clang Code Model} - \l {Parsing C++ Files with the Clang Code Model} {Errors and warnings from the current editor}. + \li \uicontrol {Clang Tools} - Errors and warnings from + \l {Using Clang Tools}{Clang-Tidy and Clazy} \endif \li \uicontrol Compile - Selected output from the compiler. Open @@ -521,14 +530,19 @@ \l{JavaScript and QML Error Codes} {QML and JavaScript syntax errors}. + \if defined(qtcreator) + \li \uicontrol Sanitizer - Tasks created when you run an application if + you used an \e {address sanitizer} to detect memory handling issues. + \endif \endlist The view filters out irrelevant output from the build tools and presents the issues in an organized way. To further filter the output by type, select \inlineimage icons/filtericon.png - (\uicontrol {Filter Tree}) and then select a filter. + (\uicontrol {Filter Tree}) and then select a filter. To find output in the + view, enter search criteria in the \uicontrol Filter field. - \image qtcreator-issues.png "Issues" + \image qtcreator-issues.webp {Issues} Select one or several lines to apply context-menu actions to their contents. You can remove the selected lines or copy their contents to the clipboard. @@ -536,15 +550,20 @@ contents of the line as search criteria or open a version control annotation view of the line that causes the error message. + To view detailed information about the selected line (where available), press + \key Space. + To navigate to the corresponding source code, click an issue or select \uicontrol {Show in Editor} in the context menu. The entry must contain the name of the file where the issue was found. To view more information about an issue in \l {Compile Output}, - select \uicontrol {Show Output} in the context menu. + select \uicontrol {Show Compile Output} in the context menu. - To jump from one issue to the next or previous one, press \key F6 and - \key Shift+F6. + To jump from one issue to the next or previous + one, select \inlineimage icons/arrowup.png + and \inlineimage icons/arrowdown.png + or press \key F6 and \key Shift+F6. By default, a new build clears the \uicontrol Issues view. To keep the issues from the previous build rounds, deselect \uicontrol Edit > diff --git a/doc/qtcreatordev/src/qtcreator-module.qdoc b/doc/qtcreatordev/src/qtcreator-module.qdoc index 18a56103353..a86699733ab 100644 --- a/doc/qtcreatordev/src/qtcreator-module.qdoc +++ b/doc/qtcreatordev/src/qtcreator-module.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! @@ -109,12 +109,29 @@ \endomit \endtable + \section1 Solutions + + \QC uses object libraries that are independent of any \QC-specific code, and + are threfore ready to be a part of Qt. + + \table + \header + \li Solution Name + \li Description + + \row + \li \l{Tasking Solution}{Tasking} + \li Enables you to build extensible, declarative task tree structures + that contain possibly asynchronous tasks. + \endtable + \section1 Reference \list \li \l {Qt Creator C++ Classes} \li \l {Qt Creator Namespaces} \li \l {Qt Creator Functions} + \li \l {Solutions} \endlist */ diff --git a/doc/qtcreatordev/src/solutions-index.qdoc b/doc/qtcreatordev/src/solutions-index.qdoc new file mode 100644 index 00000000000..1eb4135b890 --- /dev/null +++ b/doc/qtcreatordev/src/solutions-index.qdoc @@ -0,0 +1,12 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +/*! + \page solutions-index.html + \title Solutions + \brief A collection of reusable object libraries. + + This topic lists the available solutions: + + \annotatedlist solutions-modules +*/ diff --git a/src/app/main.cpp b/src/app/main.cpp index 9e1e7458803..08d45e3544e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -495,6 +495,10 @@ int main(int argc, char **argv) Options options = parseCommandLine(argc, argv); applicationDirPath(argv[0]); + const bool hasStyleOption = Utils::findOrDefault(options.appArguments, [](char *arg) { + return strcmp(arg, "-style") == 0; + }); + if (qEnvironmentVariableIsSet("QTC_DO_NOT_PROPAGATE_LD_PRELOAD")) { Utils::Environment::modifySystemEnvironment( {{"LD_PRELOAD", "", Utils::EnvironmentItem::Unset}}); @@ -607,10 +611,8 @@ int main(int argc, char **argv) setPixmapCacheLimit(); loadFonts(); - if (Utils::HostOsInfo::isWindowsHost() - && !qFuzzyCompare(qApp->devicePixelRatio(), 1.0) - && QApplication::style()->objectName().startsWith( - QLatin1String("windows"), Qt::CaseInsensitive)) { + if (Utils::HostOsInfo::isWindowsHost() && !qFuzzyCompare(qApp->devicePixelRatio(), 1.0) + && !hasStyleOption) { QApplication::setStyle(QLatin1String("fusion")); } const int threadCount = QThreadPool::globalInstance()->maxThreadCount(); diff --git a/src/libs/solutions/README.md b/src/libs/solutions/README.md index ab4cc9727d3..4fd7234a286 100644 --- a/src/libs/solutions/README.md +++ b/src/libs/solutions/README.md @@ -46,3 +46,23 @@ integrated into Qt when they: - Have full docs. - Have auto tests. - Have at least one example (however, autotests often play this role, too). + +## Documentation + +The common Solutions doc (doc/qtcreatordev/src/solutions-index.qdoc) +lists all the solutions added to the solutions-modules group. +In order to gather all the available solutions in this common page, +define the module and refer to it like: + +/*! + \module TaskingSolution + \title The Tasking Solution + \ingroup solutions-modules + \brief (... add a brief description here...) +*/ + +The \ingroup will put the item above to the common Solutions page. +Don't add more \ingroup references from class docs, add \inmodule instead. + + + diff --git a/src/libs/solutions/tasking/tasktree.cpp b/src/libs/solutions/tasking/tasktree.cpp index c28e7b0e6aa..985343ab517 100644 --- a/src/libs/solutions/tasking/tasktree.cpp +++ b/src/libs/solutions/tasking/tasktree.cpp @@ -42,11 +42,25 @@ private: Guard &m_guard; }; +/*! + \module TaskingSolution + \title Tasking Solution + \ingroup solutions-modules + \brief Contains a general purpose Tasking solution. + + The Tasking solution depends on Qt only, and doesn't depend on any \QC specific code. +*/ + +/*! + \namespace Tasking + \inmodule TaskingSolution + \brief The Tasking namespace encloses all classes and global functions of the Tasking solution. +*/ + /*! \class Tasking::GroupItem \inheaderfile solutions/tasking/tasktree.h - \inmodule QtCreator - \ingroup mainclasses + \inmodule TaskingSolution \brief The GroupItem class represents the basic element for composing nested tree structures. */ @@ -1104,22 +1118,11 @@ void TaskNode::invokeEndHandler(bool success) m_container.m_constData.m_taskTreePrivate->advanceProgress(1); } -/*! - \namespace Tasking - \inmodule QtCreator - \brief The Tasking namespace contains a general purpose TaskTree solution. - - The Tasking namespace depends on Qt only, and doesn't depend on any \QC - specific code. -*/ - /*! \class Tasking::TaskTree \inheaderfile solutions/tasking/tasktree.h - \inmodule QtCreator - \ingroup mainclasses - \brief The TaskTree class runs an async task tree structure defined in a - declarative way. + \inmodule TaskingSolution + \brief The TaskTree class runs an async task tree structure defined in a declarative way. Use the Tasking namespace to build extensible, declarative task tree structures that contain possibly asynchronous tasks, such as Process, diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp index 0054b60bd27..fc69451c9c0 100644 --- a/src/libs/utils/terminalinterface.cpp +++ b/src/libs/utils/terminalinterface.cpp @@ -392,16 +392,8 @@ void TerminalInterface::start() m_setup.m_commandLine.executable().fileName()); if (m_setup.m_runAsRoot && !HostOsInfo::isWindowsHost()) { - CommandLine rootCommand(FilePath("sudo").searchInPath(), {"-A"}); + CommandLine rootCommand("sudo", {}); rootCommand.addCommandLineAsArgs(cmd); - - const FilePath askPassPath = FilePath::fromUserInput(QCoreApplication::applicationDirPath()) - .pathAppended(QLatin1String(RELATIVE_LIBEXEC_PATH)) - .pathAppended(QLatin1String("qtc-askpass")); - - if (askPassPath.exists()) - stubSetupData.m_environment.setFallback("SUDO_ASKPASS", askPassPath.toUserOutput()); - stubSetupData.m_commandLine = rootCommand; } else { stubSetupData.m_commandLine = cmd; diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index a410881bacc..ed80137e4bf 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -2058,7 +2058,10 @@ void CMakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const Environment CMakeBuildConfiguration::configureEnvironment() const { - return aspect()->environment(); + Environment env = aspect()->environment(); + addToEnvironment(env); + + return env; } QString CMakeBuildSystem::cmakeBuildType() const diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 68f42127a21..783468422dd 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -194,7 +194,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) : m_useStaging = addAspect(); m_useStaging->setSettingsKey(USE_STAGING_KEY); - m_useStaging->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBox); + m_useStaging->setLabel(Tr::tr("Stage for installation"), BoolAspect::LabelPlacement::AtCheckBox); m_useStaging->setDefaultValue(!buildAndRunOnSameDevice(kit())); m_stagingDir = addAspect(); @@ -503,8 +503,10 @@ QWidget *CMakeBuildStep::createConfigWidget() m_stagingDir->setEnabled(m_useStaging->value()); if (m_useStaging->value()) { - summaryText.append(" " + Tr::tr("and stage at %2 for %3") - .arg(currentStagingDir(), currentInstallPrefix())); + //: Stage (for installation) at for + summaryText.append( + "; " + + Tr::tr("Stage at %2 for %3").arg(currentStagingDir(), currentInstallPrefix())); } if (!m_buildPreset.isEmpty()) { @@ -567,7 +569,8 @@ QWidget *CMakeBuildStep::createConfigWidget() Layouting::Form builder; builder.addRow({m_cmakeArguments}); builder.addRow({m_toolArguments}); - builder.addRow({Tr::tr("Stage for installation:"), Layouting::Row{m_useStaging, m_stagingDir}}); + builder.addRow({m_useStaging}); + builder.addRow({m_stagingDir}); if (m_useiOSAutomaticProvisioningUpdates) builder.addRow({m_useiOSAutomaticProvisioningUpdates}); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index c43c7978a61..96d54518c33 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -233,18 +233,18 @@ void CMakeManager::reloadCMakePresets() { auto settings = CMakeSpecificSettings::instance(); - QMessageBox::StandardButton clickedButton - = CheckableMessageBox::question(Core::ICore::dialogParent(), - Tr::tr("Reload CMake Presets"), - Tr::tr("Re-generates the CMake presets kits. The manual " - "CMake project modifications will be lost."), - settings->askBeforePresetsReload.checkableDecider(), - QMessageBox::Yes | QMessageBox::Cancel, - QMessageBox::Yes, - QMessageBox::Yes, - { - {QMessageBox::Yes, Tr::tr("Reload")}, - }); + QMessageBox::StandardButton clickedButton = CheckableMessageBox::question( + Core::ICore::dialogParent(), + Tr::tr("Reload CMake Presets"), + Tr::tr("Re-generates the kits that were created for CMake presets. All manual " + "modifications to the CMake project settings will be lost."), + settings->askBeforePresetsReload.checkableDecider(), + QMessageBox::Yes | QMessageBox::Cancel, + QMessageBox::Yes, + QMessageBox::Yes, + { + {QMessageBox::Yes, Tr::tr("Reload")}, + }); if (clickedButton == QMessageBox::Cancel) return; diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index f5ef94efdee..656173feee2 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -621,8 +621,9 @@ void CppHighlighterTest::test() const QChar c = m_doc.characterAt(pos); if (c == QChar::ParagraphSeparator) continue; - const QTextCharFormat expectedFormat = c.isSpace() - ? whitespacified(formatForStyle) : formatForStyle; + const QTextCharFormat expectedFormat = asSyntaxHighlight( + c.isSpace() ? whitespacified(formatForStyle) : formatForStyle); + const QTextCharFormat actualFormat = getActualFormat(pos); if (actualFormat != expectedFormat) { int posLine; diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index f57670c1611..a3a8111ee8f 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -4055,6 +4055,20 @@ void QuickfixTest::testInsertMemberFromUse_data() "};\n"; QTest::addRow("add member function to this (implicit)") << original << expected; + original = + "class C {\n" + "public:\n" + " int value() const { return @valueInternal(); }\n" + "};\n"; + expected = + "class C {\n" + "public:\n" + " int value() const { return valueInternal(); }\n" + "private:\n" + " int valueInternal() const;\n" + "};\n"; + QTest::addRow("add const member function to this (implicit)") << original << expected; + original = "class C {\n" "public:\n" diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 85489b877e7..a7134169d62 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -311,7 +311,7 @@ QString nameString(const NameAST *name) // FIXME: Needs to consider the scope at the insertion site. QString declFromExpr(const TypeOrExpr &typeOrExpr, const CallAST *call, const NameAST *varName, const Snapshot &snapshot, const LookupContext &context, - const CppRefactoringFilePtr &file) + const CppRefactoringFilePtr &file, bool makeConst) { const auto getTypeFromUser = [varName, call]() -> QString { if (call) @@ -353,6 +353,7 @@ QString declFromExpr(const TypeOrExpr &typeOrExpr, const CallAST *call, const Na return type.isValid() ? oo.prettyType(type, varName->name) : getTypeFromUser(); Function func(file->cppDocument()->translationUnit(), 0, varName->name); + func.setConst(makeConst); for (ExpressionListAST *it = call->expression_list; it; it = it->next) { Argument * const arg = new Argument(nullptr, 0, nullptr); arg->setType(getTypeOfExpr(it->value)); @@ -1671,7 +1672,7 @@ private: if (currentFile->cppDocument()->languageFeatures().cxx11Enabled && settings->useAuto) return "auto " + oo.prettyName(simpleNameAST->name); return declFromExpr(binaryAST->right_expression, nullptr, simpleNameAST, snapshot(), - context(), currentFile); + context(), currentFile, false); } const BinaryExpressionAST *binaryAST; @@ -2939,10 +2940,11 @@ public: const TypeOrExpr &typeOrExpr, const CallAST *call, InsertionPointLocator::AccessSpec accessSpec, - bool makeStatic) + bool makeStatic, + bool makeConst) : CppQuickFixOperation(interface), m_class(theClass), m_memberName(memberName), m_typeOrExpr(typeOrExpr), m_call(call), - m_accessSpec(accessSpec), m_makeStatic(makeStatic) + m_accessSpec(accessSpec), m_makeStatic(makeStatic), m_makeConst(makeConst) { if (call) setDescription(Tr::tr("Add Member Function \"%1\"").arg(nameString(memberName))); @@ -2954,7 +2956,7 @@ private: void perform() override { QString decl = declFromExpr(m_typeOrExpr, m_call, m_memberName, snapshot(), context(), - currentFile()); + currentFile(), m_makeConst); if (decl.isEmpty()) return; if (m_makeStatic) @@ -2983,6 +2985,7 @@ private: const CallAST * m_call; const InsertionPointLocator::AccessSpec m_accessSpec; const bool m_makeStatic; + const bool m_makeConst; }; void AddDeclarationForUndeclaredIdentifier::match(const CppQuickFixInterface &interface, @@ -3198,7 +3201,7 @@ bool AddDeclarationForUndeclaredIdentifier::checkForMemberInitializer( result << new InsertMemberFromInitializationOp( interface, theClass, memInitializer->name->asSimpleName(), memInitializer->expression, - nullptr, InsertionPointLocator::Private, false); + nullptr, InsertionPointLocator::Private, false, false); return false; } @@ -3268,7 +3271,8 @@ void AddDeclarationForUndeclaredIdentifier::maybeAddMember( } } result << new InsertMemberFromInitializationOp(interface, theClass, path.last()->asName(), - typeOrExpr, call, accessSpec, needsStatic); + typeOrExpr, call, accessSpec, needsStatic, + func->symbol->isConst()); } void AddDeclarationForUndeclaredIdentifier::maybeAddStaticMember( @@ -3311,7 +3315,7 @@ void AddDeclarationForUndeclaredIdentifier::maybeAddStaticMember( if (theClass) { result << new InsertMemberFromInitializationOp( interface, theClass, path.last()->asName(), typeOrExpr, call, - InsertionPointLocator::Public, true); + InsertionPointLocator::Public, true, false); } } diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 783fa9b9f17..cc6baf32d28 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -157,6 +157,7 @@ public: Utils::FilePath debugInfoLocation; // Gdb "set-debug-file-directory". QStringList debugSourceLocation; // Gdb "directory" QString qtPackageSourceLocation; + Utils::FilePath qtSourceLocation; bool isSnapshot = false; // Set if created internally. ProjectExplorer::Abi toolChainAbi; diff --git a/src/plugins/debugger/debuggerruncontrol.cpp b/src/plugins/debugger/debuggerruncontrol.cpp index e3feb04e393..ed4a34f3067 100644 --- a/src/plugins/debugger/debuggerruncontrol.cpp +++ b/src/plugins/debugger/debuggerruncontrol.cpp @@ -863,8 +863,10 @@ DebuggerRunTool::DebuggerRunTool(RunControl *runControl, AllowTerminal allowTerm m_runParameters.debugger = DebuggerKitAspect::runnable(kit); m_runParameters.cppEngineType = DebuggerKitAspect::engineType(kit); - if (QtSupport::QtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit)) + if (QtSupport::QtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit)) { m_runParameters.qtPackageSourceLocation = qtVersion->qtPackageSourcePath().toString(); + m_runParameters.qtSourceLocation = qtVersion->sourcePath(); + } if (auto aspect = runControl->aspect()) { if (!aspect->useCppDebugger) diff --git a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp index 9d3af533bcc..0c98ba174b0 100644 --- a/src/plugins/debugger/debuggersourcepathmappingwidget.cpp +++ b/src/plugins/debugger/debuggersourcepathmappingwidget.cpp @@ -415,47 +415,18 @@ void DebuggerSourcePathMappingWidget::slotEditTargetFieldChanged() } } -// Find Qt installation by running qmake -static QString findQtInstallPath(const FilePath &qmakePath) -{ - if (qmakePath.isEmpty()) - return QString(); - Process proc; - proc.setCommand({qmakePath, {"-query", "QT_INSTALL_HEADERS"}}); - proc.start(); - if (!proc.waitForFinished()) { - qWarning("%s: Timeout running '%s'.", Q_FUNC_INFO, qPrintable(qmakePath.toString())); - return QString(); - } - if (proc.exitStatus() != QProcess::NormalExit) { - qWarning("%s: '%s' crashed.", Q_FUNC_INFO, qPrintable(qmakePath.toString())); - return QString(); - } - const QByteArray ba = proc.readAllRawStandardOutput().trimmed(); - QDir dir(QString::fromLocal8Bit(ba)); - if (dir.exists() && dir.cdUp()) - return dir.absolutePath(); - return QString(); -} - /* Merge settings for an installed Qt (unless another setting is already in the map. */ SourcePathMap mergePlatformQtPath(const DebuggerRunParameters &sp, const SourcePathMap &in) { - const FilePath qmake = BuildableHelperLibrary::findSystemQt(sp.inferior.environment); - // FIXME: Get this from the profile? - // We could query the QtVersion for this information directly, but then we - // will need to add a dependency on QtSupport to the debugger. - // - // The profile could also get a function to extract the required information from - // its information to avoid this dependency (as we do for the environment). - const QString qtInstallPath = findQtInstallPath(qmake); - if (qtInstallPath.isEmpty()) + static const QString qglobal = "qtbase/src/corelib/global/qglobal.h"; + const FilePath sourceLocation = sp.qtSourceLocation; + if (!(sourceLocation / qglobal).exists()) return in; SourcePathMap rc = in; for (const QString &buildPath : qtBuildPaths()) { if (!rc.contains(buildPath)) // Do not overwrite user settings. - rc.insert(buildPath, qtInstallPath + "/../Src"); + rc.insert(buildPath, sourceLocation.path()); } return rc; } diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp index 9ae93c0bbf0..a8e691d6de0 100644 --- a/src/plugins/projectexplorer/taskwindow.cpp +++ b/src/plugins/projectexplorer/taskwindow.cpp @@ -435,6 +435,8 @@ void TaskWindow::triggerDefaultHandler(const QModelIndex &index) QModelIndex taskIndex = index; if (index.parent().isValid()) taskIndex = index.parent(); + if (taskIndex.column() == 1) + taskIndex = taskIndex.siblingAtColumn(0); Task task(d->m_filter->task(taskIndex)); if (task.isNull()) return; diff --git a/src/plugins/qbsprojectmanager/qbssettings.cpp b/src/plugins/qbsprojectmanager/qbssettings.cpp index 58c9b96c698..409ebcd88b0 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.cpp +++ b/src/plugins/qbsprojectmanager/qbssettings.cpp @@ -13,11 +13,13 @@ #include #include #include +#include #include #include #include #include +#include using namespace Utils; @@ -52,12 +54,17 @@ static bool operator!=(const QbsSettingsData &s1, const QbsSettingsData &s2) FilePath QbsSettings::qbsExecutableFilePath() { - const QString fileName = HostOsInfo::withExecutableSuffix("qbs"); FilePath candidate = instance().m_settings.qbsExecutableFilePath; - if (!candidate.exists()) { - candidate = FilePath::fromString(QCoreApplication::applicationDirPath()) - .pathAppended(fileName); - } + if (!candidate.exists()) + candidate = defaultQbsExecutableFilePath(); + return candidate; +} + +FilePath QbsSettings::defaultQbsExecutableFilePath() +{ + const QString fileName = HostOsInfo::withExecutableSuffix("qbs"); + FilePath candidate = FilePath::fromString(QCoreApplication::applicationDirPath()) + .pathAppended(fileName); if (!candidate.exists()) candidate = Environment::systemEnvironment().searchInPath(fileName); return candidate; @@ -136,7 +143,8 @@ void QbsSettings::loadSettings() void QbsSettings::storeSettings() const { QSettings * const s = Core::ICore::settings(); - s->setValue(QBS_EXE_KEY, m_settings.qbsExecutableFilePath.toString()); + QtcSettings::setValueWithDefault(s, QBS_EXE_KEY, m_settings.qbsExecutableFilePath.toString(), + defaultQbsExecutableFilePath().toString()); s->setValue(QBS_DEFAULT_INSTALL_DIR_KEY, m_settings.defaultInstallDirTemplate); s->setValue(USE_CREATOR_SETTINGS_KEY, m_settings.useCreatorSettings); } @@ -148,6 +156,7 @@ public: { m_qbsExePathChooser.setExpectedKind(PathChooser::ExistingCommand); m_qbsExePathChooser.setFilePath(QbsSettings::qbsExecutableFilePath()); + m_resetQbsExeButton.setText(Tr::tr("Reset")); m_defaultInstallDirLineEdit.setText(QbsSettings::defaultInstallDirTemplate()); m_versionLabel.setText(getQbsVersionString()); //: %1 == "Qt Creator" or "Qt Design Studio" @@ -157,13 +166,19 @@ public: const auto layout = new QFormLayout(this); layout->addRow(&m_settingsDirCheckBox); - layout->addRow(Tr::tr("Path to qbs executable:"), &m_qbsExePathChooser); + const auto qbsExeLayout = new QHBoxLayout; + qbsExeLayout->addWidget(&m_qbsExePathChooser); + qbsExeLayout->addWidget(&m_resetQbsExeButton); + layout->addRow(Tr::tr("Path to qbs executable:"), qbsExeLayout); layout->addRow(Tr::tr("Default installation directory:"), &m_defaultInstallDirLineEdit); layout->addRow(Tr::tr("Qbs version:"), &m_versionLabel); connect(&m_qbsExePathChooser, &PathChooser::textChanged, [this] { m_versionLabel.setText(getQbsVersionString()); }); + connect(&m_resetQbsExeButton, &QPushButton::clicked, [this] { + m_qbsExePathChooser.setFilePath(QbsSettings::defaultQbsExecutableFilePath()); + }); } void apply() final @@ -185,6 +200,7 @@ private: } PathChooser m_qbsExePathChooser; + QPushButton m_resetQbsExeButton; QLabel m_versionLabel; QCheckBox m_settingsDirCheckBox; FancyLineEdit m_defaultInstallDirLineEdit; diff --git a/src/plugins/qbsprojectmanager/qbssettings.h b/src/plugins/qbsprojectmanager/qbssettings.h index a91a9059653..434a9af34f3 100644 --- a/src/plugins/qbsprojectmanager/qbssettings.h +++ b/src/plugins/qbsprojectmanager/qbssettings.h @@ -27,6 +27,7 @@ public: static QbsSettings &instance(); static Utils::FilePath qbsExecutableFilePath(); + static Utils::FilePath defaultQbsExecutableFilePath(); static Utils::FilePath qbsConfigFilePath(); static bool hasQbsExecutable(); static QString defaultInstallDirTemplate(); diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index fdc2bb41d71..08bde98beff 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -1129,13 +1129,8 @@ extend_qtc_plugin(componentsplugin extend_qtc_plugin(componentsplugin SOURCES_PREFIX componentsplugin SOURCES - addtabdesigneraction.cpp addtabdesigneraction.h - addtabtotabviewdialog.cpp addtabtotabviewdialog.h - addtabtotabviewdialog.ui componentsplugin.cpp componentsplugin.h componentsplugin.qrc - entertabdesigneraction.cpp entertabdesigneraction.h - tabviewindexmodel.cpp tabviewindexmodel.h ) add_qtc_plugin(qmlpreviewplugin diff --git a/src/plugins/qmldesigner/components/formeditor/rotationindicator.cpp b/src/plugins/qmldesigner/components/formeditor/rotationindicator.cpp index d2c4e90da98..810f14d8248 100644 --- a/src/plugins/qmldesigner/components/formeditor/rotationindicator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/rotationindicator.cpp @@ -42,9 +42,6 @@ namespace { bool itemIsResizable(const ModelNode &modelNode) { - if (modelNode.metaInfo().isQtQuickControlsTab()) - return false; - return NodeHints::fromModelNode(modelNode).isResizable(); } diff --git a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp b/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp deleted file mode 100644 index f10b9c6b7cc..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "addtabdesigneraction.h" -#include "addtabtotabviewdialog.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -namespace QmlDesigner { - -bool isTabView(const ModelNode &modelNode) -{ - return modelNode.metaInfo().isQtQuickControlsTabView(); -} - -bool isTabAndParentIsTabView(const ModelNode &modelNode) -{ - return modelNode.metaInfo().isQtQuickControlsTab() && modelNode.hasParentProperty() - && modelNode.parentProperty().parentModelNode().metaInfo().isQtQuickControlsTabView(); -} - -AddTabDesignerAction::AddTabDesignerAction() - : AbstractAction(QCoreApplication::translate("TabViewToolAction","Add Tab...")) -{ - connect(action(), &QAction::triggered, this, &AddTabDesignerAction::addNewTab); -} - -QByteArray AddTabDesignerAction::category() const -{ - return QByteArray(); -} - -QByteArray AddTabDesignerAction::menuId() const -{ - return "TabViewAction"; -} - -int AddTabDesignerAction::priority() const -{ - return CustomActionsPriority; -} - -ActionInterface::Type AddTabDesignerAction::type() const -{ - return ContextMenuAction; -} - -bool AddTabDesignerAction::isVisible(const SelectionContext &selectionContext) const -{ - if (selectionContext.singleNodeIsSelected()) { - ModelNode selectedModelNode = selectionContext.currentSingleSelectedNode(); - return isTabView(selectedModelNode) || isTabAndParentIsTabView(selectedModelNode); - } - - return false; -} - -bool AddTabDesignerAction::isEnabled(const SelectionContext &selectionContext) const -{ - return isVisible(selectionContext); -} - -static ModelNode findTabViewModelNode(const ModelNode ¤tModelNode) -{ - if (currentModelNode.metaInfo().isQtQuickControlsTabView()) - return currentModelNode; - else - return findTabViewModelNode(currentModelNode.parentProperty().parentModelNode()); -} - -void AddTabDesignerAction::addNewTab() -{ - QString tabName = AddTabToTabViewDialog::create(QStringLiteral("Tab"), - Core::ICore::dialogParent()); - - if (!tabName.isEmpty()) { - QString directoryPath = QFileInfo(selectionContext().view()->model()->fileUrl().toLocalFile()).absolutePath(); - QString newFilePath = directoryPath +QStringLiteral("/") + tabName + QStringLiteral(".qml"); - - if (QFileInfo::exists(newFilePath)) { - Core::AsynchronousMessageBox::warning(tr("Naming Error"), tr("Component already exists.")); - } else { - const QString sourceString = QStringLiteral("import QtQuick 2.1\nimport QtQuick.Controls 1.0\n\nItem {\n anchors.fill: parent\n}"); - bool fileCreated = DocumentManager::createFile(newFilePath, sourceString); - - if (fileCreated) { - DocumentManager::addFileToVersionControl(directoryPath, newFilePath); - - ModelNode tabViewModelNode = findTabViewModelNode(selectionContext().currentSingleSelectedNode()); - - PropertyListType propertyList; - propertyList.append(QPair("source", QString(tabName + QStringLiteral(".qml")))); - propertyList.append(QPair("title", tabName)); - - ModelNode newTabModelNode = selectionContext().view()->createModelNode("QtQuick.Controls.Tab", - tabViewModelNode.majorVersion(), - tabViewModelNode.minorVersion(), - propertyList); - newTabModelNode.setIdWithRefactoring(newTabModelNode.model()->generateNewId(tabName)); - tabViewModelNode.defaultNodeAbstractProperty().reparentHere(newTabModelNode); - } - } - } -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.h b/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.h deleted file mode 100644 index 1a65c8503df..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/addtabdesigneraction.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include "abstractaction.h" - -namespace QmlDesigner { - -class AddTabDesignerAction : public QObject, public AbstractAction -{ - Q_OBJECT -public: - AddTabDesignerAction(); - - QByteArray category() const override; - QByteArray menuId() const override; - int priority() const override; - Type type() const override; - -protected: - bool isVisible(const SelectionContext &selectionContext) const override; - bool isEnabled(const SelectionContext &selectionContext) const override; - -private: - void addNewTab(); -}; - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.cpp b/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.cpp deleted file mode 100644 index fe50799416c..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "addtabtotabviewdialog.h" -#include "ui_addtabtotabviewdialog.h" - -namespace QmlDesigner { - -AddTabToTabViewDialog::AddTabToTabViewDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AddTabToTabViewDialog) -{ - ui->setupUi(this); - ui->addTabLineEdit->setForceFirstCapitalLetter(true); -} - -AddTabToTabViewDialog::~AddTabToTabViewDialog() -{ - delete ui; -} - - -QString AddTabToTabViewDialog::create(const QString &tabName, QWidget *parent) -{ - AddTabToTabViewDialog addTabToTabViewDialog(parent); - - Utils::FileNameValidatingLineEdit *fileNameValidatingLineEdit = addTabToTabViewDialog.ui->addTabLineEdit; - - fileNameValidatingLineEdit->setText(tabName); - - int result = addTabToTabViewDialog.exec(); - - if (result == QDialog::Accepted && fileNameValidatingLineEdit->isValid()) - return fileNameValidatingLineEdit->text(); - else - return QString(); -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.h b/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.h deleted file mode 100644 index 9bb9eed8b7e..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace QmlDesigner { -namespace Ui { class AddTabToTabViewDialog; } - -class AddTabToTabViewDialog : public QDialog -{ - Q_OBJECT - -public: - explicit AddTabToTabViewDialog(QWidget *parent = nullptr); - ~AddTabToTabViewDialog() override; - - static QString create(const QString &tabName, QWidget *parent); - -private: - Ui::AddTabToTabViewDialog *ui; -}; - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.ui b/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.ui deleted file mode 100644 index dff9e50e55c..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/addtabtotabviewdialog.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - QmlDesigner::AddTabToTabViewDialog - - - - 0 - 0 - 362 - 80 - - - - Dialog - - - - - - - - Add tab: - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - Utils::FileNameValidatingLineEdit - QLineEdit -
utils/filenamevalidatinglineedit.h
-
-
- - - - buttonBox - accepted() - QmlDesigner::AddTabToTabViewDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - QmlDesigner::AddTabToTabViewDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -
diff --git a/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp b/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp index 481a9ea7615..6c5ff54b74b 100644 --- a/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp +++ b/src/plugins/qmldesigner/componentsplugin/componentsplugin.cpp @@ -3,22 +3,12 @@ #include "componentsplugin.h" -#include "tabviewindexmodel.h" -#include "addtabdesigneraction.h" -#include "entertabdesigneraction.h" - -#include -#include #include namespace QmlDesigner { ComponentsPlugin::ComponentsPlugin() { - TabViewIndexModel::registerDeclarativeType(); - DesignerActionManager *actionManager = &QmlDesignerPlugin::instance()->viewManager().designerActionManager(); - actionManager->addDesignerAction(new AddTabDesignerAction); - actionManager->addDesignerAction(new EnterTabDesignerAction); } QString ComponentsPlugin::pluginName() const diff --git a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp b/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp deleted file mode 100644 index b04ee5f7c78..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "entertabdesigneraction.h" - -#include -#include -#include -#include -#include -#include - -#include - -namespace QmlDesigner { - -class EnterTabAction : public DefaultAction -{ - -public: - EnterTabAction(const QString &description) - : DefaultAction(description) - { } - -public: - void actionTriggered(bool) override - { - DocumentManager::goIntoComponent(m_selectionContext.targetNode()); - } -}; - -EnterTabDesignerAction::EnterTabDesignerAction() - : AbstractActionGroup(QCoreApplication::translate("TabViewToolAction", "Step into Tab")) -{ -} - -QByteArray EnterTabDesignerAction::category() const -{ - return QByteArray(); -} - -QByteArray EnterTabDesignerAction::menuId() const -{ - return "TabViewAction"; -} - -int EnterTabDesignerAction::priority() const -{ - //Editing tabs is above adding tabs - return CustomActionsPriority + 10; -} - -void EnterTabDesignerAction::updateContext() -{ - menu()->clear(); - if (selectionContext().isValid()) { - - action()->setEnabled(isEnabled(selectionContext())); - action()->setVisible(isVisible(selectionContext())); - - if (action()->isEnabled()) { - const ModelNode selectedModelNode = selectionContext().currentSingleSelectedNode(); - if (selectedModelNode.metaInfo().isValid() - && selectedModelNode.metaInfo().isQtQuickControlsTabView()) { - const NodeAbstractProperty defaultProperty = selectedModelNode - .defaultNodeAbstractProperty(); - const QList childModelNodes = defaultProperty.directSubNodes(); - for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) { - createActionForTab(childModelNode); - } - } - } - } -} - -bool EnterTabDesignerAction::isVisible(const SelectionContext &selectionContext) const -{ - if (selectionContext.singleNodeIsSelected()) { - ModelNode selectedModelNode = selectionContext.currentSingleSelectedNode(); - return selectedModelNode.metaInfo().isQtQuickControlsTabView(); - } - - return false; -} - -static bool tabViewIsNotEmpty(const SelectionContext &selectionContext) -{ - return selectionContext.currentSingleSelectedNode().defaultNodeAbstractProperty().isNodeListProperty(); -} - -bool EnterTabDesignerAction::isEnabled(const SelectionContext &selectionContext) const -{ - return isVisible(selectionContext) && tabViewIsNotEmpty(selectionContext); -} - -void EnterTabDesignerAction::createActionForTab(const ModelNode &modelNode) -{ - if (modelNode.metaInfo().isQtQuickControlsTab()) { - QmlDesigner::QmlItemNode itemNode(modelNode); - - if (itemNode.isValid()) { - QString what = tr("Step into: %1"). - arg(itemNode.instanceValue("title").toString()); - auto selectionAction = new EnterTabAction(what); - - SelectionContext nodeSelectionContext = selectionContext(); - nodeSelectionContext.setTargetNode(modelNode); - selectionAction->setSelectionContext(nodeSelectionContext); - - menu()->addAction(selectionAction); - - } - } -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.h b/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.h deleted file mode 100644 index 3cb6adff0f6..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/entertabdesigneraction.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -#include - -namespace QmlDesigner { - -class EnterTabDesignerAction : public AbstractActionGroup -{ - Q_DECLARE_TR_FUNCTIONS(EnterTabDesignerAction) - -public: - EnterTabDesignerAction(); - - QByteArray category() const override; - QByteArray menuId() const override; - int priority() const override; - void updateContext() override; - -protected: - bool isVisible(const SelectionContext &selectionContext) const override; - bool isEnabled(const SelectionContext &selectionContext) const override; - -private: - void createActionForTab(const ModelNode &modelNode); -}; - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.cpp b/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.cpp deleted file mode 100644 index 65ca73483ad..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#include "tabviewindexmodel.h" - -#include -#include -#include - -TabViewIndexModel::TabViewIndexModel(QObject *parent) : - QObject(parent) -{ -} - -void TabViewIndexModel::setModelNodeBackend(const QVariant &modelNodeBackend) -{ - auto modelNodeBackendObject = modelNodeBackend.value(); - - if (modelNodeBackendObject) - setModelNode(modelNodeBackendObject->property("modelNode").value()); - - setupModel(); - emit modelNodeBackendChanged(); -} - -void TabViewIndexModel::setModelNode(const QmlDesigner::ModelNode &modelNode) -{ - m_modelNode = modelNode; -} - -QStringList TabViewIndexModel::tabViewIndexModel() const -{ - return m_tabViewIndexModel; -} - -void TabViewIndexModel::setupModel() -{ - m_tabViewIndexModel.clear(); - if (m_modelNode.metaInfo().isQtQuickControlsTabView()) { - const QList childModelNodes - = m_modelNode.defaultNodeAbstractProperty().directSubNodes(); - for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) { - if (childModelNode.metaInfo().isQtQuickControlsTab()) { - QmlDesigner::QmlItemNode itemNode(childModelNode); - if (itemNode.isValid()) { - m_tabViewIndexModel.append(itemNode.instanceValue("title").toString()); - } - } - } - } -} - -void TabViewIndexModel::registerDeclarativeType() -{ - qmlRegisterType("HelperWidgets",2,0,"TabViewIndexModel"); -} - -QVariant TabViewIndexModel::modelNodeBackend() const -{ - return QVariant::fromValue(m_modelNode); -} diff --git a/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.h b/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.h deleted file mode 100644 index bd1c5cfa6b8..00000000000 --- a/src/plugins/qmldesigner/componentsplugin/tabviewindexmodel.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -#include -#include - -class TabViewIndexModel : public QObject -{ - Q_OBJECT - Q_PROPERTY(QVariant modelNodeBackendProperty READ modelNodeBackend WRITE setModelNodeBackend NOTIFY modelNodeBackendChanged) - Q_PROPERTY(QStringList tabViewIndexModel READ tabViewIndexModel NOTIFY modelNodeBackendChanged) - -public: - explicit TabViewIndexModel(QObject *parent = nullptr); - - void setModelNodeBackend(const QVariant &modelNodeBackend); - void setModelNode(const QmlDesigner::ModelNode &modelNode); - QStringList tabViewIndexModel() const; - void setupModel(); - - static void registerDeclarativeType(); - -signals: - void modelNodeBackendChanged(); - -private: - QVariant modelNodeBackend() const; - - QmlDesigner::ModelNode m_modelNode; - QStringList m_tabViewIndexModel; - -}; - -QML_DECLARE_TYPE(TabViewIndexModel) diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h index d7bc414e77e..c7d1e2a342f 100644 --- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h +++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h @@ -145,9 +145,7 @@ public: bool isQtQuick3DView3D() const; bool isQtQuickBorderImage() const; bool isQtQuickControlsSwipeView() const; - bool isQtQuickControlsTab() const; bool isQtQuickControlsTabBar() const; - bool isQtQuickControlsTabView() const; bool isQtQuickExtrasPicture() const; bool isQtQuickImage() const; bool isQtQuickItem() const; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index bdb7b63392e..7ca3aedff28 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -2107,16 +2107,6 @@ bool NodeMetaInfo::isListOrGridView() const } } -bool NodeMetaInfo::isQtQuickControlsTabView() const -{ - if constexpr (useProjectStorage()) { - using namespace Storage::Info; - return isBasedOnCommonType(m_projectStorage, m_typeId); - } else { - return isValid() && isSubclassOf("QtQuick.Controls.TabView"); - } -} - bool NodeMetaInfo::isQtQuickExtrasPicture() const { if constexpr (useProjectStorage()) { @@ -2195,17 +2185,6 @@ bool NodeMetaInfo::isQtQuickControlsTabBar() const } } -bool NodeMetaInfo::isQtQuickControlsTab() const -{ - if constexpr (useProjectStorage()) { - using namespace Storage::Info; - - return isBasedOnCommonType(m_projectStorage, m_typeId); - } else { - return isValid() && isSubclassOf("QtQuick.Controls.Tab"); - } -} - bool NodeMetaInfo::isQtQuickControlsSwipeView() const { if constexpr (useProjectStorage()) { diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp index 6d79375b6d7..2c990a50364 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp @@ -349,9 +349,6 @@ bool QmlItemNode::instanceHasScaleOrRotationTransform() const bool itemIsMovable(const ModelNode &modelNode) { - if (modelNode.metaInfo().isQtQuickControlsTab()) - return false; - if (!modelNode.hasParentProperty()) return false; @@ -363,9 +360,6 @@ bool itemIsMovable(const ModelNode &modelNode) bool itemIsResizable(const ModelNode &modelNode) { - if (modelNode.metaInfo().isQtQuickControlsTab()) - return false; - return NodeHints::fromModelNode(modelNode).isResizable(); } diff --git a/src/plugins/qmldesigner/designercore/projectstorage/commontypecache.h b/src/plugins/qmldesigner/designercore/projectstorage/commontypecache.h index 0db44e3df76..05e90fdb285 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/commontypecache.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/commontypecache.h @@ -106,8 +106,6 @@ inline constexpr char StateGroup[] = "StateGroup"; inline constexpr char State[] = "State"; inline constexpr char SwipeView[] = "SwipeView"; inline constexpr char TabBar[] = "TabBar"; -inline constexpr char TabView[] = "TabView"; -inline constexpr char Tab[] = "Tab"; inline constexpr char TextArea[] = "TextArea"; inline constexpr char TextEdit[] = "TextEdit"; inline constexpr char Text[] = "Text"; @@ -215,9 +213,7 @@ class CommonTypeCache CacheType, CacheType, CacheType, - CacheType, CacheType, - CacheType, CacheType, CacheType, CacheType, diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp index 0b8a7f46853..546406d0a11 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp @@ -514,7 +514,7 @@ void QmlDesignerProjectManager::fileListChanged() void QmlDesignerProjectManager::activeTargetChanged(ProjectExplorer::Target *target) { - if (!m_projectData) + if (!m_projectData || !m_projectData->projectStorageData) return; QObject::disconnect(m_projectData->activeTarget, nullptr, nullptr, nullptr); diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 77db8b073f5..e2626402f60 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -217,7 +217,10 @@ FilePath QmlProjectRunConfiguration::qmlRuntimeFilePath() const // i.e. not necessarily something the device can use, but the // device had its chance above. if (QtVersion *version = QtKitAspect::qtVersion(kit)) { - if (version->qtVersion().majorVersion() > 5) { + // look for puppet as qmlruntime only in QtStudio Qt versions + if (version->features().contains("QtStudio") && + version->qtVersion().majorVersion() > 5) { + auto [workingDirectoryPath, puppetPath] = QmlDesigner::QmlPuppetPaths::qmlPuppetPaths( target(), QmlDesigner::QmlDesignerBasePlugin::settings()); if (!puppetPath.isEmpty()) { diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index d6f2efacefc..dfc85ec0c77 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1861,9 +1861,23 @@ FilePath QtVersionPrivate::mkspecFromVersionInfo(const QHash FilePath QtVersionPrivate::sourcePath(const QHash &versionInfo) { const QString qt5Source = qmakeProperty(versionInfo, "QT_INSTALL_PREFIX/src"); - if (!qt5Source.isEmpty()) - return FilePath::fromString(QFileInfo(qt5Source).canonicalFilePath()); + if (!qt5Source.isEmpty()) { + // Can be wrong for the Qt installers :/ + // Check if we actually find sources, otherwise try what the online installer does. + const auto source = FilePath::fromString(QFileInfo(qt5Source).canonicalFilePath()); + static const QString qglobal = "qtbase/src/corelib/global/qglobal.h"; + if (!(source / qglobal).exists()) { + const auto install = FilePath::fromString( + qmakeProperty(versionInfo, "QT_INSTALL_PREFIX")) + .canonicalPath(); + const FilePath otherSource = install / ".." / "Src"; + if ((otherSource / qglobal).exists()) + return otherSource.cleanPath(); + } + return source; + } + // TODO The .qmake.cache workaround doesn't work anymore since Qt is built with CMake const QString installData = qmakeProperty(versionInfo, "QT_INSTALL_PREFIX"); QString sourcePath = installData; QFile qmakeCache(installData + "/.qmake.cache"); diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 4d57a423ee1..fe773f4995e 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -37,7 +37,6 @@ public: { m_combo = createSubWidget(); m_combo->setSizePolicy(QSizePolicy::Ignored, m_combo->sizePolicy().verticalPolicy()); - m_combo->addItem(Tr::tr("None"), -1); m_manageButton = createManageButton(Constants::QTVERSION_SETTINGS_PAGE_ID); @@ -75,6 +74,7 @@ private: { const GuardLocker locker(m_ignoreChanges); m_combo->clear(); + m_combo->addItem(Tr::tr("None"), -1); IDeviceConstPtr device = BuildDeviceKitAspect::device(kit()); const FilePath deviceRoot = device->rootPath(); diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index e1f6ff2c7cd..a0c928858ca 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -25,14 +25,17 @@ RefactorOverlay::RefactorOverlay(TextEditor::TextEditorWidget *editor) : void RefactorOverlay::paint(QPainter *painter, const QRect &clip) { const auto firstBlock = m_editor->blockForVerticalOffset(clip.top()); + const int firstBlockNumber = firstBlock.isValid() ? firstBlock.blockNumber() : 0; const auto lastBlock = m_editor->blockForVerticalOffset(clip.bottom()); + const int lastBlockNumber = lastBlock.isValid() ? lastBlock.blockNumber() + : m_editor->blockCount() - 1; m_maxWidth = 0; for (const RefactorMarker &marker : std::as_const(m_markers)) { const int markerBlockNumber = marker.cursor.block().blockNumber(); - if (markerBlockNumber < firstBlock.blockNumber()) + if (markerBlockNumber < firstBlockNumber) continue; - if (markerBlockNumber > lastBlock.blockNumber()) + if (markerBlockNumber > lastBlockNumber) continue; paintMarker(marker, painter, clip); } diff --git a/src/plugins/texteditor/snippets/snippetassistcollector.cpp b/src/plugins/texteditor/snippets/snippetassistcollector.cpp index edcfaef5aaa..58e46bb9673 100644 --- a/src/plugins/texteditor/snippets/snippetassistcollector.cpp +++ b/src/plugins/texteditor/snippets/snippetassistcollector.cpp @@ -10,6 +10,35 @@ using namespace TextEditor; using namespace Internal; +class SnippetProposalItem : public AssistProposalItemInterface +{ +public: + SnippetProposalItem(const Snippet &snippet, const QIcon &icon) + : m_snippet(snippet) + , m_icon(icon) + {} + + QString text() const override + { + return m_snippet.trigger() + QLatin1Char(' ') + m_snippet.complement(); + } + bool implicitlyApplies() const override { return false; } + bool prematurelyApplies(const QChar &) const override { return false; } + void apply(TextDocumentManipulatorInterface &manipulator, int basePosition) const override + { + manipulator.insertCodeSnippet(basePosition, m_snippet.content(), &Snippet::parse); + } + QIcon icon() const override { return m_icon; } + QString detail() const override { return m_snippet.generateTip(); } + bool isSnippet() const override { return true; } + bool isValid() const override { return true; } + quint64 hash() const override { return 0; } + +private: + const Snippet m_snippet; + const QIcon m_icon; +}; + static void appendSnippets(QList *items, const QString &groupId, const QIcon &icon, @@ -19,11 +48,7 @@ static void appendSnippets(QList *items, const int size = collection->totalActiveSnippets(groupId); for (int i = 0; i < size; ++i) { const Snippet &snippet = collection->snippet(i, groupId); - auto item = new AssistProposalItem; - item->setText(snippet.trigger() + QLatin1Char(' ') + snippet.complement()); - item->setData(snippet.content()); - item->setDetail(snippet.generateTip()); - item->setIcon(icon); + auto item = new SnippetProposalItem(snippet, icon); item->setOrder(order); items->append(item); } diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index 21db8c0cd32..d8b39a5c2c2 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -869,6 +869,13 @@ QTextCharFormat SyntaxHighlighter::whitespacified(const QTextCharFormat &fmt) return format; } +QTextCharFormat SyntaxHighlighter::asSyntaxHighlight(const QTextCharFormat &fmt) +{ + QTextCharFormat format = fmt; + format.setProperty(SyntaxHighlight, true); + return format; +} + void SyntaxHighlighter::highlightBlock(const QString &text) { formatSpaces(text); diff --git a/src/plugins/texteditor/syntaxhighlighter.h b/src/plugins/texteditor/syntaxhighlighter.h index 1b66e2ff56a..856aef72487 100644 --- a/src/plugins/texteditor/syntaxhighlighter.h +++ b/src/plugins/texteditor/syntaxhighlighter.h @@ -62,6 +62,7 @@ protected: void setTextFormatCategories(int count, std::function formatMapping); QTextCharFormat formatForCategory(int categoryIndex) const; QTextCharFormat whitespacified(const QTextCharFormat &fmt); + QTextCharFormat asSyntaxHighlight(const QTextCharFormat &fmt); // implement in subclasses // default implementation highlights whitespace diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 4dfed80728b..ca15ff256bf 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -334,11 +334,14 @@ void TextEditorOverlay::paint(QPainter *painter, const QRect &clip) Q_UNUSED(clip) const auto firstBlock = m_editor->blockForVerticalOffset(clip.top()); + const int firstBlockNumber = firstBlock.isValid() ? firstBlock.blockNumber() : 0; const auto lastBlock = m_editor->blockForVerticalOffset(clip.bottom()); + const int lastBlockNumber = lastBlock.isValid() ? lastBlock.blockNumber() + : m_editor->blockCount() - 1; auto overlapsClip = [&](const OverlaySelection &selection) { - return selection.m_cursor_end.blockNumber() >= firstBlock.blockNumber() - && selection.m_cursor_begin.blockNumber() <= lastBlock.blockNumber(); + return selection.m_cursor_end.blockNumber() >= firstBlockNumber + && selection.m_cursor_begin.blockNumber() <= lastBlockNumber; }; for (int i = m_selections.size() - 1; i >= 0; --i) { diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index f243d00506a..7b58247571a 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -124,17 +124,6 @@ def waitForCleanShutdown(timeOut=10): shutdownDone=True if not shutdownDone and datetime.utcnow() > endtime: break - if platform.system() == 'Linux' and JIRA.isBugStillOpen(15749): - pgrepOutput = getOutputFromCmdline(["pgrep", "-f", "qtcreator_process_stub"], - acceptedError=1) - pids = pgrepOutput.splitlines() - if len(pids): - print("Killing %d qtcreator_process_stub instances" % len(pids)) - for pid in pids: - try: - os.kill(__builtin__.int(pid), 9) - except OSError: # we might kill the parent before the current pid - pass def checkForStillRunningQmlExecutable(possibleNames): for qmlHelper in possibleNames: diff --git a/tests/system/suite_HELP/tst_HELP02/test.py b/tests/system/suite_HELP/tst_HELP02/test.py index 7cacdf6e515..e7e201c4948 100644 --- a/tests/system/suite_HELP/tst_HELP02/test.py +++ b/tests/system/suite_HELP/tst_HELP02/test.py @@ -53,8 +53,8 @@ def setKeyboardShortcutForAboutQtC(): invokeMenuItem("Edit", "Preferences...") mouseClick(waitForObjectItem(":Options_QListView", "Environment")) clickOnTab(":Options.qt_tabwidget_tabbar_QTabBar", "Keyboard") - filter = waitForObject("{container={title='Keyboard Shortcuts' type='QGroupBox' unnamed='1' " - "visible='1'} type='Utils::FancyLineEdit' unnamed='1' visible='1' " + filter = waitForObject("{container={name='Command Mappings' type='QGroupBox' visible='1'} " + "type='Utils::FancyLineEdit' unnamed='1' visible='1' " "placeholderText='Filter'}") replaceEditorContent(filter, "about") treewidget = waitForObject("{type='QTreeWidget' unnamed='1' visible='1'}")