Merge remote-tracking branch 'origin/4.11'

Conflicts:
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quick3dnodeinstance.cpp

Change-Id: I8ea57eba526ab830608fd928c28771c5441749f8
This commit is contained in:
Eike Ziller
2019-11-01 15:31:19 +01:00
170 changed files with 2592 additions and 526 deletions

View File

@@ -18,6 +18,11 @@ you can check out from the public Git repository. For example:
* Made update notification less intrusive and more informative (QTCREATORBUG-22817) * Made update notification less intrusive and more informative (QTCREATORBUG-22817)
* Made wizards remember user choices (QTCREATORBUG-16657) * Made wizards remember user choices (QTCREATORBUG-16657)
## Help
* Fixed that removing Qt version only unregistered its documentation after
restart (QTCREATORBUG-16631)
## Editing ## Editing
* Added option to change line ending style via editor tool bar * Added option to change line ending style via editor tool bar
@@ -90,6 +95,7 @@ you can check out from the public Git repository. For example:
* Fixed handling of boolean semantics (`OFF`, `NO`, `FALSE`, and so on) * Fixed handling of boolean semantics (`OFF`, `NO`, `FALSE`, and so on)
* Fixed `Build` > `Run CMake` (QTCREATORBUG-19704) * Fixed `Build` > `Run CMake` (QTCREATORBUG-19704)
* Fixed registering `CMake.app` from official installer on macOS * Fixed registering `CMake.app` from official installer on macOS
* Fixed code model issues when using precompiled headers (QTCREATORBUG-22888)
### Qbs ### Qbs
@@ -106,6 +112,12 @@ you can check out from the public Git repository. For example:
* Added option to remove directories directly from project tree (QTCREATORBUG-16575) * Added option to remove directories directly from project tree (QTCREATORBUG-16575)
* Added support for Framework paths (QTCREATORBUG-20099) * Added support for Framework paths (QTCREATORBUG-20099)
## Debugging
### CDB
* Fixed assigning negative values to variables (QTCREATORBUG-17269)
## Analyzer ## Analyzer
* Added viewer for Chrome trace report files * Added viewer for Chrome trace report files
@@ -148,6 +160,10 @@ you can check out from the public Git repository. For example:
* Added settings per project (QTCREATORBUG-16704) * Added settings per project (QTCREATORBUG-16704)
* Added option to run tests after successful build * Added option to run tests after successful build
### Boost
* Fixed running multiple tests (QTCREATORBUG-23091)
## Platforms ## Platforms
### Windows ### Windows
@@ -184,6 +200,7 @@ you can check out from the public Git repository. For example:
* Fixed that it was not possible to add custom deployment steps (QTCREATORBUG-22977) * Fixed that it was not possible to add custom deployment steps (QTCREATORBUG-22977)
## Credits for these changes go to: ## Credits for these changes go to:
Aleksei German Aleksei German
Alessandro Portale Alessandro Portale
Andre Hartmann Andre Hartmann
@@ -211,6 +228,9 @@ Miikka Heikkinen
Milian Wolff Milian Wolff
Nikolai Kosjar Nikolai Kosjar
Orgad Shaneh Orgad Shaneh
Pasi Keränen
Richard Weickelt
Robert Löhning
Sergey Levin Sergey Levin
Sona Kurazyan Sona Kurazyan
Tasuku Suzuki Tasuku Suzuki

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -66,10 +66,10 @@
\note Android SDK Tools have issues with JDK versions later than 8. \note Android SDK Tools have issues with JDK versions later than 8.
\li \l{http://www.gradle.org}{Gradle} for building application packages \li \l{http://www.gradle.org}{Gradle} for building application packages
for Android devices (APK). Gradle is delivered with Qt 5.9, and (APK) and app bundles (AAB) for Android devices. Gradle is delivered
later. Because Gradle scripts are not delivered with Android SDK with Qt 5.9, and later. Because Gradle scripts are not delivered
Tools since version 26.0.0, they are delivered with Qt 5.9 and with Android SDK tools since version 26.0.0, they are delivered
5.6.3. with Qt 5.9 and 5.6.3.
\note Using Ant to build APKs is no longer supported. \note Using Ant to build APKs is no longer supported.
@@ -77,6 +77,9 @@
by the \l{http://developer.android.com/tools/sdk/ndk/index.html} by the \l{http://developer.android.com/tools/sdk/ndk/index.html}
{Android NDK} from Google. {Android NDK} from Google.
\note To develop with Qt 5.14.0 or later, you need Android NDK r20
or later.
\li \l{http://developer.android.com/sdk/index.html}{Android SDK Tools} \li \l{http://developer.android.com/sdk/index.html}{Android SDK Tools}
The following Android SDK packages and tools are required for The following Android SDK packages and tools are required for
@@ -167,7 +170,7 @@
\li In the \uicontrol {JDK location} field, add the path to the JDK. \li In the \uicontrol {JDK location} field, add the path to the JDK.
You can use the \inlineimage download.png Select the \inlineimage icons/download-icon.png
(\uicontrol Download) button to go to the site where you can (\uicontrol Download) button to go to the site where you can
download the JDK. \QC checks the JDK installation and reports download the JDK. \QC checks the JDK installation and reports
errors. errors.
@@ -175,9 +178,8 @@
\li In the \uicontrol {Android Settings} group, add paths to the Android \li In the \uicontrol {Android Settings} group, add paths to the Android
NDK and SDK. NDK and SDK.
You can use the \inlineimage download.png Select \inlineimage icons/download-icon.png
(\uicontrol Download) buttons to go to the sites where you can download to go to the sites where you can download the Android NDK and SDK.
the Android NDK and SDK.
The SDK Manager checks the Android NDK and SDK installations, The SDK Manager checks the Android NDK and SDK installations,
reports errors, and offers to install the necessary packages. reports errors, and offers to install the necessary packages.
@@ -192,7 +194,8 @@
\li Select \uicontrol File > \uicontrol {New File or Project} > \uicontrol Application > \li Select \uicontrol File > \uicontrol {New File or Project} > \uicontrol Application >
\uicontrol {Qt Quick Application} > \uicontrol Choose, and \uicontrol {Qt Quick Application} > \uicontrol Choose, and
follow the instructions of the wizard. For more information, see follow the instructions of the wizard to create a project. For more
information, see
\if defined(qtcreator) \if defined(qtcreator)
\l{Creating Qt Quick Projects}. \l{Creating Qt Quick Projects}.
\else \else

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -32,9 +32,19 @@
\title Deploying Applications to Android Devices \title Deploying Applications to Android Devices
On Android, applications are distributed in a specially structured type of On Android, applications are distributed in specially structured types of
ZIP package called an APK. \QC supports the following methods of deployment ZIP packages called Application Packages (APK) or Android App Bundles (AAB).
for Android applications: APK files can be downloaded to and executed on a device, whereas AAB is
intended to be interpreted by the Google Play store and is used to generate
APK files.
\l{Qt for Android} has binaries for armv7a, arm64-v8a, x86, and x86-64.
To support several different ABIs in your application, build an AAB that
contains binaries for each of the ABIs. The Google Play store uses the
AAB to generate optimized APK packages for the devices issuing the download
request and automatically signs them with your publisher key.
\QC supports the following methods of deployment for Android applications:
\list \list
@@ -44,6 +54,9 @@
The Ministro tool downloads the necessary Qt libraries from a The Ministro tool downloads the necessary Qt libraries from a
repository of your choice. repository of your choice.
\li Since Qt 5.14.0, as an app bundle (AAB), intended for distribution
in the Google Play store.
\endlist \endlist
To specify settings for application packages, select \uicontrol Projects > To specify settings for application packages, select \uicontrol Projects >
@@ -137,6 +150,23 @@
the \uicontrol {Compile Output} pane. To view additional information, select the the \uicontrol {Compile Output} pane. To view additional information, select the
\uicontrol {Verbose output} check box. \uicontrol {Verbose output} check box.
\section3 Building AABs
For testing the application locally, use the APK format, because
the package can be uploaded directly to the device and run. For
distribution to the Google Play store, create an AAB by selecting
the \uicontrol {Build .aab (Android App Bundle)} check box.
When building with CMake, you can select the ABIs to build the application
for in the \uicontrol CMake settings:
\image qtcreator-android-cmake-settings.png "CMake settings for building AABs"
When building with qmake, you can select the ABIs in the \uicontrol ABIs
field in the \uicontrol {Build Steps}:
\image qtcreator-android-build-steps.png "Android Build Steps"
\section3 Selecting API Level \section3 Selecting API Level
In the \uicontrol {Android build SDK} field, you can select the API level to use In the \uicontrol {Android build SDK} field, you can select the API level to use

View File

@@ -398,7 +398,7 @@
entry. entry.
You can enable tooltips in the main editor displaying this information. You can enable tooltips in the main editor displaying this information.
For more information, see \l{Showing Tooltips in Debug Mode}. For more information, see \l{See the value of variables in tooltips while debugging}.
//! [debugger-qt-basic-objects] //! [debugger-qt-basic-objects]
*/ */

View File

@@ -32,12 +32,41 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-faq.html \previouspage creator-faq.html
\page creator-tips.html \page creator-how-tos.html
\nextpage creator-known-issues.html \nextpage creator-known-issues.html
\title Tips and Tricks \title How-tos
\section1 Switching Between Modes How do I:
\list
\li \l {Switch between modes}
\li \l {Move between open files}
\li \l {Switch to Edit mode}
\li \l {Find a specific setting}
\li \l {Open output panes}
\li \l {Find keyboard shortcuts}
\li \l {Run \QC from the command line}
\li \l {Show and hide sidebars}
\li \l {Move to symbols}
\li \l {Inspect signal-slot connections while debugging}
\li \l {Display low-level data in the debugger}
\li \l {See the value of variables in tooltips while debugging}
\li \l {Quickly locate files using the keyboard}
\li \l {Perform calculations}
\li \l {Jump to a function in QML code}
\li \l {Add a license header template for C++ code}
\li \l {Paste text from my clipboard history}
\li \l {Sort lines alphabetically}
\li \l {Enclose selected code in curly braces, parentheses, or double quotes}
\li \l {Select the enclosing block in C++}
\li \l {Add my own code snippets to the auto-complete menu}
\li \l {Quickly write down notes somewhere}
\li \l {Configure the amount of recent files shown}
\li \l {Search and replace across files using a regular expression}
\endlist
\section1 Switch between modes
\QC uses different modes for different purposes. You can quickly \QC uses different modes for different purposes. You can quickly
switch between these modes with the following keyboard shortcuts: switch between these modes with the following keyboard shortcuts:
@@ -55,7 +84,7 @@
For more information about \QC modes, see \l {Selecting Modes}. For more information about \QC modes, see \l {Selecting Modes}.
\section1 Moving Between Open Files \section1 Move between open files
To quickly move between currently open files, press To quickly move between currently open files, press
\key Ctrl+Tab. \key Ctrl+Tab.
@@ -66,7 +95,7 @@
to jump to a symbol in the same file, you can jump back to your original to jump to a symbol in the same file, you can jump back to your original
location in that file by pressing \key {Alt+Left}. location in that file by pressing \key {Alt+Left}.
\section1 Moving To the Edit Mode \section1 Switch to Edit mode
To move to the \uicontrol Edit mode and currently active file, press To move to the \uicontrol Edit mode and currently active file, press
\key Esc. \key Esc.
@@ -81,12 +110,12 @@
\endlist \endlist
\section1 Using the Filter in Options Dialog \section1 Find a specific setting
To find specific settings you require in \uicontrol{Tools} > \uicontrol{Options} To find specific settings you require in \uicontrol{Tools} > \uicontrol{Options}
use the filter located at the top left of the \uicontrol Options dialog box. use the filter located at the top left of the \uicontrol Options dialog box.
\section1 Opening Output Panes \section1 Open output panes
The output panes provide a list of errors and warnings encountered during The output panes provide a list of errors and warnings encountered during
a build, detailed output from the compiler, status of a program when it is a build, detailed output from the compiler, status of a program when it is
@@ -112,7 +141,7 @@
For more information about output panes, see \l{Viewing Output}. For more information about output panes, see \l{Viewing Output}.
\section1 Using Keyboard Shortcuts \section1 Find keyboard shortcuts
\QC provides \l{Keyboard Shortcuts}{many useful keyboard shortcuts}. \QC provides \l{Keyboard Shortcuts}{many useful keyboard shortcuts}.
You can see the keyboard shortcut for a menu command in the menu You can see the keyboard shortcut for a menu command in the menu
@@ -121,7 +150,7 @@
To customize, import or export keyboard shortcuts, select \uicontrol Tools > To customize, import or export keyboard shortcuts, select \uicontrol Tools >
\uicontrol Options > \uicontrol Environment > \uicontrol Keyboard. \uicontrol Options > \uicontrol Environment > \uicontrol Keyboard.
\section1 Running \QC From Command Line \section1 Run \QC from the command line
You can launch \QC from command line using the name of an You can launch \QC from command line using the name of an
existing session or \c .pro file by giving the name as the command existing session or \c .pro file by giving the name as the command
@@ -132,7 +161,7 @@
For more information, see \l{Using Command Line Options}. For more information, see \l{Using Command Line Options}.
\section1 Showing and Hiding Sidebars \section1 Show and hide sidebars
You can toggle the left and right sidebar in some \QC modes. You can toggle the left and right sidebar in some \QC modes.
@@ -147,7 +176,7 @@
For more information on using the sidebars, see For more information on using the sidebars, see
\l {Browsing Project Contents}. \l {Browsing Project Contents}.
\section1 Moving To Symbols \section1 Move to symbols
To move straight to a symbol used in a project, select the symbol in the To move straight to a symbol used in a project, select the symbol in the
\uicontrol Editor toolbar drop-down menu. For more information on the editor \uicontrol Editor toolbar drop-down menu. For more information on the editor
@@ -163,7 +192,7 @@
cursor on the symbol and press \key {F2}. For more information, see cursor on the symbol and press \key {F2}. For more information, see
\l{Moving to Symbol Definition or Declaration}. \l{Moving to Symbol Definition or Declaration}.
\section1 Displaying Signals and Slots \section1 Inspect signal-slot connections while debugging
If an instance of a class is derived from QObject, and you would like to If an instance of a class is derived from QObject, and you would like to
find all other objects connected to one of your object's slots using find all other objects connected to one of your object's slots using
@@ -177,7 +206,7 @@
For more information about the \uicontrol{Locals} view, see For more information about the \uicontrol{Locals} view, see
\l{Local Variables and Function Parameters}. \l{Local Variables and Function Parameters}.
\section1 Displaying Low Level Data \section1 Display low-level data in the debugger
If special debugging of Qt objects fails due to data corruption within the If special debugging of Qt objects fails due to data corruption within the
debugged objects, you can switch off the debugging helpers. When debugging debugged objects, you can switch off the debugging helpers. When debugging
@@ -193,7 +222,7 @@
\endlist \endlist
\section1 Showing Tooltips in Debug Mode \section1 See the value of variables in tooltips while debugging
To inspect the value of variables from the editor, you can turn To inspect the value of variables from the editor, you can turn
on tooltips. Tooltips are hidden by default for performance reasons. on tooltips. Tooltips are hidden by default for performance reasons.
@@ -218,7 +247,7 @@
select \uicontrol {Close Editor Tooltips} in the context menu in the select \uicontrol {Close Editor Tooltips} in the context menu in the
\uicontrol {Locals} view. \uicontrol {Locals} view.
\section1 Locating Files \section1 Quickly locate files using the keyboard
The \uicontrol Locator provides one of the easiest ways in \QC to browse The \uicontrol Locator provides one of the easiest ways in \QC to browse
through projects, files, classes, functions, documentation and file systems. through projects, files, classes, functions, documentation and file systems.
@@ -230,7 +259,20 @@
For more information, see \l{Creating Locator Filters}. For more information, see \l{Creating Locator Filters}.
\section1 Adding a License Header Template for C++ Code \section1 Perform calculations
Open the \uicontrol Locator with \key {Ctrl+K} and type =, followed by a space.
You can now do basic calculations, with options to copy the results to the clipboard
by navigating through the entries and pressing \key {Enter}.
For more information, see \l{Executing JavaScript}.
\section1 Jump to a function in QML code
Open the \uicontrol Locator with \key {Ctrl+K} and type m, followed by a space.
You can now go directly to any QML method in the file.
\section1 Add a license header template for C++ code
A file containing a license header for C++ can be specified under A file containing a license header for C++ can be specified under
\uicontrol{Tools > Options > C++ > License Template}. It may contain special \uicontrol{Tools > Options > C++ > License Template}. It may contain special
@@ -250,16 +292,85 @@
\endlist \endlist
\section1 Pasting from Clipboard History \section1 Paste text from my clipboard history
\QC stores copied text in clipboard history. To retrieve clips from the \QC stores copied text in clipboard history. To retrieve clips from the
history, press \key {Ctrl+Shift+V} until the clip appears. history, press \key {Ctrl+Shift+V} until the clip appears.
The number of clips in the history is fixed to 10. The number of clips in the history is fixed to 10.
\section1 Sorting Lines Alphabetically \section1 Sort lines alphabetically
To sort selected lines alphabetically, select \uicontrol Edit > To sort selected lines alphabetically, select \uicontrol Edit >
\uicontrol Advanced > \uicontrol {Sort Selected Lines} or press \uicontrol Advanced > \uicontrol {Sort Selected Lines} or press
\key {Alt+Shift+S} (or \key Ctrl+Shift+S on \macos). \key {Alt+Shift+S} (or \key Ctrl+Shift+S on \macos).
\section1 Enclose selected code in curly braces, parentheses, or double quotes
Press \key {Shift} and then the opening character.
\list
\li Curly braces: \key {Shift+\{}
\li Parentheses: \key {Shift+(}
\li Double quotes: \key {Shift+"}
\endlist
\section1 Select the enclosing block in C++
Press \key {Ctrl+U}.
\section1 Add my own code snippets to the auto-complete menu
You can add, modify, and remove snippets in the snippet editor.
To open the editor, select \uicontrol Tools > \uicontrol Options
> \uicontrol {Text Editor} > \uicontrol Snippets.
For more information, see \l {Adding and Editing Snippets}.
\section1 Quickly write down notes somewhere
Select \uicontrol File > \uicontrol {New File or Project} >
\uicontrol {Files and Classes} > \uicontrol General > \uicontrol {Scratch Buffer}.
Alternatively, \key {Ctrl+N} can be used to open this dialog, which is
fully navigable via keyboard by using the up and down arrow keys and the
tab key.
This creates a new empty text file and saves it to the temporary directory
on your machine. You can use it to write down notes without having to worry
about deleting the file afterwards. The operating system will eventually
remove the file automatically. If you want to keep the file, you can easily
save it as a new file somewhere else. If you accidentally close the file,
you can find it in the \uicontrol File > \uicontrol {Recent Files} menu.
\section1 Configure the amount of recent files shown
Select \uicontrol Tools > \uicontrol Options, and change the value of the
list under \uicontrol Environment > \uicontrol System
> \uicontrol {Maximum number of entries in "Recent Files"}.
\section1 Search and replace across files using a regular expression
As an example, say you want to replace equality checks (\c {foo == bar})
with a function (\c {foo.equals(bar)}):
\list 1
\li Ensure that any work you have done is committed to version control,
as the changes cannot be undone.
\li Press \key {Ctrl+Shift+F} to bring up the \uicontrol {Advanced Find}
form.
\li Change the scope to whatever is appropriate for your search.
\li Under the \uicontrol {Search for} text field, select
the \uicontrol {Use regular expressions} check box.
\li Enter the following text in the \uicontrol {Search for} text field:
\badcode
if \((.*) == (.*)\)
\endcode
\li Press \uicontrol {Search & Replace} to see a list of search results.
\li In the \uicontrol {Replace with} text field, enter the following text:
\badcode
if (\1.strictlyEquals(\2))
\endcode
\li Press \uicontrol Replace to replace all instances of the text.
\endlist
For more information, see \l {Advanced Search}.
*/ */

View File

@@ -27,13 +27,13 @@
\contentspage index.html \contentspage index.html
\previouspage creator-help.html \previouspage creator-help.html
\page creator-faq.html \page creator-faq.html
\nextpage creator-tips.html \nextpage creator-how-tos.html
\title FAQ \title FAQ
This section contains answers to some frequently asked questions about \QC. This section contains answers to some frequently asked questions about \QC.
You might also find answers to your questions in the You might also find answers to your questions in the
\l{Known Issues} and \l{Tips and Tricks} sections, or the Troubleshooting \l{Known Issues} and \l{How-tos} sections, or the Troubleshooting
sections for a special area, such as sections for a special area, such as
\l{Troubleshooting Debugger}{debugging}. \l{Troubleshooting Debugger}{debugging}.

View File

@@ -107,7 +107,7 @@
\section1 Useful Features \section1 Useful Features
For a list of useful \QC features described in other parts of the For a list of useful \QC features described in other parts of the
documentation, see \l{Tips and Tricks}. documentation, see \l{How-tos}.
\endif \endif
\section1 Changing Languages \section1 Changing Languages
@@ -404,6 +404,9 @@
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\li \uicontrol {Asset Importer Error} - Errors and warnings encountered \li \uicontrol {Asset Importer Error} - Errors and warnings encountered
while importing assets from a design tool. while importing assets from a design tool.
\else
\li \uicontrol Autotests - Errors and warnings encountered while running
tests.
\endif \endif
\li \uicontrol {Build System} - Errors and warnings encountered during a \li \uicontrol {Build System} - Errors and warnings encountered during a

View File

@@ -53,7 +53,7 @@
Contains answers to some frequently asked questions about \QC. Contains answers to some frequently asked questions about \QC.
\li \l{Tips and Tricks} \li \l{How-tos}
Lists useful \QC features. Lists useful \QC features.

View File

@@ -31,7 +31,7 @@
/*! /*!
\contentspage index.html \contentspage index.html
\previouspage creator-tips.html \previouspage creator-how-tos.html
\page creator-known-issues.html \page creator-known-issues.html
\nextpage creator-glossary.html \nextpage creator-glossary.html

View File

@@ -45,7 +45,7 @@
configuration. qmake is installed and configured when you install Qt. configuration. qmake is installed and configured when you install Qt.
To use one of the other supported build systems, you need to set it up. To use one of the other supported build systems, you need to set it up.
\l {CMake Manual}{CMake} is an alternative to qmake for automating the \l {Build with CMake}{CMake} is an alternative to qmake for automating the
generation of build configurations. For more information, see generation of build configurations. For more information, see
\l {Setting Up CMake}. \l {Setting Up CMake}.

View File

@@ -63,8 +63,9 @@
Windows applications on Windows. MinGW is Windows applications on Windows. MinGW is
distributed together with \QC and Qt installers for Windows. distributed together with \QC and Qt installers for Windows.
\li Linux ICC (Intel C++ Compiler) is a group of C and C++ compilers \li ICC (Intel C++ Compiler) is a group of C and C++ compilers.
for Linux. Only the GCC-compatible variant, available for Linux and \macos,
is currently supported by \QC.
\li Clang is a C, C++, Objective C, and Objective C++ front-end for the \li Clang is a C, C++, Objective C, and Objective C++ front-end for the
LLVM compiler for Windows, Linux, and \macos. LLVM compiler for Windows, Linux, and \macos.
@@ -87,7 +88,8 @@
\li \l{https://www.iar.com/iar-embedded-workbench/}{IAREW} is a group of \li \l{https://www.iar.com/iar-embedded-workbench/}{IAREW} is a group of
C and C++ bare-metal compilers from the various IAR Embedded Workbench C and C++ bare-metal compilers from the various IAR Embedded Workbench
development environments. development environments.
\note Currently supported architectures are \c 8051, \c AVR, and \c ARM. \note Currently supported architectures are \c 8051, \c AVR, \c ARM,
\c STM8, and \c MSP430.
\li \l{https://www.keil.com}{KEIL} is a group of C and C++ bare-metal \li \l{https://www.keil.com}{KEIL} is a group of C and C++ bare-metal
compilers from the various KEIL development environments. compilers from the various KEIL development environments.
@@ -95,7 +97,7 @@
\li \l{https://sdcc.sourceforge.net}{SDCC} is a retargetable, optimizing \li \l{https://sdcc.sourceforge.net}{SDCC} is a retargetable, optimizing
C bare-metal compiler for various architectures. C bare-metal compiler for various architectures.
\note Currently supported architecture is \c 8051. \note Currently supported architectures are \c 8051 and \c STM8.
\endlist \endlist

View File

@@ -231,7 +231,7 @@
\list \list
\li \l{Using the Help Mode} \li \l{Using the Help Mode}
\li \l{FAQ} \li \l{FAQ}
\li \l{Tips and Tricks} \li \l{How-tos}
\li \l{Known Issues} \li \l{Known Issues}
\li \l{Glossary} \li \l{Glossary}
\li \l{Technical Support} \li \l{Technical Support}

View File

@@ -123,7 +123,7 @@
\list \list
\li \l{Using the Help Mode} \li \l{Using the Help Mode}
\li \l{FAQ} \li \l{FAQ}
\li \l{Tips and Tricks} \li \l{How-tos}
\li \l{Known Issues} \li \l{Known Issues}
\li \l{Glossary} \li \l{Glossary}
\endlist \endlist

View File

@@ -73,7 +73,7 @@
The main view of the application displays an SVG bubble image that moves The main view of the application displays an SVG bubble image that moves
around the screen when you tilt the device. around the screen when you tilt the device.
To use \l{accelbubble/Bluebubble.svg}{Bluebubble.svg} in your project, To use \e {Bluebubble.svg} in your project,
copy it to the project directory (same subdirectory as the QML file). copy it to the project directory (same subdirectory as the QML file).
The image appears in \uicontrol Resources. You can also use any other The image appears in \uicontrol Resources. You can also use any other
image or a QML type, instead. image or a QML type, instead.
@@ -140,9 +140,8 @@
\QC creates a reference to the Bubble type in \e Page1Form.ui.qml. \QC creates a reference to the Bubble type in \e Page1Form.ui.qml.
To check your code, you can compare \e Page1Form.ui.qml with the To check your code, you can compare your \e Page1Form.ui.qml and
\l{accelbubble/Page1Form.ui.qml}{Page1Form.ui.qml} example file and \e {Bubble.qml} with the corresponding example files.
\e Bubble.qml with the \l{accelbubble/Bubble.qml}{Bubble.qml} example file.
The UI is now ready and you can switch to editing the \e Bubble.qml and The UI is now ready and you can switch to editing the \e Bubble.qml and
\e main.qml files in the \uicontrol {Text Editor}, as described in the \e main.qml files in the \uicontrol {Text Editor}, as described in the

View File

@@ -45,7 +45,7 @@
\l {Setting Up CMake}{CMake}, or \l {Setting Up Qbs}{Qbs}. \l {Setting Up CMake}{CMake}, or \l {Setting Up Qbs}{Qbs}.
\li In the \uicontrol {Qt Quick Controls Style} field, select one of \li In the \uicontrol {Qt Quick Controls Style} field, select one of
the predefined \l{Styling Qt Quick Controls 2}{UI styles} to use, the predefined \l{Styling Qt Quick Controls}{UI styles} to use,
and then select \uicontrol Next. and then select \uicontrol Next.
\li Select \l{glossary-buildandrun-kit}{kits} for the platforms that \li Select \l{glossary-buildandrun-kit}{kits} for the platforms that

View File

@@ -188,9 +188,9 @@
\endlist \endlist
To check your code, you can view \e Page1Form.ui.qml in the To check your code, you can view your \e {Page1Form.ui.qml} file in the
\uicontrol {Text Editor} and compare it with the \l{transitions/Page1Form.ui.qml} \uicontrol {Text Editor} and compare it with the \e {Page1Form.ui.qml}
{Page1Form.ui.qml} example file. example file.
The new project wizard adds boilerplate code to the \e Page1.qml file to The new project wizard adds boilerplate code to the \e Page1.qml file to
create menu items and push buttons. Modify the boilerplate code by removing create menu items and push buttons. Modify the boilerplate code by removing

View File

@@ -172,7 +172,7 @@
\l {Setting Up CMake}{CMake}, or \l {Setting Up Qbs}{Qbs}. \l {Setting Up CMake}{CMake}, or \l {Setting Up Qbs}{Qbs}.
\li In the \uicontrol {Qt Quick Controls Style} field, select one of \li In the \uicontrol {Qt Quick Controls Style} field, select one of
the predefined \l{Styling Qt Quick Controls 2}{UI styles} to use, the predefined \l{Styling Qt Quick Controls}{UI styles} to use,
and then select \uicontrol Next. and then select \uicontrol Next.
\li Select the \uicontrol {Use Qt Virtual Keyboard} check box to add \li Select the \uicontrol {Use Qt Virtual Keyboard} check box to add

View File

@@ -458,7 +458,7 @@
user interfaces for \l{glossary-device}{devices}. user interfaces for \l{glossary-device}{devices}.
Qt Quick Controls 2 achieve improved efficiency by employing a simplified Qt Quick Controls 2 achieve improved efficiency by employing a simplified
\l {Styling Qt Quick Controls 2}{styling architecture} when compared to \l {Styling Qt Quick Controls}{styling architecture} when compared to
Qt Quick Controls, on which the module is based. The visual editor reads the Qt Quick Controls, on which the module is based. The visual editor reads the
\c qtquickcontrols2.conf file that specifies the preferred style and some \c qtquickcontrols2.conf file that specifies the preferred style and some
style-specific arguments. To change the style, select another style from style-specific arguments. To change the style, select another style from

View File

@@ -199,12 +199,15 @@
To remove all the changes you recorded for a property, right-click the To remove all the changes you recorded for a property, right-click the
property name on the timeline and select \uicontrol {Remove Property}. property name on the timeline and select \uicontrol {Remove Property}.
Keyframes a marked on the timeline by using markers of different colors and Keyframes are marked on the timeline by using markers of different colors and
shapes, depending on whether they are active or inactive or whether you have shapes, depending on whether they are active or inactive or whether you have
applied easing curves to them, for example. applied easing curves to them, for example.
To edit the value of the selected keyframe, select To edit the value of a keyframe, double-click a keyframe marker or select
\uicontrol {Edit Value for Keyframe} in the context menu. \uicontrol {Edit Keyframe} in the context menu. In the \uicontrol Frame
field, you can set the frame and the value:
\image studio-edit-keyframe.png "Edit Keyframe dialog"
You can copy the keyframes from the keyframe track for an item and You can copy the keyframes from the keyframe track for an item and
paste them to the keyframe track of another item. To copy all paste them to the keyframe track of another item. To copy all
@@ -241,13 +244,14 @@
components can appear to pick up speed, slow down, or bounce back at the components can appear to pick up speed, slow down, or bounce back at the
end of the animation. By default, the animations you specify on the end of the animation. By default, the animations you specify on the
timeline are \e linear, which means that they move from the beginning to timeline are \e linear, which means that they move from the beginning to
the end at a constant speed. You can use the \e {curve picker} to edit the the end at a constant speed. You can use the \uicontrol {Easing Curve Editor}
easing curve between two keyframes. You can also use the more advanced to edit the easing curve between two keyframes. You can also use the more
\e {curve editor} to edit the curves for the whole animation. advanced \uicontrol {Curve Editor (C)} to edit the curves for the whole
animation.
\section2 Attaching Easing Curves to Keyframes \section2 Attaching Easing Curves to Keyframes
\image studio-curve-picker.png \image studio-easing-curve-editor.png "Easing Curve Editor"
You can use the preset curves or modify them by dragging the curve handlers You can use the preset curves or modify them by dragging the curve handlers
around. You can add points to the curve and drag them and the point handlers around. You can add points to the curve and drag them and the point handlers
@@ -255,22 +259,21 @@
custom curve. For more information about easing curve types, see the custom curve. For more information about easing curve types, see the
documentation for \l [QML] {PropertyAnimation}{easing curves}. documentation for \l [QML] {PropertyAnimation}{easing curves}.
To zoom into and out of the easing curve picker, use the mouse roller. To To zoom into and out of the easing curve editor, use the mouse roller. To
reset the zoom factor, right-click in the picker and select reset the zoom factor, right-click in the picker and select
\uicontrol {Reset Zoom}. \uicontrol {Reset Zoom}.
To attach easing curves to keyframes: To attach easing curves to keyframes:
\list 1 \list 1
\li Select a keyframe on the timeline. \li Right-click a keyframe on the timeline and select
\li Select \uicontrol {Curve Picker (C)} on the toolbar, or press \uicontrol {Easing Curve Editor} in the context menu.
\key C to open the curve picker.
\li Select an easing curve in the \uicontrol Presets tab. \li Select an easing curve in the \uicontrol Presets tab.
\li In the \uicontrol {Duration (ms)} field, select the duration of the \li In the \uicontrol {Duration (ms)} field, select the duration of the
easing function in milliseconds. easing function in milliseconds.
\li Select \uicontrol Preview to preview the curve. \li Select \uicontrol Preview to preview the curve.
\li Select \uicontrol OK to attach the easing curve to the keyframe \li Select \uicontrol OK to attach the easing curve to the keyframe
and to close the curve picker. and to close the easing curve editor.
\endlist \endlist
When you attach easing curves to keyframes, the shape of the keyframe When you attach easing curves to keyframes, the shape of the keyframe
@@ -283,8 +286,8 @@
To customize easing curves: To customize easing curves:
\list 1 \list 1
\li In the curve picker, select an easing curve in the \li In the \uicontrol {Easing Curve Editor}, select an easing curve in
\uicontrol Presets tab. the \uicontrol Presets tab.
\li Drag the curve handlers to modify the curve. \li Drag the curve handlers to modify the curve.
\li Right-click in the editor, and select \uicontrol {Add Point} to add \li Right-click in the editor, and select \uicontrol {Add Point} to add
points to the curve. points to the curve.
@@ -297,7 +300,7 @@
\uicontrol Custom tab. \uicontrol Custom tab.
\endlist \endlist
To paste easing curve definitions to the curve picker as text, select To paste easing curve definitions to the easing curve editor as text, select
the \uicontrol Text tab. the \uicontrol Text tab.
\section1 Editing Animation Curves \section1 Editing Animation Curves
@@ -307,9 +310,9 @@
modify the curve. You can modify the appearance of the curve in the style modify the curve. You can modify the appearance of the curve in the style
editor. editor.
You can also edit easing curves that you added with the curve picker. You can also edit easing curves that you added with the easing curve editor.
\image studio-curve-editor.png \image studio-curve-editor.png "Curve Editor"
To edit animation curves: To edit animation curves:

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2018 The Qt Company Ltd. ** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -224,6 +224,13 @@
branch is shown in bold and underlined in the list of branches in the branch is shown in bold and underlined in the list of branches in the
\uicontrol {Git Branches} sidebar view. \uicontrol {Git Branches} sidebar view.
\image qtcreator-vcs-gitbranch.png "Git Branches sidebar view"
Old entries and tags are filtered out of the list of branches
by default. To include them, select \inlineimage filtericon.png
(\uicontrol {Filter Tree}), and then select
\uicontrol {Include Old Entries} and \uicontrol {Include Tags}.
If you checked out a specific commit, the list of branches displays a If you checked out a specific commit, the list of branches displays a
\e {Detached HEAD} entry. \e {Detached HEAD} entry.
@@ -233,8 +240,6 @@
To refresh the list of branches, click \inlineimage reload_gray.png To refresh the list of branches, click \inlineimage reload_gray.png
(\uicontrol Refresh). (\uicontrol Refresh).
\image qtcreator-vcs-gitbranch.png "Git Branches sidebar view"
The following operations are supported in the context-menu for a branch: The following operations are supported in the context-menu for a branch:
\table \table
@@ -249,7 +254,8 @@
\li Remove a local branch. You cannot delete remote branches. \li Remove a local branch. You cannot delete remote branches.
\row \row
\li \uicontrol Rename \li \uicontrol Rename
\li Rename a local branch. You cannot rename remote branches. \li Rename a local branch or a tag. You cannot rename remote
branches.
\row \row
\li \uicontrol{Checkout} \li \uicontrol{Checkout}
\li Check out the selected branch and make it current. You can stash \li Check out the selected branch and make it current. You can stash
@@ -302,12 +308,12 @@
\li Description \li Description
\row \row
\li \uicontrol{Fetch} \li \uicontrol{Fetch}
\li Fetches all the branches and changes information from a \li Fetch all the branches and changes information from a
specific remote repository, or from all remotes if applied specific remote repository, or from all remotes if applied
to \uicontrol {Remote Branches}. to \uicontrol {Remote Branches}.
\row \row
\li \uicontrol{Manage Remotes} \li \uicontrol{Manage Remotes}
\li Opens the \uicontrol Remotes dialog. \li Open the \uicontrol Remotes dialog.
\endtable \endtable
\section3 Configuring Merge Tools \section3 Configuring Merge Tools
@@ -357,11 +363,33 @@
To browse a directory or the commit history and to apply actions on the To browse a directory or the commit history and to apply actions on the
commits, select \uicontrol Tools > \uicontrol Git > commits, select \uicontrol Tools > \uicontrol Git >
\uicontrol {Actions on Commits}. You can checkout, revert, or cherry-pick \uicontrol {Actions on Commits}.
commits or view them in the diff editor.
\image creator-git-commit-actions.png "Select a Git Commit dialog" \image creator-git-commit-actions.png "Select a Git Commit dialog"
You can apply the following actions on commits:
\table
\header
\li Menu Item
\li Description
\row
\li \uicontrol Archive
\li Package the commit as a ZIP or tarball.
\row
\li \uicontrol Checkout
\li Check out the change in a headless state.
\row
\li \uicontrol {Cherry Pick}
\li Cherry-pick the selected change to the local repository.
\row
\li \uicontrol Revert
\li Revert back to the state of the last commit.
\row
\li \uicontrol Show
\li Show the commit in the diff editor.
\endtable
\section1 Initializing Git Repositories \section1 Initializing Git Repositories
To start controlling a project directory that is currently not under To start controlling a project directory that is currently not under

View File

@@ -56,6 +56,19 @@ if [ ! -d "$designerDestDir" ]; then
done done
fi fi
# collect 3d assetimporter plugins
assetimporterDestDir="$app_path/Contents/PlugIns/assetimporters"
assetimporterSrcDir="$plugin_src/assetimporters"
if [ -d "$assetimporterSrcDir" ]; then
if [ ! -d "$assetimporterDestDir" ]; then
echo "- Copying 3d assetimporter plugins"
mkdir -p "$assetimporterDestDir"
for plugin in "$assetimporterSrcDir"/*.dylib; do
cp "$plugin" "$assetimporterDestDir"/ || exit 1
done
fi
fi
# copy Qt Quick 1 imports # copy Qt Quick 1 imports
importsDir="$app_path/Contents/Imports/qtquick1" importsDir="$app_path/Contents/Imports/qtquick1"
if [ -d "$quick1_src" ]; then if [ -d "$quick1_src" ]; then

View File

@@ -39,7 +39,7 @@ class ValuesChangedCommand
friend bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second); friend bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
public: public:
enum TransactionOption { Start, End, None }; enum TransactionOption { Start = 1, End = 2, None = 0 };
ValuesChangedCommand(); ValuesChangedCommand();
explicit ValuesChangedCommand(const QVector<PropertyValueContainer> &valueChangeVector); explicit ValuesChangedCommand(const QVector<PropertyValueContainer> &valueChangeVector);

View File

@@ -74,12 +74,29 @@ TypeName PropertyValueContainer::dynamicTypeName() const
return m_dynamicTypeName; return m_dynamicTypeName;
} }
// The reflection flag indicates that a property change notification
// is reflected. This means that the notification is the reaction to a
// property change original done by the puppet itself.
// In the Qt5InformationNodeInstanceServer such notification are
// therefore ignored.
void PropertyValueContainer::setReflectionFlag(bool b)
{
m_isReflected = b;
}
bool PropertyValueContainer::isReflected() const
{
return m_isReflected;
}
QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container) QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container)
{ {
out << container.instanceId(); out << container.instanceId();
out << container.name(); out << container.name();
out << container.value(); out << container.value();
out << container.dynamicTypeName(); out << container.dynamicTypeName();
out << container.isReflected();
return out; return out;
} }
@@ -90,6 +107,7 @@ QDataStream &operator>>(QDataStream &in, PropertyValueContainer &container)
in >> container.m_name; in >> container.m_name;
in >> container.m_value; in >> container.m_value;
in >> container.m_dynamicTypeName; in >> container.m_dynamicTypeName;
in >> container.m_isReflected;
return in; return in;
} }
@@ -99,7 +117,8 @@ bool operator ==(const PropertyValueContainer &first, const PropertyValueContain
return first.m_instanceId == second.m_instanceId return first.m_instanceId == second.m_instanceId
&& first.m_name == second.m_name && first.m_name == second.m_name
&& first.m_value == second.m_value && first.m_value == second.m_value
&& first.m_dynamicTypeName == second.m_dynamicTypeName; && first.m_dynamicTypeName == second.m_dynamicTypeName
&& first.m_isReflected == second.m_isReflected;
} }
bool operator <(const PropertyValueContainer &first, const PropertyValueContainer &second) bool operator <(const PropertyValueContainer &first, const PropertyValueContainer &second)

View File

@@ -50,12 +50,15 @@ public:
QVariant value() const; QVariant value() const;
bool isDynamic() const; bool isDynamic() const;
TypeName dynamicTypeName() const; TypeName dynamicTypeName() const;
void setReflectionFlag(bool b);
bool isReflected() const;
private: private:
qint32 m_instanceId; qint32 m_instanceId;
PropertyName m_name; PropertyName m_name;
QVariant m_value; QVariant m_value;
TypeName m_dynamicTypeName; TypeName m_dynamicTypeName;
bool m_isReflected = false;
}; };
QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container); QDataStream &operator<<(QDataStream &out, const PropertyValueContainer &container);

View File

@@ -30,12 +30,12 @@ import MouseArea3D 1.0
Model { Model {
id: arrow id: arrow
rotationOrder: Node.XYZr rotationOrder: Node.XYZr
source: "meshes/Arrow.mesh" source: "meshes/arrow.mesh"
property View3D view3D property View3D view3D
property alias color: material.emissiveColor property alias color: material.emissiveColor
property Node targetNode: null property Node targetNode: null
property bool isDragging: false property bool dragging: false
readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering
@@ -43,10 +43,11 @@ Model {
property var _targetStartPos property var _targetStartPos
signal positionCommit() signal positionCommit()
signal positionMove()
materials: DefaultMaterial { materials: DefaultMaterial {
id: material id: material
emissiveColor: mouseAreaFront.hovering ? "white" : Qt.rgba(1.0, 0.0, 0.0, 1.0) emissiveColor: "white"
lighting: DefaultMaterial.NoLighting lighting: DefaultMaterial.NoLighting
} }
@@ -59,7 +60,7 @@ Model {
_pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition); _pointerPosPressed = mouseArea.mapPositionToScene(maskedPosition);
var sp = targetNode.scenePosition; var sp = targetNode.scenePosition;
_targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z); _targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z);
isDragging = true; dragging = true;
} }
function posInParent(mouseArea, pointerPosition) function posInParent(mouseArea, pointerPosition)
@@ -85,6 +86,7 @@ Model {
return; return;
targetNode.position = posInParent(mouseArea, pointerPosition); targetNode.position = posInParent(mouseArea, pointerPosition);
arrow.positionMove();
} }
function handleReleased(mouseArea, pointerPosition) function handleReleased(mouseArea, pointerPosition)
@@ -93,7 +95,7 @@ Model {
return; return;
targetNode.position = posInParent(mouseArea, pointerPosition); targetNode.position = posInParent(mouseArea, pointerPosition);
isDragging = false; dragging = false;
arrow.positionCommit(); arrow.positionCommit();
} }
@@ -104,7 +106,7 @@ Model {
y: -1.5 y: -1.5
width: 12 width: 12
height: 3 height: 3
rotation: Qt.vector3d(0, 90, 0) rotation: Qt.vector3d(0, 0, 90)
grabsMouse: targetNode grabsMouse: targetNode
onPressed: arrow.handlePressed(mouseAreaYZ, pointerPosition) onPressed: arrow.handlePressed(mouseAreaYZ, pointerPosition)
onDragged: arrow.handleDragged(mouseAreaYZ, pointerPosition) onDragged: arrow.handleDragged(mouseAreaYZ, pointerPosition)
@@ -118,12 +120,11 @@ Model {
y: -1.5 y: -1.5
width: 12 width: 12
height: 3 height: 3
rotation: Qt.vector3d(90, 90, 0) rotation: Qt.vector3d(0, 90, 90)
grabsMouse: targetNode grabsMouse: targetNode
onPressed: arrow.handlePressed(mouseAreaXZ, pointerPosition) onPressed: arrow.handlePressed(mouseAreaXZ, pointerPosition)
onDragged: arrow.handleDragged(mouseAreaXZ, pointerPosition) onDragged: arrow.handleDragged(mouseAreaXZ, pointerPosition)
onReleased: arrow.handleReleased(mouseAreaXZ, pointerPosition) onReleased: arrow.handleReleased(mouseAreaXZ, pointerPosition)
} }
} }

View File

@@ -39,11 +39,17 @@ Node {
onSceneTransformChanged: updateScale() onSceneTransformChanged: updateScale()
onAutoScaleChanged: updateScale() onAutoScaleChanged: updateScale()
Connections { Connections {
target: view3D.camera target: view3D.camera
onSceneTransformChanged: updateScale() onSceneTransformChanged: updateScale()
} }
Connections {
target: designStudioNativeCameraControlHelper
onOverlayUpdateNeeded: updateScale()
}
function getScale(baseScale) function getScale(baseScale)
{ {
return Qt.vector3d(baseScale.x * relativeScale, baseScale.y * relativeScale, return Qt.vector3d(baseScale.x * relativeScale, baseScale.y * relativeScale,

View File

@@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.0
import QtQuick3D 1.0
IconGizmo {
id: cameraGizmo
iconSource: "qrc:///qtquickplugin/mockfiles/images/camera-pick-icon.png"
gizmoModel.source: "#Cube"
gizmoModel.materials: [
DefaultMaterial {
id: defaultMaterial
emissiveColor: "blue"
lighting: DefaultMaterial.NoLighting
}
]
}

View File

@@ -44,23 +44,65 @@ Window {
property Node selectedNode: null property Node selectedNode: null
property var lightGizmos: []
property var cameraGizmos: []
signal objectClicked(var object) signal objectClicked(var object)
signal commitObjectPosition(var object) signal commitObjectPosition(var object)
signal moveObjectPosition(var object)
function selectObject(object) { function selectObject(object) {
selectedNode = object; selectedNode = object;
} }
function emitObjectClicked(object) {
selectObject(object);
objectClicked(object);
}
function addLightGizmo(obj)
{
var component = Qt.createComponent("LightGizmo.qml");
if (component.status === Component.Ready) {
var gizmo = component.createObject(overlayScene,
{"view3D": overlayView, "targetNode": obj});
lightGizmos[lightGizmos.length] = gizmo;
gizmo.selected.connect(emitObjectClicked);
}
}
function addCameraGizmo(obj)
{
var component = Qt.createComponent("CameraGizmo.qml");
if (component.status === Component.Ready) {
var gizmo = component.createObject(overlayScene,
{"view3D": overlayView, "targetNode": obj});
cameraGizmos[cameraGizmos.length] = gizmo;
gizmo.selected.connect(emitObjectClicked);
}
}
// Work-around the fact that the projection matrix for the camera is not calculated until
// the first frame is rendered, so any initial calls to mapFrom3DScene() will fail.
Component.onCompleted: designStudioNativeCameraControlHelper.requestOverlayUpdate();
onWidthChanged: designStudioNativeCameraControlHelper.requestOverlayUpdate();
onHeightChanged: designStudioNativeCameraControlHelper.requestOverlayUpdate();
Node { Node {
id: overlayScene id: overlayScene
Camera { PerspectiveCamera {
id: overlayCamera id: overlayPerspectiveCamera
projectionMode: usePerspectiveCheckbox.checked ? Camera.Perspective clipFar: editPerspectiveCamera.clipFar
: Camera.Orthographic position: editPerspectiveCamera.position
clipFar: editCamera.clipFar rotation: editPerspectiveCamera.rotation
position: editCamera.position }
rotation: editCamera.rotation
OrthographicCamera {
id: overlayOrthoCamera
position: editOrthoCamera.position
rotation: editOrthoCamera.rotation
} }
MoveGizmo { MoveGizmo {
@@ -70,14 +112,12 @@ Window {
targetNode: viewWindow.selectedNode targetNode: viewWindow.selectedNode
position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition position: viewWindow.selectedNode ? viewWindow.selectedNode.scenePosition
: Qt.vector3d(0, 0, 0) : Qt.vector3d(0, 0, 0)
rotation: globalControl.checked || !viewWindow.selectedNode globalOrientation: globalControl.checked
? Qt.vector3d(0, 0, 0)
: viewWindow.selectedNode.sceneRotation
visible: selectedNode visible: selectedNode
view3D: overlayView view3D: overlayView
onPositionCommit: viewWindow.commitObjectPosition(selectedNode) onPositionCommit: viewWindow.commitObjectPosition(selectedNode)
onPositionMove: viewWindow.moveObjectPosition(selectedNode)
} }
AutoScaleHelper { AutoScaleHelper {
@@ -97,15 +137,14 @@ Window {
onTapped: { onTapped: {
var pickResult = editView.pick(eventPoint.scenePosition.x, var pickResult = editView.pick(eventPoint.scenePosition.x,
eventPoint.scenePosition.y); eventPoint.scenePosition.y);
viewWindow.objectClicked(pickResult.objectHit); emitObjectClicked(pickResult.objectHit);
selectObject(pickResult.objectHit);
} }
} }
View3D { View3D {
id: editView id: editView
anchors.fill: parent anchors.fill: parent
camera: editCamera camera: usePerspective ? editPerspectiveCamera : editOrthoCamera
Node { Node {
id: mainSceneHelpers id: mainSceneHelpers
@@ -119,15 +158,21 @@ Window {
PointLight { PointLight {
id: pointLight id: pointLight
visible: showEditLight visible: showEditLight
position: editCamera.position position: usePerspective ? editPerspectiveCamera.position
: editOrthoCamera.position
} }
Camera { PerspectiveCamera {
id: editCamera id: editPerspectiveCamera
y: 200 y: 200
z: -300 z: -300
clipFar: 100000 clipFar: 100000
projectionMode: usePerspective ? Camera.Perspective : Camera.Orthographic }
OrthographicCamera {
id: editOrthoCamera
y: 200
z: -300
} }
} }
} }
@@ -135,7 +180,7 @@ Window {
View3D { View3D {
id: overlayView id: overlayView
anchors.fill: parent anchors.fill: parent
camera: overlayCamera camera: usePerspective ? overlayPerspectiveCamera : overlayOrthoCamera
scene: overlayScene scene: overlayScene
} }
@@ -145,7 +190,7 @@ Window {
targetView: overlayView targetView: overlayView
offsetX: 0 offsetX: 0
offsetY: 45 offsetY: 45
visible: moveGizmo.isDragging visible: moveGizmo.dragging
Rectangle { Rectangle {
color: "white" color: "white"
@@ -204,7 +249,7 @@ Window {
CheckBox { CheckBox {
id: globalControl id: globalControl
checked: true checked: true
text: qsTr("Use global orientation") text: qsTr("Use Global Orientation")
onCheckedChanged: cameraControl.forceActiveFocus() onCheckedChanged: cameraControl.forceActiveFocus()
} }
} }

View File

@@ -0,0 +1,81 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.0
import QtQuick3D 1.0
Node {
id: iconGizmo
property View3D view3D
property bool highlightOnHover: true
property Node targetNode: null
property alias gizmoModel: gizmoModel
property alias iconSource: iconImage.source
signal positionCommit()
signal selected(Node node)
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
rotation: targetNode ? targetNode.sceneRotation : Qt.vector3d(0, 0, 0)
visible: targetNode ? targetNode.visible : false
Model {
id: gizmoModel
scale: Qt.vector3d(0.05, 0.05, 0.05)
visible: iconGizmo.visible
}
Overlay2D {
id: gizmoLabel
targetNode: gizmoModel
targetView: view3D
offsetX: 0
offsetY: 0
visible: iconGizmo.visible && !isBehindCamera
parent: view3D
Rectangle {
width: 24
height: 24
x: -width / 2
y: -height
color: "transparent"
border.color: "#7777ff"
border.width: highlightOnHover && iconMouseArea.containsMouse ? 2 : 0
radius: 5
Image {
id: iconImage
anchors.fill: parent
MouseArea {
id: iconMouseArea
anchors.fill: parent
onClicked: selected(targetNode)
hoverEnabled: highlightOnHover
}
}
}
}
}

View File

@@ -0,0 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.0
import QtQuick3D 1.0
IconGizmo {
id: lightGizmo
iconSource: "qrc:///qtquickplugin/mockfiles/images/light-pick-icon.png"
gizmoModel.source: "#Sphere"
gizmoModel.materials: [
DefaultMaterial {
id: defaultMaterial
emissiveColor: "yellow"
lighting: DefaultMaterial.NoLighting
}
]
}

View File

@@ -25,56 +25,131 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick3D 1.0 import QtQuick3D 1.0
import MouseArea3D 1.0
Node { Node {
id: arrows id: moveGizmo
property View3D view3D property View3D view3D
property bool highlightOnHover: false property bool highlightOnHover: false
property Node targetNode: null property Node targetNode: null
readonly property bool isDragging: arrowX.isDragging || arrowY.isDragging || arrowZ.isDragging property bool globalOrientation: true
readonly property bool dragging: arrowX.dragging || arrowY.dragging || arrowZ.dragging
scale: Qt.vector3d(5, 5, 5) || centerMouseArea.dragging
property alias arrowX: arrowX
property alias arrowY: arrowY
property alias arrowZ: arrowZ
signal positionCommit() signal positionCommit()
signal positionMove()
Node {
rotation: globalOrientation || !targetNode ? Qt.vector3d(0, 0, 0) : targetNode.sceneRotation
Arrow { Arrow {
id: arrowX id: arrowX
objectName: "Arrow X" objectName: "Arrow X"
rotation: Qt.vector3d(0, -90, 0) rotation: Qt.vector3d(0, 0, -90)
targetNode: arrows.targetNode targetNode: moveGizmo.targetNode
color: highlightOnHover && hovering ? Qt.lighter(Qt.rgba(1, 0, 0, 1)) color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(1, 0, 0, 1))
: Qt.rgba(1, 0, 0, 1) : Qt.rgba(1, 0, 0, 1)
view3D: arrows.view3D view3D: moveGizmo.view3D
onPositionCommit: arrows.positionCommit() onPositionCommit: moveGizmo.positionCommit()
onPositionMove: moveGizmo.positionMove()
} }
Arrow { Arrow {
id: arrowY id: arrowY
objectName: "Arrow Y" objectName: "Arrow Y"
rotation: Qt.vector3d(90, 0, 0) rotation: Qt.vector3d(0, 0, 0)
targetNode: arrows.targetNode targetNode: moveGizmo.targetNode
color: highlightOnHover && hovering ? Qt.lighter(Qt.rgba(0, 0, 1, 1)) color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0, 1, 1))
: Qt.rgba(0, 0, 1, 1) : Qt.rgba(0, 0, 1, 1)
view3D: arrows.view3D view3D: moveGizmo.view3D
onPositionCommit: arrows.positionCommit() onPositionCommit: moveGizmo.positionCommit()
onPositionMove: moveGizmo.positionMove()
} }
Arrow { Arrow {
id: arrowZ id: arrowZ
objectName: "Arrow Z" objectName: "Arrow Z"
rotation: Qt.vector3d(0, 180, 0) rotation: Qt.vector3d(90, 0, 0)
targetNode: arrows.targetNode targetNode: moveGizmo.targetNode
color: highlightOnHover && hovering ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1)) color: highlightOnHover && (hovering || dragging) ? Qt.lighter(Qt.rgba(0, 0.6, 0, 1))
: Qt.rgba(0, 0.6, 0, 1) : Qt.rgba(0, 0.6, 0, 1)
view3D: arrows.view3D view3D: moveGizmo.view3D
onPositionCommit: arrows.positionCommit() onPositionCommit: moveGizmo.positionCommit()
onPositionMove: moveGizmo.positionMove()
}
}
Model {
id: centerBall
source: "#Sphere"
scale: Qt.vector3d(0.024, 0.024, 0.024)
materials: DefaultMaterial {
id: material
emissiveColor: highlightOnHover
&& (centerMouseArea.hovering || centerMouseArea.dragging)
? Qt.lighter(Qt.rgba(0.5, 0.5, 0.5, 1))
: Qt.rgba(0.5, 0.5, 0.5, 1)
lighting: DefaultMaterial.NoLighting
}
MouseArea3D {
id: centerMouseArea
view3D: moveGizmo.view3D
x: -60
y: -60
width: 120
height: 120
rotation: view3D.camera.rotation
grabsMouse: moveGizmo.targetNode
priority: 1
property var _pointerPosPressed
property var _targetStartPos
function posInParent(pointerPosition)
{
var scenePointerPos = mapPositionToScene(pointerPosition);
var sceneRelativeDistance = Qt.vector3d(
scenePointerPos.x - _pointerPosPressed.x,
scenePointerPos.y - _pointerPosPressed.y,
scenePointerPos.z - _pointerPosPressed.z);
var newScenePos = Qt.vector3d(
_targetStartPos.x + sceneRelativeDistance.x,
_targetStartPos.y + sceneRelativeDistance.y,
_targetStartPos.z + sceneRelativeDistance.z);
return moveGizmo.targetNode.parent.mapPositionFromScene(newScenePos);
}
onPressed: {
if (!moveGizmo.targetNode)
return;
_pointerPosPressed = mapPositionToScene(pointerPosition);
var sp = moveGizmo.targetNode.scenePosition;
_targetStartPos = Qt.vector3d(sp.x, sp.y, sp.z);
}
onDragged: {
if (!moveGizmo.targetNode)
return;
moveGizmo.targetNode.position = posInParent(pointerPosition);
moveGizmo.positionMove();
}
onReleased: {
if (!moveGizmo.targetNode)
return;
moveGizmo.targetNode.position = posInParent(pointerPosition);
moveGizmo.positionCommit();
}
}
} }
} }

View File

@@ -34,6 +34,8 @@ Item {
property real offsetX: 0 property real offsetX: 0
property real offsetY: 0 property real offsetY: 0
property bool isBehindCamera
onTargetNodeChanged: updateOverlay() onTargetNodeChanged: updateOverlay()
Connections { Connections {
@@ -46,13 +48,20 @@ Item {
onSceneTransformChanged: updateOverlay() onSceneTransformChanged: updateOverlay()
} }
Connections {
target: designStudioNativeCameraControlHelper
onOverlayUpdateNeeded: updateOverlay()
}
function updateOverlay() function updateOverlay()
{ {
var scenePos = targetNode.scenePosition; var scenePos = targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0);
var scenePosWithOffset = Qt.vector3d(scenePos.x + offsetX, scenePos.y + offsetY, scenePos.z); var scenePosWithOffset = Qt.vector3d(scenePos.x + offsetX, scenePos.y + offsetY, scenePos.z);
var viewPos = targetView.mapFrom3DScene(scenePosWithOffset); var viewPos = targetView ? targetView.mapFrom3DScene(scenePosWithOffset)
: Qt.vector3d(0, 0, 0);
root.x = viewPos.x; root.x = viewPos.x;
root.y = viewPos.y; root.y = viewPos.y;
root.z = 100000 - viewPos.z; // flip left-handed to right-handed
isBehindCamera = viewPos.z <= 0;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

View File

@@ -30,10 +30,14 @@ namespace Internal {
CameraControlHelper::CameraControlHelper() CameraControlHelper::CameraControlHelper()
: QObject() : QObject()
{ {
m_timer.setInterval(16); m_inputUpdateTimer.setInterval(16);
m_timer.setSingleShot(false); QObject::connect(&m_inputUpdateTimer, &QTimer::timeout,
QObject::connect(&m_timer, &QTimer::timeout,
this, &CameraControlHelper::handleUpdateTimer); this, &CameraControlHelper::handleUpdateTimer);
m_overlayUpdateTimer.setInterval(16);
m_overlayUpdateTimer.setSingleShot(true);
QObject::connect(&m_overlayUpdateTimer, &QTimer::timeout,
this, &CameraControlHelper::overlayUpdateNeeded);
} }
bool CameraControlHelper::enabled() bool CameraControlHelper::enabled()
@@ -49,11 +53,17 @@ void CameraControlHelper::handleUpdateTimer()
void CameraControlHelper::setEnabled(bool enabled) void CameraControlHelper::setEnabled(bool enabled)
{ {
if (enabled) if (enabled)
m_timer.start(); m_inputUpdateTimer.start();
else else
m_timer.stop(); m_inputUpdateTimer.stop();
m_enabled = enabled; m_enabled = enabled;
} }
void CameraControlHelper::requestOverlayUpdate()
{
if (!m_overlayUpdateTimer.isActive())
m_overlayUpdateTimer.start();
}
} }
} }

View File

@@ -41,16 +41,20 @@ public:
bool enabled(); bool enabled();
void setEnabled(bool enabled); void setEnabled(bool enabled);
Q_INVOKABLE void requestOverlayUpdate();
public slots: public slots:
void handleUpdateTimer(); void handleUpdateTimer();
signals: signals:
void updateInputs(); void updateInputs();
void enabledChanged(bool enabled); void enabledChanged(bool enabled);
void overlayUpdateNeeded();
private: private:
bool m_enabled = false; bool m_enabled = false;
QTimer m_timer; QTimer m_inputUpdateTimer;
QTimer m_overlayUpdateTimer;
}; };
} }

View File

@@ -80,6 +80,11 @@ qreal MouseArea3D::height() const
return m_height; return m_height;
} }
int MouseArea3D::priority() const
{
return m_priority;
}
void MouseArea3D::setView3D(QQuick3DViewport *view3D) void MouseArea3D::setView3D(QQuick3DViewport *view3D)
{ {
if (m_view3D == view3D) if (m_view3D == view3D)
@@ -134,6 +139,15 @@ void MouseArea3D::setHeight(qreal height)
emit heightChanged(height); emit heightChanged(height);
} }
void MouseArea3D::setPriority(int level)
{
if (m_priority == level)
return;
m_priority = level;
emit priorityChanged(level);
}
void MouseArea3D::componentComplete() void MouseArea3D::componentComplete()
{ {
if (!m_view3D) { if (!m_view3D) {
@@ -193,51 +207,94 @@ QVector3D MouseArea3D::getMousePosInPlane(const QPointF &mousePosInView) const
bool MouseArea3D::eventFilter(QObject *, QEvent *event) bool MouseArea3D::eventFilter(QObject *, QEvent *event)
{ {
switch (event->type()) { if (m_grabsMouse && s_mouseGrab && s_mouseGrab != this
case QEvent::HoverMove: { && (m_priority <= s_mouseGrab->m_priority || s_mouseGrab->m_dragging)) {
if (m_grabsMouse && s_mouseGrab && s_mouseGrab != this) return false;
break; }
auto mouseOnTopOfMouseArea = [this](const QVector3D &mousePosInPlane) -> bool {
return !qFuzzyCompare(mousePosInPlane.z(), -1)
&& mousePosInPlane.x() >= float(m_x)
&& mousePosInPlane.x() <= float(m_x + m_width)
&& mousePosInPlane.y() >= float(m_y)
&& mousePosInPlane.y() <= float(m_y + m_height);
};
switch (event->type()) {
case QEvent::MouseButtonPress: {
auto const mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton) {
m_mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
if (mouseOnTopOfMouseArea(m_mousePosInPlane)) {
setDragging(true);
emit pressed(m_mousePosInPlane);
if (m_grabsMouse) {
if (s_mouseGrab && s_mouseGrab != this) {
s_mouseGrab->setDragging(false);
s_mouseGrab->setHovering(false);
}
s_mouseGrab = this;
setHovering(true);
}
event->accept();
return true;
}
}
break;
}
case QEvent::MouseButtonRelease: {
auto const mouseEvent = static_cast<QMouseEvent *>(event);
if (mouseEvent->button() == Qt::LeftButton) {
if (m_dragging) {
QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
if (qFuzzyCompare(mousePosInPlane.z(), -1))
mousePosInPlane = m_mousePosInPlane;
setDragging(false);
emit released(mousePosInPlane);
if (m_grabsMouse) {
if (s_mouseGrab && s_mouseGrab != this) {
s_mouseGrab->setDragging(false);
s_mouseGrab->setHovering(false);
}
if (mouseOnTopOfMouseArea(mousePosInPlane)) {
s_mouseGrab = this;
setHovering(true);
} else {
s_mouseGrab = nullptr;
setHovering(false);
}
}
event->accept();
return true;
}
}
break;
}
case QEvent::MouseMove:
case QEvent::HoverMove: {
auto const mouseEvent = static_cast<QMouseEvent *>(event); auto const mouseEvent = static_cast<QMouseEvent *>(event);
const QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos()); const QVector3D mousePosInPlane = getMousePosInPlane(mouseEvent->pos());
if (qFuzzyCompare(mousePosInPlane.z(), -1)) const bool hasMouse = mouseOnTopOfMouseArea(mousePosInPlane);
break;
const bool mouseOnTopOfMouseArea = setHovering(hasMouse);
mousePosInPlane.x() >= float(m_x) &&
mousePosInPlane.x() <= float(m_x + m_width) &&
mousePosInPlane.y() >= float(m_y) &&
mousePosInPlane.y() <= float(m_y + m_height);
const bool buttonPressed = QGuiApplication::mouseButtons().testFlag(Qt::LeftButton); if (m_grabsMouse) {
if (m_hovering && s_mouseGrab && s_mouseGrab != this)
s_mouseGrab->setHovering(false);
// The filter will detect a mouse press on the view, but not a mouse release, since the if (m_hovering || m_dragging)
// former is not accepted by the view, which means that the release will end up being s_mouseGrab = this;
// sent elsewhere. So we need this extra logic inside HoverMove, rather than in else if (s_mouseGrab == this)
// MouseButtonRelease, which would otherwise be more elegant. s_mouseGrab = nullptr;
if (m_hovering != mouseOnTopOfMouseArea) {
m_hovering = mouseOnTopOfMouseArea;
emit hoveringChanged();
} }
if (!m_dragging && m_hovering && buttonPressed) { if (m_dragging && !qFuzzyCompare(mousePosInPlane.z(), -1)) {
m_dragging = true; m_mousePosInPlane = mousePosInPlane;
emit pressed(mousePosInPlane);
emit draggingChanged();
} else if (m_dragging && !buttonPressed) {
m_dragging = false;
emit released(mousePosInPlane);
emit draggingChanged();
}
if (m_grabsMouse)
s_mouseGrab = m_hovering || m_dragging ? this : nullptr;
if (m_dragging)
emit dragged(mousePosInPlane); emit dragged(mousePosInPlane);
}
break; } break;
}
default: default:
break; break;
} }
@@ -245,6 +302,24 @@ bool MouseArea3D::eventFilter(QObject *, QEvent *event)
return false; return false;
} }
void MouseArea3D::setDragging(bool enable)
{
if (m_dragging == enable)
return;
m_dragging = enable;
emit draggingChanged();
}
void MouseArea3D::setHovering(bool enable)
{
if (m_hovering == enable)
return;
m_hovering = enable;
emit hoveringChanged();
}
} }
} }

View File

@@ -48,6 +48,7 @@ class MouseArea3D : public QQuick3DNode
Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged)
Q_PROPERTY(bool hovering READ hovering NOTIFY hoveringChanged) Q_PROPERTY(bool hovering READ hovering NOTIFY hoveringChanged)
Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged) Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged)
Q_INTERFACES(QQmlParserStatus) Q_INTERFACES(QQmlParserStatus)
@@ -60,6 +61,7 @@ public:
qreal y() const; qreal y() const;
qreal width() const; qreal width() const;
qreal height() const; qreal height() const;
int priority() const;
bool hovering() const; bool hovering() const;
bool dragging() const; bool dragging() const;
@@ -73,6 +75,7 @@ public slots:
void setY(qreal y); void setY(qreal y);
void setWidth(qreal width); void setWidth(qreal width);
void setHeight(qreal height); void setHeight(qreal height);
void setPriority(int level);
Q_INVOKABLE QVector3D rayIntersectsPlane(const QVector3D &rayPos0, Q_INVOKABLE QVector3D rayIntersectsPlane(const QVector3D &rayPos0,
const QVector3D &rayPos1, const QVector3D &rayPos1,
@@ -86,6 +89,7 @@ signals:
void yChanged(qreal y); void yChanged(qreal y);
void widthChanged(qreal width); void widthChanged(qreal width);
void heightChanged(qreal height); void heightChanged(qreal height);
void priorityChanged(int level);
void hoveringChanged(); void hoveringChanged();
void draggingChanged(); void draggingChanged();
@@ -100,6 +104,9 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override;
private: private:
void setDragging(bool enable);
void setHovering(bool enable);
Q_DISABLE_COPY(MouseArea3D) Q_DISABLE_COPY(MouseArea3D)
QQuick3DViewport *m_view3D = nullptr; QQuick3DViewport *m_view3D = nullptr;
@@ -107,6 +114,7 @@ private:
qreal m_y; qreal m_y;
qreal m_width; qreal m_width;
qreal m_height; qreal m_height;
int m_priority = 0;
bool m_hovering = false; bool m_hovering = false;
bool m_dragging = false; bool m_dragging = false;
@@ -115,6 +123,7 @@ private:
static MouseArea3D *s_mouseGrab; static MouseArea3D *s_mouseGrab;
bool m_grabsMouse; bool m_grabsMouse;
QVector3D m_mousePosInPlane;
}; };
} }

View File

@@ -396,6 +396,11 @@ void ObjectNodeInstance::setHideInEditor(bool)
{ {
} }
void ObjectNodeInstance::setModifiedFlag(bool b)
{
m_isModified = b;
}
QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name) QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name)
{ {
Q_ASSERT(value.canConvert<Enumeration>()); Q_ASSERT(value.canConvert<Enumeration>());
@@ -420,6 +425,9 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
if (ignoredProperties().contains(name)) if (ignoredProperties().contains(name))
return; return;
if (m_isModified)
return;
QQmlProperty property(object(), QString::fromUtf8(name), context()); QQmlProperty property(object(), QString::fromUtf8(name), context());
if (!property.isValid()) if (!property.isValid())

View File

@@ -195,6 +195,8 @@ public:
void virtual setHideInEditor(bool b); void virtual setHideInEditor(bool b);
void setModifiedFlag(bool b);
protected: protected:
explicit ObjectNodeInstance(QObject *object); explicit ObjectNodeInstance(QObject *object);
void doResetProperty(const PropertyName &propertyName); void doResetProperty(const PropertyName &propertyName);
@@ -220,6 +222,7 @@ private:
qint32 m_instanceId; qint32 m_instanceId;
bool m_deleteHeldInstance; bool m_deleteHeldInstance;
bool m_isInLayoutable; bool m_isInLayoutable;
bool m_isModified = false;
static QHash<EnumerationName, QVariant> m_enumationValueHash; static QHash<EnumerationName, QVariant> m_enumationValueHash;
}; };

View File

@@ -56,6 +56,7 @@
#include "tokencommand.h" #include "tokencommand.h"
#include "removesharedmemorycommand.h" #include "removesharedmemorycommand.h"
#include "changeselectioncommand.h" #include "changeselectioncommand.h"
#include "objectnodeinstance.h"
#include "dummycontextobject.h" #include "dummycontextobject.h"
#include "../editor3d/cameracontrolhelper.h" #include "../editor3d/cameracontrolhelper.h"
@@ -98,6 +99,10 @@ QObject *Qt5InformationNodeInstanceServer::createEditView3D(QQmlEngine *engine)
QObject::connect(window, SIGNAL(objectClicked(QVariant)), this, SLOT(objectClicked(QVariant))); QObject::connect(window, SIGNAL(objectClicked(QVariant)), this, SLOT(objectClicked(QVariant)));
QObject::connect(window, SIGNAL(commitObjectPosition(QVariant)), QObject::connect(window, SIGNAL(commitObjectPosition(QVariant)),
this, SLOT(handleObjectPositionCommit(QVariant))); this, SLOT(handleObjectPositionCommit(QVariant)));
QObject::connect(window, SIGNAL(moveObjectPosition(QVariant)),
this, SLOT(handleObjectPositionMove(QVariant)));
QObject::connect(&m_moveTimer, &QTimer::timeout,
this, &Qt5InformationNodeInstanceServer::handleObjectPositionMoveTimeout);
//For macOS we have to use the 4.1 core profile //For macOS we have to use the 4.1 core profile
QSurfaceFormat surfaceFormat = window->requestedFormat(); QSurfaceFormat surfaceFormat = window->requestedFormat();
@@ -149,21 +154,62 @@ Qt5InformationNodeInstanceServer::vectorToPropertyValue(
return result; return result;
} }
void Qt5InformationNodeInstanceServer::modifyVariantValue(
const QVariant &node,
const PropertyName &propertyName,
ValuesModifiedCommand::TransactionOption option)
{
PropertyName targetPopertyName;
// Position is a special case, because the position can be 'position.x 'or simply 'x'.
// We prefer 'x'.
if (propertyName != "position")
targetPopertyName = propertyName;
auto *obj = node.value<QObject *>();
if (obj) {
ServerNodeInstance instance = instanceForObject(obj);
if (option == ValuesModifiedCommand::TransactionOption::Start)
instance.setModifiedFlag(true);
else if (option == ValuesModifiedCommand::TransactionOption::End)
instance.setModifiedFlag(false);
// We do have to split position into position.x, position.y, position.z
ValuesModifiedCommand command = createValuesModifiedCommand(vectorToPropertyValue(
instance,
targetPopertyName,
obj->property(propertyName)));
command.transactionOption = option;
nodeInstanceClient()->valuesModified(command);
}
}
void Qt5InformationNodeInstanceServer::handleObjectPositionCommit(const QVariant &object) void Qt5InformationNodeInstanceServer::handleObjectPositionCommit(const QVariant &object)
{ {
auto *obj = object.value<QObject *>(); modifyVariantValue(object, "position", ValuesModifiedCommand::TransactionOption::End);
if (obj) { m_movedNode = {};
/* We do have to split position into position.x, position.y, position.z */ m_moveTimer.stop();
nodeInstanceClient()->valuesModified(createValuesModifiedCommand(vectorToPropertyValue( }
instanceForObject(obj),
"position", void Qt5InformationNodeInstanceServer::handleObjectPositionMove(const QVariant &object)
obj->property("position")))); {
if (m_movedNode.isNull()) {
modifyVariantValue(object, "position", ValuesModifiedCommand::TransactionOption::Start);
} else {
if (!m_moveTimer.isActive())
m_moveTimer.start();
} }
m_movedNode = object;
} }
Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
Qt5NodeInstanceServer(nodeInstanceClient) Qt5NodeInstanceServer(nodeInstanceClient)
{ {
m_moveTimer.setInterval(100);
} }
void Qt5InformationNodeInstanceServer::sendTokenBack() void Qt5InformationNodeInstanceServer::sendTokenBack()
@@ -236,6 +282,11 @@ void Qt5InformationNodeInstanceServer::modifyProperties(
nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties)); nodeInstanceClient()->valuesModified(createValuesModifiedCommand(properties));
} }
void Qt5InformationNodeInstanceServer::handleObjectPositionMoveTimeout()
{
modifyVariantValue(m_movedNode, "position", ValuesModifiedCommand::TransactionOption::None);
}
QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport( QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport(
const QList<ServerNodeInstance> &instanceList) const const QList<ServerNodeInstance> &instanceList) const
{ {
@@ -252,6 +303,19 @@ QObject *Qt5InformationNodeInstanceServer::findRootNodeOf3DViewport(
return nullptr; return nullptr;
} }
void Qt5InformationNodeInstanceServer::findCamerasAndLights(
const QList<ServerNodeInstance> &instanceList,
QObjectList &cameras, QObjectList &lights) const
{
QObjectList objList;
for (const ServerNodeInstance &instance : instanceList) {
if (instance.isSubclassOf("QQuick3DCamera"))
cameras << instance.internalObject();
else if (instance.isSubclassOf("QQuick3DAbstractLight"))
lights << instance.internalObject();
}
}
void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeInstance> &instanceList) void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeInstance> &instanceList)
{ {
ServerNodeInstance root = rootNodeInstance(); ServerNodeInstance root = rootNodeInstance();
@@ -279,6 +343,19 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
parentProperty.write(objectToVariant(m_editView3D)); parentProperty.write(objectToVariant(m_editView3D));
QQmlProperty completeSceneProperty(m_editView3D, "showLight", context()); QQmlProperty completeSceneProperty(m_editView3D, "showLight", context());
completeSceneProperty.write(showCustomLight); completeSceneProperty.write(showCustomLight);
// Create camera and light gizmos
QObjectList cameras;
QObjectList lights;
findCamerasAndLights(instanceList, cameras, lights);
for (auto &obj : qAsConst(cameras)) {
QMetaObject::invokeMethod(m_editView3D, "addCameraGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
}
for (auto &obj : qAsConst(lights)) {
QMetaObject::invokeMethod(m_editView3D, "addLightGizmo",
Q_ARG(QVariant, objectToVariant(obj)));
}
} }
} }
@@ -471,4 +548,21 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm
} }
} }
void Qt5InformationNodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command)
{
bool hasDynamicProperties = false;
const QVector<PropertyValueContainer> values = command.valueChanges();
for (const PropertyValueContainer &container : values) {
if (!container.isReflected()) {
hasDynamicProperties |= container.isDynamic();
setInstancePropertyVariant(container);
}
}
if (hasDynamicProperties)
refreshBindings();
startRenderTimer();
}
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -27,6 +27,10 @@
#include "qt5nodeinstanceserver.h" #include "qt5nodeinstanceserver.h"
#include "tokencommand.h" #include "tokencommand.h"
#include "valueschangedcommand.h"
#include <QTimer>
#include <QVariant>
namespace QmlDesigner { namespace QmlDesigner {
@@ -43,10 +47,12 @@ public:
void token(const TokenCommand &command) override; void token(const TokenCommand &command) override;
void removeSharedMemory(const RemoveSharedMemoryCommand &command) override; void removeSharedMemory(const RemoveSharedMemoryCommand &command) override;
void changeSelection(const ChangeSelectionCommand &command) override; void changeSelection(const ChangeSelectionCommand &command) override;
void changePropertyValues(const ChangeValuesCommand &command) override;
private slots: private slots:
void objectClicked(const QVariant &object); void objectClicked(const QVariant &object);
void handleObjectPositionCommit(const QVariant &object); void handleObjectPositionCommit(const QVariant &object);
void handleObjectPositionMove(const QVariant &object);
protected: protected:
void collectItemChangesAndSendChangeCommands() override; void collectItemChangesAndSendChangeCommands() override;
@@ -58,17 +64,25 @@ protected:
void modifyProperties(const QVector<InstancePropertyValueTriple> &properties); void modifyProperties(const QVector<InstancePropertyValueTriple> &properties);
private: private:
void handleObjectPositionMoveTimeout();
QObject *createEditView3D(QQmlEngine *engine); QObject *createEditView3D(QQmlEngine *engine);
void setup3DEditView(const QList<ServerNodeInstance> &instanceList); void setup3DEditView(const QList<ServerNodeInstance> &instanceList);
QObject *findRootNodeOf3DViewport(const QList<ServerNodeInstance> &instanceList) const; QObject *findRootNodeOf3DViewport(const QList<ServerNodeInstance> &instanceList) const;
void findCamerasAndLights( const QList<ServerNodeInstance> &instanceList,
QObjectList &cameras, QObjectList &lights) const;
QVector<InstancePropertyValueTriple> vectorToPropertyValue(const ServerNodeInstance &instance, QVector<InstancePropertyValueTriple> vectorToPropertyValue(const ServerNodeInstance &instance,
const PropertyName &propertyName, const PropertyName &propertyName,
const QVariant &variant); const QVariant &variant);
void modifyVariantValue(const QVariant &node,
const PropertyName &propertyName,
ValuesModifiedCommand::TransactionOption option);
QObject *m_editView3D = nullptr; QObject *m_editView3D = nullptr;
QSet<ServerNodeInstance> m_parentChangedSet; QSet<ServerNodeInstance> m_parentChangedSet;
QList<ServerNodeInstance> m_completedComponentList; QList<ServerNodeInstance> m_completedComponentList;
QList<TokenCommand> m_tokenList; QList<TokenCommand> m_tokenList;
QTimer m_moveTimer;
QVariant m_movedNode;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -129,6 +129,11 @@ bool ServerNodeInstance::isSubclassOf(QObject *object, const QByteArray &superTy
return Internal::QmlPrivateGate::isSubclassOf(object, superTypeName); return Internal::QmlPrivateGate::isSubclassOf(object, superTypeName);
} }
void ServerNodeInstance::setModifiedFlag(bool b)
{
m_nodeInstance->setModifiedFlag(b);
}
void ServerNodeInstance::setNodeSource(const QString &source) void ServerNodeInstance::setNodeSource(const QString &source)
{ {
m_nodeInstance->setNodeSource(source); m_nodeInstance->setNodeSource(source);

View File

@@ -165,6 +165,8 @@ public:
static bool isSubclassOf(QObject *object, const QByteArray &superTypeName); static bool isSubclassOf(QObject *object, const QByteArray &superTypeName);
void setModifiedFlag(bool b);
private: // functions private: // functions
ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance); ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance);

View File

@@ -11,7 +11,14 @@
<file>mockfiles/Arrow.qml</file> <file>mockfiles/Arrow.qml</file>
<file>mockfiles/AutoScaleHelper.qml</file> <file>mockfiles/AutoScaleHelper.qml</file>
<file>mockfiles/MoveGizmo.qml</file> <file>mockfiles/MoveGizmo.qml</file>
<file>mockfiles/CameraGizmo.qml</file>
<file>mockfiles/LightGizmo.qml</file>
<file>mockfiles/IconGizmo.qml</file>
<file>mockfiles/Overlay2D.qml</file> <file>mockfiles/Overlay2D.qml</file>
<file>mockfiles/meshes/Arrow.mesh</file> <file>mockfiles/meshes/arrow.mesh</file>
<file>mockfiles/images/camera-pick-icon.png</file>
<file>mockfiles/images/camera-pick-icon@2x.png</file>
<file>mockfiles/images/light-pick-icon.png</file>
<file>mockfiles/images/light-pick-icon@2x.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -295,6 +295,315 @@ Rectangle {
backendValueRightMargin: backendValues.Layout_rightMargin backendValueRightMargin: backendValues.Layout_rightMargin
backendValueMargins: backendValues.Layout_margins backendValueMargins: backendValues.Layout_margins
} }
Section {
visible: !anchorBackend.isInLayout
anchors.left: parent.left
anchors.right: parent.right
caption: qsTr("Align")
ColumnLayout {
width: parent.width
enabled: alignDistribute.multiSelection &&
!alignDistribute.selectionHasAnchors &&
alignDistribute.selectionExclusivlyItems &&
!alignDistribute.selectionContainsRootItem
AlignDistribute {
id: alignDistribute
modelNodeBackendProperty: modelNodeBackend
}
Label {
text: qsTr("Align objects")
width: 120
}
RowLayout {
Row {
spacing: -StudioTheme.Values.border
AbstractButton {
buttonIcon: StudioTheme.Constants.alignLeft
tooltip: qsTr("Align objects to left edge")
onClicked: alignDistribute.alignObjects(AlignDistribute.Left,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.alignCenterHorizontal
tooltip: qsTr("Align objects horizontal center")
onClicked: alignDistribute.alignObjects(AlignDistribute.CenterH,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.alignRight
tooltip: qsTr("Align objects to right edge")
onClicked: alignDistribute.alignObjects(AlignDistribute.Right,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
}
Row {
spacing: -StudioTheme.Values.border
AbstractButton {
buttonIcon: StudioTheme.Constants.alignTop
tooltip: qsTr("Align objects to top edge")
onClicked: alignDistribute.alignObjects(AlignDistribute.Top,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.alignCenterVertical
tooltip: qsTr("Align objects vertical center")
onClicked: alignDistribute.alignObjects(AlignDistribute.CenterV,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.alignBottom
tooltip: qsTr("Align objects to bottom edge")
onClicked: alignDistribute.alignObjects(AlignDistribute.Bottom,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
}
}
Label {
text: qsTr("Distribute objects")
width: 120
}
RowLayout {
Row {
spacing: -StudioTheme.Values.border
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeLeft
tooltip: qsTr("Distribute objects left edge")
onClicked: alignDistribute.distributeObjects(AlignDistribute.Left,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeCenterHorizontal
tooltip: qsTr("Distribute objects horizontal center")
onClicked: alignDistribute.distributeObjects(AlignDistribute.CenterH,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeRight
tooltip: qsTr("Distribute objects right edge")
onClicked: alignDistribute.distributeObjects(AlignDistribute.Right,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
}
Row {
spacing: -StudioTheme.Values.border
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeTop
tooltip: qsTr("Distribute objects top edge")
onClicked: alignDistribute.distributeObjects(AlignDistribute.Top,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeCenterVertical
tooltip: qsTr("Distribute objects vertical center")
onClicked: alignDistribute.distributeObjects(AlignDistribute.CenterV,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeBottom
tooltip: qsTr("Distribute objects bottom edge")
onClicked: alignDistribute.distributeObjects(AlignDistribute.Bottom,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText)
}
}
}
Label {
text: qsTr("Distribute spacing")
width: 120
}
RowLayout {
Row {
spacing: -StudioTheme.Values.border
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeSpacingHorizontal
tooltip: qsTr("Distribute spacing horizontal")
onClicked: alignDistribute.distributeSpacing(AlignDistribute.X,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText,
distanceSpinBox.realValue,
buttonRow.getDistributeDirection())
}
AbstractButton {
buttonIcon: StudioTheme.Constants.distributeSpacingVertical
tooltip: qsTr("Distribute spacing vertical")
onClicked: alignDistribute.distributeSpacing(AlignDistribute.Y,
alignToComboBox.currentEnum,
keyObjectComboBox.currentText,
distanceSpinBox.realValue,
buttonRow.getDistributeDirection())
}
}
StudioControls.ButtonRow {
id: buttonRow
actionIndicatorVisible: false
StudioControls.ButtonGroup {
id: group
}
function getDistributeDirection()
{
if (buttonLeftToRight.checked)
return AlignDistribute.TopLeft
else if (buttonCenter.checked)
return AlignDistribute.Center
else if (buttonRightToLeft.checked)
return AlignDistribute.BottomRight
else
return AlignDistribute.None
}
AbstractButton {
id: buttonNone
checked: true // default state
buttonIcon: StudioTheme.Constants.distributeOriginNone
checkable: true
StudioControls.ButtonGroup.group: group
}
AbstractButton {
id: buttonLeftToRight
buttonIcon: StudioTheme.Constants.distributeOriginTopLeft
checkable: true
StudioControls.ButtonGroup.group: group
}
AbstractButton {
id: buttonCenter
buttonIcon: StudioTheme.Constants.distributeOriginCenter
checkable: true
StudioControls.ButtonGroup.group: group
}
AbstractButton {
id: buttonRightToLeft
buttonIcon: StudioTheme.Constants.distributeOriginBottomRight
checkable: true
StudioControls.ButtonGroup.group: group
}
StudioControls.RealSpinBox {
id: distanceSpinBox
width: 64
actionIndicatorVisible: false
realFrom: -1000
realTo: 1000
enabled: !buttonNone.checked
}
}
}
SectionLayout {
columns: 2
ItemFilterModel {
id: itemFilterModel
modelNodeBackendProperty: modelNodeBackend
selectionOnly: true
}
Label {
text: qsTr("Align to")
}
ComboBox {
id: alignToComboBox
Layout.fillWidth: true
property int currentEnum: alignTargets.get(alignToComboBox.currentIndex).value
textRole: "text"
model: ListModel {
id: alignTargets
ListElement { text: "Selection"; value: AlignDistribute.Selection }
ListElement { text: "Root"; value: AlignDistribute.Root }
ListElement { text: "Key object"; value: AlignDistribute.KeyObject }
}
}
Label {
text: qsTr("Key object")
}
ComboBox {
id: keyObjectComboBox
enabled: alignToComboBox.currentIndex === 2
model: itemFilterModel.itemModel
Layout.fillWidth: true
property string lastSelectedItem: ""
onCompressedActivated: lastSelectedItem = keyObjectComboBox.currentText
onModelChanged: {
var idx = model.indexOf(keyObjectComboBox.lastSelectedItem)
if (idx !== -1)
keyObjectComboBox.currentIndex = idx
else
lastSelectedItem = "" // TODO
}
}
}
SectionLayout {
columns: 1
Layout.topMargin: 30
visible: alignDistribute.multiSelection &&
(alignDistribute.selectionHasAnchors ||
!alignDistribute.selectionExclusivlyItems ||
alignDistribute.selectionContainsRootItem)
Text {
id: warningTitle
font.family: StudioTheme.Constants.font.family
font.pixelSize: StudioTheme.Values.myFontSize
font.weight: Font.Bold
color: StudioTheme.Values.themeTextColor
text: qsTr("Warning")
}
Text {
id: warningRoot
visible: alignDistribute.selectionContainsRootItem
Layout.fillWidth: true
font.family: StudioTheme.Constants.font.family
font.pixelSize: StudioTheme.Values.myFontSize
color: StudioTheme.Values.themeTextColor
wrapMode: Text.WordWrap
text: qsTr("- The selection contains the root item.")
}
Text {
id: warningNonVisual
visible: !alignDistribute.selectionExclusivlyItems
Layout.fillWidth: true
font.family: StudioTheme.Constants.font.family
font.pixelSize: StudioTheme.Values.myFontSize
color: StudioTheme.Values.themeTextColor
wrapMode: Text.WordWrap
text: qsTr("- The selection contains a non visual item.")
}
Text {
id: warningAnchors
visible: alignDistribute.selectionHasAnchors
Layout.fillWidth: true
font.family: StudioTheme.Constants.font.family
font.pixelSize: StudioTheme.Values.myFontSize
color: StudioTheme.Values.themeTextColor
wrapMode: Text.WordWrap
text: qsTr("- An item in the selection uses anchors.")
}
}
}
}
} }
} }

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import HelperWidgets 2.0 import HelperWidgets 2.0
import StudioControls 1.0 as StudioControls import StudioControls 1.0 as StudioControls
import StudioTheme 1.0 as StudioTheme
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
@@ -145,8 +146,7 @@ RowLayout {
} }
StudioControls.AbstractButton { StudioControls.AbstractButton {
buttonIcon: "..." buttonIcon: StudioTheme.Constants.addFile
iconFont: StudioTheme.Constants.font.family
iconColor: urlChooser.textColor iconColor: urlChooser.textColor
onClicked: { onClicked: {
fileModel.openFileDialog() fileModel.openFileDialog()

View File

@@ -38,29 +38,50 @@ QtObject {
readonly property string actionIcon: "\u0021" readonly property string actionIcon: "\u0021"
readonly property string actionIconBinding: "\u0022" readonly property string actionIconBinding: "\u0022"
readonly property string anchorBaseline: "\u0023" readonly property string addFile: "\u0023"
readonly property string anchorBottom: "\u0024" readonly property string alignBottom: "\u0024"
readonly property string anchorFill: "\u0025" readonly property string alignCenterHorizontal: "\u0025"
readonly property string anchorLeft: "\u0026" readonly property string alignCenterVertical: "\u0026"
readonly property string anchorRight: "\u0027" readonly property string alignLeft: "\u0027"
readonly property string anchorTop: "\u0028" readonly property string alignRight: "\u0028"
readonly property string centerHorizontal: "\u002A" readonly property string alignTo: "\u0029"
readonly property string centerVertical: "\u0029" readonly property string alignTop: "\u002A"
readonly property string closeCross: "\u002B" readonly property string anchorBaseline: "\u002B"
readonly property string fontStyleBold: "\u002C" readonly property string anchorBottom: "\u002C"
readonly property string fontStyleItalic: "\u002D" readonly property string anchorFill: "\u002D"
readonly property string fontStyleStrikethrough: "\u002E" readonly property string anchorLeft: "\u002E"
readonly property string fontStyleUnderline: "\u002F" readonly property string anchorRight: "\u002F"
readonly property string textAlignBottom: "\u0030" readonly property string anchorTop: "\u0030"
readonly property string textAlignCenter: "\u0031" readonly property string centerHorizontal: "\u0031"
readonly property string textAlignLeft: "\u0032" readonly property string centerVertical: "\u0032"
readonly property string textAlignMiddle: "\u0033" readonly property string closeCross: "\u0033"
readonly property string textAlignRight: "\u0034" readonly property string distributeBottom: "\u0034"
readonly property string textAlignTop: "\u0035" readonly property string distributeCenterHorizontal: "\u0035"
readonly property string tickIcon: "\u0036" readonly property string distributeCenterVertical: "\u0036"
readonly property string triState: "\u0037" readonly property string distributeLeft: "\u0037"
readonly property string upDownIcon: "\u0038" readonly property string distributeOriginBottomRight: "\u0038"
readonly property string upDownSquare2: "\u0039" readonly property string distributeOriginCenter: "\u0039"
readonly property string distributeOriginNone: "\u003A"
readonly property string distributeOriginTopLeft: "\u003B"
readonly property string distributeRight: "\u003C"
readonly property string distributeSpacingHorizontal: "\u003D"
readonly property string distributeSpacingVertical: "\u003E"
readonly property string distributeTop: "\u003F"
readonly property string fontStyleBold: "\u0040"
readonly property string fontStyleItalic: "\u0041"
readonly property string fontStyleStrikethrough: "\u0042"
readonly property string fontStyleUnderline: "\u0043"
readonly property string testIcon: "\u0044"
readonly property string textAlignBottom: "\u0045"
readonly property string textAlignCenter: "\u0046"
readonly property string textAlignLeft: "\u0047"
readonly property string textAlignMiddle: "\u0048"
readonly property string textAlignRight: "\u0049"
readonly property string textAlignTop: "\u004A"
readonly property string tickIcon: "\u004B"
readonly property string triState: "\u004C"
readonly property string upDownIcon: "\u004D"
readonly property string upDownSquare2: "\u004E"
readonly property font iconFont: Qt.font({ readonly property font iconFont: Qt.font({
"family": controlIcons.name, "family": controlIcons.name,

View File

@@ -12,5 +12,8 @@ add_qtc_library(ExtensionSystem
pluginmanager.cpp pluginmanager.h pluginmanager_p.h pluginmanager.cpp pluginmanager.h pluginmanager_p.h
pluginspec.cpp pluginspec.h pluginspec_p.h pluginspec.cpp pluginspec.h pluginspec_p.h
pluginview.cpp pluginview.h pluginview.cpp pluginview.h
EXPLICIT_MOC
pluginmanager.h
pluginmanager_p.h
SKIP_AUTOMOC pluginmanager.cpp SKIP_AUTOMOC pluginmanager.cpp
) )

View File

@@ -338,9 +338,7 @@ bool BuildableHelperLibrary::buildHelper(const BuildHelperArguments &arguments,
log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", log->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary",
"Running %1 %2 ...\n") "Running %1 %2 ...\n")
.arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' ')))); .arg(makeFullPath.toUserOutput(), arguments.makeArguments.join(QLatin1Char(' '))));
if (!runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage)) return runBuildProcess(proc, makeFullPath, arguments.makeArguments, 120, false, log, errorMessage);
return false;
return true;
} }
bool BuildableHelperLibrary::getHelperFileInfoFor(const QStringList &validBinaryFilenames, bool BuildableHelperLibrary::getHelperFileInfoFor(const QStringList &validBinaryFilenames,

View File

@@ -110,6 +110,14 @@ bool DetailsButton::event(QEvent *e)
return false; return false;
} }
void DetailsButton::changeEvent(QEvent *e)
{
if (e->type() == QEvent::EnabledChange) {
m_checkedPixmap = QPixmap();
m_uncheckedPixmap = QPixmap();
}
}
void DetailsButton::paintEvent(QPaintEvent *e) void DetailsButton::paintEvent(QPaintEvent *e)
{ {
QWidget::paintEvent(e); QWidget::paintEvent(e);

View File

@@ -71,6 +71,7 @@ public:
protected: protected:
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
bool event(QEvent *e) override; bool event(QEvent *e) override;
void changeEvent(QEvent *e) override;
private: private:
QPixmap cacheRendering(const QSize &size, bool checked); QPixmap cacheRendering(const QSize &size, bool checked);

View File

@@ -229,6 +229,16 @@ void DetailsWidget::setUseCheckBox(bool b)
d->updateControls(); d->updateControls();
} }
void DetailsWidget::setCheckable(bool b)
{
d->m_summaryCheckBox->setEnabled(b);
}
void DetailsWidget::setExpandable(bool b)
{
d->m_detailsButton->setEnabled(b);
}
void DetailsWidget::setChecked(bool b) void DetailsWidget::setChecked(bool b)
{ {
d->m_summaryCheckBox->setChecked(b); d->m_summaryCheckBox->setChecked(b);

View File

@@ -78,6 +78,8 @@ public:
bool useCheckBox(); bool useCheckBox();
void setUseCheckBox(bool b); void setUseCheckBox(bool b);
void setCheckable(bool b);
void setExpandable(bool b);
void setIcon(const QIcon &icon); void setIcon(const QIcon &icon);
static QPixmap createBackground(const QSize &size, int topHeight, QWidget *widget); static QPixmap createBackground(const QSize &size, int topHeight, QWidget *widget);

View File

@@ -236,16 +236,12 @@ static int cleanupSemanticsScore(const QString &text1, const QString &text2)
static bool isWhitespace(const QChar &c) static bool isWhitespace(const QChar &c)
{ {
if (c == ' ' || c == '\t') return c == ' ' || c == '\t';
return true;
return false;
} }
static bool isNewLine(const QChar &c) static bool isNewLine(const QChar &c)
{ {
if (c == '\n') return c == '\n';
return true;
return false;
} }
/* /*
@@ -719,9 +715,7 @@ static bool diffWithWhitespaceExpandedInEqualities(const QList<Diff> &leftInput,
return false; return false;
*rightOutput = decodeExpandedWhitespace(rightDiffList, *rightOutput = decodeExpandedWhitespace(rightDiffList,
commonRightCodeMap, &ok); commonRightCodeMap, &ok);
if (!ok) return ok;
return false;
return true;
} }
static void appendWithEqualitiesSquashed(const QList<Diff> &leftInput, static void appendWithEqualitiesSquashed(const QList<Diff> &leftInput,

View File

@@ -225,17 +225,13 @@ bool JsonSchema::typeMatches(const QString &expected, const QString &actual)
bool JsonSchema::isCheckableType(const QString &s) bool JsonSchema::isCheckableType(const QString &s)
{ {
if (s == QLatin1String("string") return s == QLatin1String("string")
|| s == QLatin1String("number") || s == QLatin1String("number")
|| s == QLatin1String("integer") || s == QLatin1String("integer")
|| s == QLatin1String("boolean") || s == QLatin1String("boolean")
|| s == QLatin1String("object") || s == QLatin1String("object")
|| s == QLatin1String("array") || s == QLatin1String("array")
|| s == QLatin1String("null")) { || s == QLatin1String("null");
return true;
}
return false;
} }
QStringList JsonSchema::validTypes() const QStringList JsonSchema::validTypes() const

View File

@@ -102,22 +102,14 @@ QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title,
} }
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer
fileDeletedPrompt(const QString &fileName, bool triggerExternally, QWidget *parent) fileDeletedPrompt(const QString &fileName, QWidget *parent)
{ {
const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt", const QString title = QCoreApplication::translate("Utils::fileDeletedPrompt",
"File Has Been Removed"); "File Has Been Removed");
QString msg; QString msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
if (triggerExternally) {
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
"The file %1 has been removed from disk. " "The file %1 has been removed from disk. "
"Do you want to save it under a different name, or close " "Do you want to save it under a different name, or close "
"the editor?").arg(QDir::toNativeSeparators(fileName)); "the editor?").arg(QDir::toNativeSeparators(fileName));
} else {
msg = QCoreApplication::translate("Utils::fileDeletedPrompt",
"The file %1 has been removed from disk. "
"Do you want to save it under a different name, or close "
"the editor?").arg(QDir::toNativeSeparators(fileName));
}
QMessageBox box(QMessageBox::Question, title, msg, QMessageBox::NoButton, parent); QMessageBox box(QMessageBox::Question, title, msg, QMessageBox::NoButton, parent);
QPushButton *close = QPushButton *close =
box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "&Close"), box.addButton(QCoreApplication::translate("Utils::fileDeletedPrompt", "&Close"),

View File

@@ -62,7 +62,6 @@ enum FileDeletedPromptAnswer {
}; };
QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer fileDeletedPrompt(const QString &fileName, QTCREATOR_UTILS_EXPORT FileDeletedPromptAnswer fileDeletedPrompt(const QString &fileName,
bool triggerExternally,
QWidget *parent); QWidget *parent);
} // namespace Utils } // namespace Utils

View File

@@ -80,7 +80,7 @@ void QdbMessageTracker::handleWatchMessage(const QJsonDocument &document)
} }
m_messageCache.append(message); m_messageCache.append(message);
showMessage(tr("Qdb message: %1").arg(message), true); showMessage(tr("QDB message: %1").arg(message), true);
} }
} }

View File

@@ -109,7 +109,7 @@ void QdbWatcher::handleWatchError(QLocalSocket::LocalSocketError error)
if (m_retried) { if (m_retried) {
stop(); stop();
emit watcherError(tr("Could not connect to QDB host server even after trying to start it")); emit watcherError(tr("Could not connect to QDB host server even after trying to start it."));
return; return;
} }
retry(); retry();
@@ -142,7 +142,7 @@ void QdbWatcher::forkHostServer()
return; return;
} }
if (QProcess::startDetached(qdbFilePath.toString(), {"server"})) if (QProcess::startDetached(qdbFilePath.toString(), {"server"}))
showMessage(tr("QDB host server started"), false); showMessage(tr("QDB host server started."), false);
else else
showMessage(tr("Could not start QDB host server in %1").arg(qdbFilePath.toString()), true); showMessage(tr("Could not start QDB host server in %1").arg(qdbFilePath.toString()), true);
} }
@@ -153,7 +153,7 @@ void QdbWatcher::retry()
{ {
QMutexLocker lock(&s_startMutex); QMutexLocker lock(&s_startMutex);
if (!s_startedServer) { if (!s_startedServer) {
showMessage(tr("Starting QDB host server"), false); showMessage(tr("Starting QDB host server."), false);
forkHostServer(); forkHostServer();
s_startedServer = true; s_startedServer = true;
} }

View File

@@ -93,7 +93,7 @@ public:
Runnable r; Runnable r;
r.setCommandLine(command); r.setCommandLine(command);
m_appRunner.start(r, device); m_appRunner.start(r, device);
showMessage(QdbDevice::tr("Starting command '%1' on device '%2'.") showMessage(QdbDevice::tr("Starting command \"%1\" on device \"%2\".")
.arg(command.toUserOutput(), m_deviceName)); .arg(command.toUserOutput(), m_deviceName));
} }
@@ -112,18 +112,18 @@ private:
if (!success) { if (!success) {
QString errorString; QString errorString;
if (!m_error.isEmpty()) { if (!m_error.isEmpty()) {
errorString = QdbDevice::tr("Command failed on device '%1': %2") errorString = QdbDevice::tr("Command failed on device \"%1\": %2")
.arg(m_deviceName, m_error); .arg(m_deviceName, m_error);
} else { } else {
errorString = QdbDevice::tr("Command failed on device '%1'.").arg(m_deviceName); errorString = QdbDevice::tr("Command failed on device \"%1\".").arg(m_deviceName);
} }
showMessage(errorString, true); showMessage(errorString, true);
if (!m_stdout.isEmpty()) if (!m_stdout.isEmpty())
showMessage(QdbDevice::tr("stdout was: '%1'").arg(m_stdout)); showMessage(QdbDevice::tr("stdout was: \"%1\"").arg(m_stdout));
if (!m_stderr.isEmpty()) if (!m_stderr.isEmpty())
showMessage(QdbDevice::tr("stderr was: '%1'").arg(m_stderr)); showMessage(QdbDevice::tr("stderr was: \"%1\"").arg(m_stderr));
} else { } else {
showMessage(QdbDevice::tr("Commands on device '%1' finished successfully.") showMessage(QdbDevice::tr("Commands on device \"%1\" finished successfully.")
.arg(m_deviceName)); .arg(m_deviceName));
} }
deleteLater(); deleteLater();

View File

@@ -77,7 +77,7 @@ void QdbMakeDefaultAppService::handleProcessFinished(const QString &error)
QByteArray processOutput = d->processRunner->readAllStandardOutput(); QByteArray processOutput = d->processRunner->readAllStandardOutput();
if (d->makeDefault) if (d->makeDefault)
emit progressMessage(tr("Application made as the default one.")); emit progressMessage(tr("Application set as the default one."));
else else
emit progressMessage(tr("Reset the default application.")); emit progressMessage(tr("Reset the default application."));

View File

@@ -495,12 +495,13 @@ void ClangTool::startTool(ClangTool::FileSelection fileSelection,
}); });
m_perspective.select(); m_perspective.select();
m_diagnosticModel->clear(); m_diagnosticModel->clear();
setToolBusy(true);
m_diagnosticFilterModel->setProject(project); m_diagnosticFilterModel->setProject(project);
m_applyFixitsButton->setEnabled(false);
m_running = true; m_running = true;
setToolBusy(true);
handleStateUpdate(); handleStateUpdate();
updateRunActions(); updateRunActions();

View File

@@ -227,6 +227,7 @@ ClangToolRunWorker::ClangToolRunWorker(RunControl *runControl,
const FileInfos &fileInfos, const FileInfos &fileInfos,
bool preventBuild) bool preventBuild)
: RunWorker(runControl) : RunWorker(runControl)
, m_runSettings(runSettings)
, m_diagnosticConfig(diagnosticConfig) , m_diagnosticConfig(diagnosticConfig)
, m_fileInfos(fileInfos) , m_fileInfos(fileInfos)
, m_temporaryDir("clangtools-XXXXXX") , m_temporaryDir("clangtools-XXXXXX")
@@ -305,7 +306,7 @@ void ClangToolRunWorker::start()
// Create log dir // Create log dir
if (!m_temporaryDir.isValid()) { if (!m_temporaryDir.isValid()) {
const QString errorMessage const QString errorMessage
= tr("%1: Failed to create temporary dir, stop.").arg(toolName); = tr("%1: Failed to create temporary directory. Stopped.").arg(toolName);
appendMessage(errorMessage, Utils::ErrorMessageFormat); appendMessage(errorMessage, Utils::ErrorMessageFormat);
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup(); TaskHub::requestPopup();
@@ -390,7 +391,7 @@ void ClangToolRunWorker::analyzeNextFile()
const QString executable = runner->executable(); const QString executable = runner->executable();
if (!isFileExecutable(executable)) { if (!isFileExecutable(executable)) {
const QString errorMessage = tr("%1: Invalid executable \"%2\", stop.") const QString errorMessage = tr("%1: Invalid executable \"%2\". Stopped.")
.arg(runner->name(), executable); .arg(runner->name(), executable);
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup(); TaskHub::requestPopup();

View File

@@ -101,10 +101,10 @@ QDebug operator<<(QDebug debug, const Diagnostic &d)
void ClangToolsDiagnosticModel::addDiagnostics(const Diagnostics &diagnostics) void ClangToolsDiagnosticModel::addDiagnostics(const Diagnostics &diagnostics)
{ {
const auto onFixitStatusChanged = [this](FixitStatus newStatus) { const auto onFixitStatusChanged = [this](FixitStatus oldStatus, FixitStatus newStatus) {
if (newStatus == FixitStatus::Scheduled) if (newStatus == FixitStatus::Scheduled)
++m_fixItsToApplyCount; ++m_fixItsToApplyCount;
else else if (oldStatus == FixitStatus::Scheduled)
--m_fixItsToApplyCount; --m_fixItsToApplyCount;
emit fixItsToApplyCountChanged(m_fixItsToApplyCount); emit fixItsToApplyCountChanged(m_fixItsToApplyCount);
}; };
@@ -463,7 +463,7 @@ void DiagnosticItem::setFixItStatus(const FixitStatus &status)
m_fixitStatus = status; m_fixitStatus = status;
update(); update();
if (m_onFixitStatusChanged && status != oldStatus) if (m_onFixitStatusChanged && status != oldStatus)
m_onFixitStatusChanged(status); m_onFixitStatusChanged(oldStatus, status);
} }
void DiagnosticItem::setFixitOperations(const ReplacementOperations &replacements) void DiagnosticItem::setFixitOperations(const ReplacementOperations &replacements)

View File

@@ -71,8 +71,9 @@ private:
class DiagnosticItem : public Utils::TreeItem class DiagnosticItem : public Utils::TreeItem
{ {
public: public:
using OnFixitStatusChanged = std::function<void(FixitStatus newStatus)>; using OnFixitStatusChanged = std::function<void(FixitStatus oldStatus, FixitStatus newStatus)>;
DiagnosticItem(const Diagnostic &diag, const OnFixitStatusChanged &onFixitStatusChanged, DiagnosticItem(const Diagnostic &diag,
const OnFixitStatusChanged &onFixitStatusChanged,
ClangToolsDiagnosticModel *parent); ClangToolsDiagnosticModel *parent);
~DiagnosticItem() override; ~DiagnosticItem() override;

View File

@@ -283,7 +283,7 @@ bool DiagnosticView::eventFilter(QObject *watched, QEvent *event)
return true; return true;
} }
default: default:
return QObject::eventFilter(watched, event); return QAbstractItemView::eventFilter(watched, event);
} }
} }

View File

@@ -105,7 +105,7 @@ void ClangToolsProjectSettings::load()
// Load map // Load map
QVariantMap map = m_project->namedSettings(SETTINGS_KEY_MAIN).toMap(); QVariantMap map = m_project->namedSettings(SETTINGS_KEY_MAIN).toMap();
bool write; bool write = false;
if (map.isEmpty()) { if (map.isEmpty()) {
if (!m_project->namedSettings(SETTINGS_KEY_SELECTED_DIRS).isNull()) { if (!m_project->namedSettings(SETTINGS_KEY_SELECTED_DIRS).isNull()) {
map = convertToMapFromVersionBefore410(m_project); map = convertToMapFromVersionBefore410(m_project);

View File

@@ -333,11 +333,7 @@ bool ParserTreeItem::canFetchMore(QStandardItem *item) const
int storedChildren = item->rowCount(); int storedChildren = item->rowCount();
int internalChildren = d->symbolInformations.count(); int internalChildren = d->symbolInformations.count();
return storedChildren < internalChildren;
if (storedChildren < internalChildren)
return true;
return false;
} }
/*! /*!

View File

@@ -45,10 +45,7 @@ bool CMakeAutoCompleter::isInComment(const QTextCursor &cursor) const
// NOTE: This doesn't handle '#' inside quotes, nor multi-line comments // NOTE: This doesn't handle '#' inside quotes, nor multi-line comments
QTextCursor moved = cursor; QTextCursor moved = cursor;
moved.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor); moved.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor);
if (moved.selectedText().contains(QLatin1Char('#'))) return moved.selectedText().contains(QLatin1Char('#'));
return true;
else
return false;
} }
bool CMakeAutoCompleter::isInString(const QTextCursor &cursor) const bool CMakeAutoCompleter::isInString(const QTextCursor &cursor) const

View File

@@ -151,7 +151,6 @@ void CMakeBuildSystem::handleTreeScanningFinished()
qDeleteAll(m_allFiles); qDeleteAll(m_allFiles);
m_allFiles = Utils::transform(m_treeScanner.release(), [](const FileNode *fn) { return fn; }); m_allFiles = Utils::transform(m_treeScanner.release(), [](const FileNode *fn) { return fn; });
m_combinedScanAndParseResult = m_combinedScanAndParseResult && true;
m_waitingForScan = false; m_waitingForScan = false;
combineScanAndParse(); combineScanAndParse();
@@ -165,7 +164,6 @@ void CMakeBuildSystem::handleParsingSuccess(CMakeBuildConfiguration *bc)
QTC_ASSERT(m_waitingForParse, return ); QTC_ASSERT(m_waitingForParse, return );
m_waitingForParse = false; m_waitingForParse = false;
m_combinedScanAndParseResult = m_combinedScanAndParseResult && true;
combineScanAndParse(); combineScanAndParse();
} }

View File

@@ -215,12 +215,12 @@ void CMakeProcess::handleProcessFinished(int code, QProcess::ExitStatus status)
QString msg; QString msg;
if (status != QProcess::NormalExit) { if (status != QProcess::NormalExit) {
if (m_processWasCanceled) { if (m_processWasCanceled) {
msg = tr("*** cmake process was canceled by the user."); msg = tr("CMake process was canceled by the user.");
} else { } else {
msg = tr("*** cmake process crashed."); msg = tr("CMake process crashed.");
} }
} else if (code != 0) { } else if (code != 0) {
msg = tr("*** cmake process exited with exit code %1.").arg(code); msg = tr("CMake process exited with exit code %1.").arg(code);
} }
if (!msg.isEmpty()) { if (!msg.isEmpty()) {

View File

@@ -88,7 +88,7 @@ void noAutoAdditionNotify(const QStringList &filePaths, const ProjectExplorer::P
"\nCopy the path to the source files to the clipboard?"), "\nCopy the path to the source files to the clipboard?"),
"Remember My Choice", &checkValue, QDialogButtonBox::Yes | QDialogButtonBox::No, "Remember My Choice", &checkValue, QDialogButtonBox::Yes | QDialogButtonBox::No,
QDialogButtonBox::Yes); QDialogButtonBox::Yes);
if (true == checkValue) { if (checkValue) {
if (QDialogButtonBox::Yes == reply) if (QDialogButtonBox::Yes == reply)
settings->setAfterAddFileSetting(AfterAddFileAction::COPY_FILE_PATH); settings->setAfterAddFileSetting(AfterAddFileAction::COPY_FILE_PATH);
else if (QDialogButtonBox::No == reply) else if (QDialogButtonBox::No == reply)

View File

@@ -57,7 +57,7 @@ static void reportFileApiSetupFailure()
{ {
Core::MessageManager::write(QCoreApplication::translate( Core::MessageManager::write(QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Failed to set up cmake fileapi support. Creator can not extract project information.")); "Failed to set up CMake file API support. Qt Creator can not extract project information."));
} }
static std::pair<int, int> cmakeVersion(const QJsonObject &obj) static std::pair<int, int> cmakeVersion(const QJsonObject &obj)
@@ -112,7 +112,7 @@ static ReplyFileContents readReplyFile(const QFileInfo &fi, QString &errorMessag
{ {
const QJsonDocument document = readJsonFile(fi.filePath()); const QJsonDocument document = readJsonFile(fi.filePath());
static const QString msg = QCoreApplication::translate("CMakeProjectManager::Internal", static const QString msg = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid reply file created by cmake."); "Invalid reply file created by CMake.");
ReplyFileContents result; ReplyFileContents result;
if (document.isNull() || document.isEmpty() || !document.isObject()) { if (document.isNull() || document.isEmpty() || !document.isObject()) {
@@ -175,7 +175,7 @@ static CMakeConfig readCacheFile(const QString &cacheFile, QString &errorMessage
if (!checkJsonObject(root, "cache", 2)) { if (!checkJsonObject(root, "cache", 2)) {
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal", errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid cache file generated by cmake."); "Invalid cache file generated by CMake.");
return {}; return {};
} }
@@ -221,7 +221,7 @@ std::vector<CMakeFileInfo> readCMakeFilesFile(const QString &cmakeFilesFile, QSt
if (!checkJsonObject(root, "cmakeFiles", 1)) { if (!checkJsonObject(root, "cmakeFiles", 1)) {
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal", errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid cmakeFiles file generated by cmake."); "Invalid cmakeFiles file generated by CMake.");
return {}; return {};
} }
@@ -252,7 +252,7 @@ std::vector<Directory> extractDirectories(const QJsonArray &directories, QString
if (directories.isEmpty()) { if (directories.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: No directories."); "Invalid codemodel file generated by CMake: No directories.");
return {}; return {};
} }
@@ -262,7 +262,7 @@ std::vector<Directory> extractDirectories(const QJsonArray &directories, QString
if (obj.isEmpty()) { if (obj.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Empty directory object."); "Invalid codemodel file generated by CMake: Empty directory object.");
continue; continue;
} }
Directory dir; Directory dir;
@@ -284,7 +284,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
if (projects.isEmpty()) { if (projects.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: No projects."); "Invalid codemodel file generated by CMake: No projects.");
return {}; return {};
} }
@@ -294,7 +294,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
if (obj.isEmpty()) { if (obj.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Empty project object."); "Invalid codemodel file generated by CMake: Empty project object.");
continue; continue;
} }
Project project; Project project;
@@ -309,7 +309,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
if (project.name.isEmpty() || project.directories.empty()) { if (project.name.isEmpty() || project.directories.empty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Broken project data."); "Invalid codemodel file generated by CMake: Broken project data.");
continue; continue;
} }
@@ -323,7 +323,7 @@ static std::vector<Target> extractTargets(const QJsonArray &targets, QString &er
if (targets.isEmpty()) { if (targets.isEmpty()) {
errorMessage errorMessage
= QCoreApplication::translate("CMakeProjectManager::Internal", = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: No targets."); "Invalid codemodel file generated by CMake: No targets.");
return {}; return {};
} }
@@ -333,7 +333,7 @@ static std::vector<Target> extractTargets(const QJsonArray &targets, QString &er
if (obj.isEmpty()) { if (obj.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Empty target object."); "Invalid codemodel file generated by CMake: Empty target object.");
continue; continue;
} }
Target target; Target target;
@@ -347,7 +347,7 @@ static std::vector<Target> extractTargets(const QJsonArray &targets, QString &er
|| target.directory == -1 || target.project == -1) { || target.directory == -1 || target.project == -1) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Broken target data."); "Invalid codemodel file generated by CMake: Broken target data.");
continue; continue;
} }
@@ -448,7 +448,7 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
if (configs.isEmpty()) { if (configs.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: No configurations."); "Invalid codemodel file generated by CMake: No configurations.");
return {}; return {};
} }
@@ -458,7 +458,7 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
if (obj.isEmpty()) { if (obj.isEmpty()) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Empty configuration object."); "Invalid codemodel file generated by CMake: Empty configuration object.");
continue; continue;
} }
Configuration config; Configuration config;
@@ -471,8 +471,8 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
if (!validateIndexes(config)) { if (!validateIndexes(config)) {
errorMessage errorMessage
= QCoreApplication::translate("CMakeProjectManager::Internal", = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake: Broken " "Invalid codemodel file generated by CMake: Broken "
"indexes in directories/projects/targets."); "indexes in directories, projects, or targets.");
return {}; return {};
} }
@@ -489,7 +489,7 @@ static std::vector<Configuration> readCodemodelFile(const QString &codemodelFile
if (!checkJsonObject(root, "codemodel", 2)) { if (!checkJsonObject(root, "codemodel", 2)) {
errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal", errorMessage = QCoreApplication::translate("CMakeProjectManager::Internal",
"Invalid codemodel file generated by cmake."); "Invalid codemodel file generated by CMake.");
return {}; return {};
} }
@@ -787,7 +787,7 @@ TargetDetails readTargetFile(const QString &targetFile, QString &errorMessage)
if (errorMessage.isEmpty() && !validateTargetDetails(result)) { if (errorMessage.isEmpty() && !validateTargetDetails(result)) {
errorMessage = QCoreApplication::translate( errorMessage = QCoreApplication::translate(
"CMakeProjectManager::Internal", "CMakeProjectManager::Internal",
"Invalid target file generated by cmake: Broken indexes in target details."); "Invalid target file generated by CMake: Broken indexes in target details.");
} }
return result; return result;
} }

View File

@@ -28,6 +28,7 @@
#include <projectexplorer/headerpath.h> #include <projectexplorer/headerpath.h>
#include <projectexplorer/projectmacro.h> #include <projectexplorer/projectmacro.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/optional.h> #include <utils/optional.h>
@@ -155,14 +156,16 @@ void filteredFlags(const QString &fileName,
continue; continue;
} }
if ((flag.startsWith("-I") || flag.startsWith("-isystem") || flag.startsWith("/I")) const QStringList userIncludeFlags{"-I", "/I"};
&& flag != "-I" && flag != "-isystem" && flag != "/I") { const QStringList systemIncludeFlags{"-isystem", "-imsvc", "/imsvc"};
bool userInclude = flag.startsWith("-I"); const QStringList allIncludeFlags = QStringList(userIncludeFlags) << systemIncludeFlags;
const QString pathStr = updatedPathFlag(flag.mid(userInclude ? 2 : 8), const QString includeOpt = Utils::findOrDefault(allIncludeFlags, [flag](const QString &opt) {
workingDir); return flag.startsWith(opt) && flag != opt;
headerPaths.append({pathStr, userInclude });
? HeaderPathType::User if (!includeOpt.isEmpty()) {
: HeaderPathType::System}); const QString pathStr = updatedPathFlag(flag.mid(includeOpt.length()), workingDir);
headerPaths.append({pathStr, userIncludeFlags.contains(includeOpt)
? HeaderPathType::User : HeaderPathType::System});
continue; continue;
} }
@@ -174,8 +177,12 @@ void filteredFlags(const QString &fileName,
continue; continue;
} }
if (flag == "-I" || flag == "-isystem" || flag == "/I") { if (userIncludeFlags.contains(flag)) {
includePathType = (flag != "-isystem") ? HeaderPathType::User : HeaderPathType::System; includePathType = HeaderPathType::User;
continue;
}
if (systemIncludeFlags.contains(flag)) {
includePathType = HeaderPathType::System;
continue; continue;
} }

View File

@@ -1199,7 +1199,6 @@ void DocumentManager::checkForReload()
if (previousDeletedAnswer != FileDeletedCloseAll) { if (previousDeletedAnswer != FileDeletedCloseAll) {
previousDeletedAnswer = previousDeletedAnswer =
fileDeletedPrompt(document->filePath().toString(), fileDeletedPrompt(document->filePath().toString(),
trigger == IDocument::TriggerExternal,
ICore::dialogParent()); ICore::dialogParent());
} }
switch (previousDeletedAnswer) { switch (previousDeletedAnswer) {

View File

@@ -2427,9 +2427,7 @@ IEditor *EditorManager::currentEditor()
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors) bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{ {
DocumentModelPrivate::removeAllSuspendedEntries(); DocumentModelPrivate::removeAllSuspendedEntries();
if (closeDocuments(DocumentModel::openedDocuments(), askAboutModifiedEditors)) return closeDocuments(DocumentModel::openedDocuments(), askAboutModifiedEditors);
return true;
return false;
} }
void EditorManager::closeOtherDocuments(IDocument *document) void EditorManager::closeOtherDocuments(IDocument *document)

View File

@@ -131,6 +131,7 @@ MainWindow::MainWindow()
QCoreApplication::setApplicationName(QLatin1String(Constants::IDE_CASED_ID)); QCoreApplication::setApplicationName(QLatin1String(Constants::IDE_CASED_ID));
QCoreApplication::setApplicationVersion(QLatin1String(Constants::IDE_VERSION_LONG)); QCoreApplication::setApplicationVersion(QLatin1String(Constants::IDE_VERSION_LONG));
QCoreApplication::setOrganizationName(QLatin1String(Constants::IDE_SETTINGSVARIANT_STR)); QCoreApplication::setOrganizationName(QLatin1String(Constants::IDE_SETTINGSVARIANT_STR));
QGuiApplication::setApplicationDisplayName(QLatin1String(Constants::IDE_DISPLAY_NAME));
QString baseName = QApplication::style()->objectName(); QString baseName = QApplication::style()->objectName();
// Sometimes we get the standard windows 95 style as a fallback // Sometimes we get the standard windows 95 style as a fallback
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost() if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()

View File

@@ -273,10 +273,7 @@ void ManhattanStyle::polish(QWidget *widget)
widget->setContentsMargins(0, 0, 0, 0); widget->setContentsMargins(0, 0, 0, 0);
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true); widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
if (qobject_cast<QToolButton*>(widget)) { if (qobject_cast<QToolButton*>(widget) || qobject_cast<QLineEdit*>(widget)) {
widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
} else if (qobject_cast<QLineEdit*>(widget)) {
widget->setAttribute(Qt::WA_Hover); widget->setAttribute(Qt::WA_Hover);
widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2); widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
} else if (qobject_cast<QLabel*>(widget)) { } else if (qobject_cast<QLabel*>(widget)) {
@@ -303,13 +300,12 @@ void ManhattanStyle::unpolish(QWidget *widget)
QProxyStyle::unpolish(widget); QProxyStyle::unpolish(widget);
if (panelWidget(widget)) { if (panelWidget(widget)) {
widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, false); widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, false);
if (qobject_cast<QTabBar*>(widget)) if (qobject_cast<QTabBar*>(widget)
widget->setAttribute(Qt::WA_Hover, false); || qobject_cast<QToolBar*>(widget)
else if (qobject_cast<QToolBar*>(widget)) || qobject_cast<QComboBox*>(widget)) {
widget->setAttribute(Qt::WA_Hover, false);
else if (qobject_cast<QComboBox*>(widget))
widget->setAttribute(Qt::WA_Hover, false); widget->setAttribute(Qt::WA_Hover, false);
} }
}
} }
void ManhattanStyle::polish(QPalette &pal) void ManhattanStyle::polish(QPalette &pal)

View File

@@ -88,10 +88,7 @@ bool isPreviousLineCppStyleComment(const QTextCursor &cursor)
return false; return false;
const QString text = actual.text().trimmed(); const QString text = actual.text().trimmed();
if (text.startsWith(QLatin1String("///")) || text.startsWith(QLatin1String("//!"))) return text.startsWith(QLatin1String("///")) || text.startsWith(QLatin1String("//!"));
return true;
return false;
} }
/// Check if next line is a CppStyle Doxygen Comment /// Check if next line is a CppStyle Doxygen Comment
@@ -106,10 +103,7 @@ bool isNextLineCppStyleComment(const QTextCursor &cursor)
return false; return false;
const QString text = actual.text().trimmed(); const QString text = actual.text().trimmed();
if (text.startsWith(QLatin1String("///")) || text.startsWith(QLatin1String("//!"))) return text.startsWith(QLatin1String("///")) || text.startsWith(QLatin1String("//!"));
return true;
return false;
} }
bool isCppStyleContinuation(const QTextCursor& cursor) bool isCppStyleContinuation(const QTextCursor& cursor)

View File

@@ -442,9 +442,7 @@ static bool canReplaceSpecifier(TranslationUnit *translationUnit, SpecifierAST *
return false; return false;
} }
} }
if (specifier->asAttributeSpecifier()) return !specifier->asAttributeSpecifier();
return false;
return true;
} }
static SpecifierAST *findFirstReplaceableSpecifier(TranslationUnit *translationUnit, SpecifierListAST *list) static SpecifierAST *findFirstReplaceableSpecifier(TranslationUnit *translationUnit, SpecifierListAST *list)

Some files were not shown because too many files have changed in this diff Show More