Merge remote-tracking branch 'origin/11.0'
Change-Id: Ibb433d3e1ea2c0632dd2f710c8ec995de7599978
@@ -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)
|
||||
|
||||
26
dist/changelog/changes-11.0.0.md
vendored
@@ -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++
|
||||
|
||||
BIN
doc/qtcreator/images/icons/home.png
Normal file
|
After Width: | Height: | Size: 276 B |
BIN
doc/qtcreator/images/icons/info.png
Normal file
|
After Width: | Height: | Size: 203 B |
BIN
doc/qtcreator/images/qtcreator-axivion-annotation.webp
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
doc/qtcreator/images/qtcreator-axivion-view-rule.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
doc/qtcreator/images/qtcreator-axivion-view.webp
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
doc/qtcreator/images/qtcreator-edit-dashboard-configuration.webp
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
BIN
doc/qtcreator/images/qtcreator-issues.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
doc/qtcreator/images/qtcreator-preferences-axivion-project.webp
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
doc/qtcreator/images/qtcreator-preferences-axivion.webp
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
@@ -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
|
||||
|
||||
109
doc/qtcreator/src/analyze/creator-axivion.qdoc
Normal file
@@ -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).
|
||||
*/
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// **********************************************************************
|
||||
|
||||
/*!
|
||||
\previouspage creator-coco.html
|
||||
\previouspage creator-axivion.html
|
||||
\page creator-valgrind-overview.html
|
||||
\nextpage creator-analyzer.html
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// **********************************************************************
|
||||
|
||||
/*!
|
||||
\previouspage creator-project-vcpkg.html
|
||||
\previouspage creator-vcpkg.html
|
||||
\page creator-cli.html
|
||||
\nextpage creator-keyboard-shortcuts.html
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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 >
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
|
||||
12
doc/qtcreatordev/src/solutions-index.qdoc
Normal file
@@ -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
|
||||
*/
|
||||
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2058,7 +2058,10 @@ void CMakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
|
||||
|
||||
Environment CMakeBuildConfiguration::configureEnvironment() const
|
||||
{
|
||||
return aspect<ConfigureEnvironmentAspect>()->environment();
|
||||
Environment env = aspect<ConfigureEnvironmentAspect>()->environment();
|
||||
addToEnvironment(env);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
QString CMakeBuildSystem::cmakeBuildType() const
|
||||
|
||||
@@ -194,7 +194,7 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Id id) :
|
||||
|
||||
m_useStaging = addAspect<BoolAspect>();
|
||||
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<FilePathAspect>();
|
||||
@@ -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 <staging_dir> for <installation_dir>
|
||||
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});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<DebuggerRunConfigurationAspect>()) {
|
||||
if (!aspect->useCppDebugger)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/process.h>
|
||||
#include <utils/qtcsettings.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -42,9 +42,6 @@ namespace {
|
||||
|
||||
bool itemIsResizable(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isQtQuickControlsTab())
|
||||
return false;
|
||||
|
||||
return NodeHints::fromModelNode(modelNode).isResizable();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <QCoreApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <coreplugin/messagebox.h>
|
||||
|
||||
#include <documentmanager.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <modelnode.h>
|
||||
#include <nodeabstractproperty.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
|
||||
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<PropertyName, QVariant>("source", QString(tabName + QStringLiteral(".qml"))));
|
||||
propertyList.append(QPair<PropertyName, QVariant>("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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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 <QDialog>
|
||||
|
||||
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
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QmlDesigner::AddTabToTabViewDialog</class>
|
||||
<widget class="QDialog" name="QmlDesigner::AddTabToTabViewDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>362</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="addTabLabel">
|
||||
<property name="text">
|
||||
<string>Add tab:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::FileNameValidatingLineEdit" name="addTabLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::FileNameValidatingLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/filenamevalidatinglineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>QmlDesigner::AddTabToTabViewDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>QmlDesigner::AddTabToTabViewDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -3,22 +3,12 @@
|
||||
|
||||
#include "componentsplugin.h"
|
||||
|
||||
#include "tabviewindexmodel.h"
|
||||
#include "addtabdesigneraction.h"
|
||||
#include "entertabdesigneraction.h"
|
||||
|
||||
#include <designeractionmanager.h>
|
||||
#include <viewmanager.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
ComponentsPlugin::ComponentsPlugin()
|
||||
{
|
||||
TabViewIndexModel::registerDeclarativeType();
|
||||
DesignerActionManager *actionManager = &QmlDesignerPlugin::instance()->viewManager().designerActionManager();
|
||||
actionManager->addDesignerAction(new AddTabDesignerAction);
|
||||
actionManager->addDesignerAction(new EnterTabDesignerAction);
|
||||
}
|
||||
|
||||
QString ComponentsPlugin::pluginName() const
|
||||
|
||||
@@ -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 <abstractaction.h>
|
||||
#include <documentmanager.h>
|
||||
#include <modelnode.h>
|
||||
#include <nodeabstractproperty.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <qmlitemnode.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
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<QmlDesigner::ModelNode> 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
|
||||
@@ -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 <abstractactiongroup.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
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
|
||||
@@ -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 <metainfo.h>
|
||||
#include <variantproperty.h>
|
||||
#include <nodelistproperty.h>
|
||||
|
||||
TabViewIndexModel::TabViewIndexModel(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void TabViewIndexModel::setModelNodeBackend(const QVariant &modelNodeBackend)
|
||||
{
|
||||
auto modelNodeBackendObject = modelNodeBackend.value<QObject*>();
|
||||
|
||||
if (modelNodeBackendObject)
|
||||
setModelNode(modelNodeBackendObject->property("modelNode").value<QmlDesigner::ModelNode>());
|
||||
|
||||
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<QmlDesigner::ModelNode> 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<TabViewIndexModel>("HelperWidgets",2,0,"TabViewIndexModel");
|
||||
}
|
||||
|
||||
QVariant TabViewIndexModel::modelNodeBackend() const
|
||||
{
|
||||
return QVariant::fromValue(m_modelNode);
|
||||
}
|
||||
@@ -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 <qmlitemnode.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QtQml>
|
||||
|
||||
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)
|
||||
@@ -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;
|
||||
|
||||
@@ -2107,16 +2107,6 @@ bool NodeMetaInfo::isListOrGridView() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsTabView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Controls, TabView>(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<QtQuick_Controls, Tab>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.Tab");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsSwipeView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<QtQuick_Controls, Popup>,
|
||||
CacheType<QtQuick_Controls, SplitView>,
|
||||
CacheType<QtQuick_Controls, SwipeView>,
|
||||
CacheType<QtQuick_Controls, Tab>,
|
||||
CacheType<QtQuick_Controls, TabBar>,
|
||||
CacheType<QtQuick_Controls, TabView>,
|
||||
CacheType<QtQuick_Controls, TextArea>,
|
||||
CacheType<QtQuick_Dialogs, Dialog>,
|
||||
CacheType<QtQuick_Extras, Picture>,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -1861,9 +1861,23 @@ FilePath QtVersionPrivate::mkspecFromVersionInfo(const QHash<ProKey, ProString>
|
||||
FilePath QtVersionPrivate::sourcePath(const QHash<ProKey, ProString> &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");
|
||||
|
||||
@@ -37,7 +37,6 @@ public:
|
||||
{
|
||||
m_combo = createSubWidget<QComboBox>();
|
||||
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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<AssistProposalItemInterface *> *items,
|
||||
const QString &groupId,
|
||||
const QIcon &icon,
|
||||
@@ -19,11 +48,7 @@ static void appendSnippets(QList<AssistProposalItemInterface *> *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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -62,6 +62,7 @@ protected:
|
||||
void setTextFormatCategories(int count, std::function<TextStyle(int)> formatMapping);
|
||||
QTextCharFormat formatForCategory(int categoryIndex) const;
|
||||
QTextCharFormat whitespacified(const QTextCharFormat &fmt);
|
||||
QTextCharFormat asSyntaxHighlight(const QTextCharFormat &fmt);
|
||||
|
||||
// implement in subclasses
|
||||
// default implementation highlights whitespace
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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'}")
|
||||
|
||||